Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html

Issue 2450403004: Convert editing/spelling/spellcheck-editable-on-focus.html with spellcheck_test (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!doctype html>
2 <html> 2 <script src="../../resources/testharness.js"></script>
3 <head> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../editing.js"></script> 4 <script src="../assert_selection.js"></script>
5 <script src="resources/util.js"></script> 5 <script src="spellcheck_test.js"></script>
6 <script src="../../resources/js-test.js"></script> 6
7 </head>
8 <body>
9 <div id="container">
10 <div id="test_editable" contentEditable>zz zz zz.</div>
11 <textarea id="test_textarea">zz zz zz.</textarea>
12 <input type="text" id="test_textfield" value="zz zz zz."></input>
13 </div>
14 <script> 7 <script>
15 description("Spell checking should be triggered on focus of an editable. " 8 spellcheck_test(
16 + "To test manually, set focus on above elements. The test succeed if " 9 '<div contenteditable>zz zz zz.</div>',
17 + "misspellings are marked."); 10 '',
11 '<div contenteditable>zz zz zz.</div>',
12 {
13 title: 'Misspelled text in editable DIV is not marked before focused.',
14 callback: sample => spellcheck_test(
15 sample,
16 document => document.querySelector('div').focus(),
17 '<div contenteditable>#zz# #zz# #zz#.</div>',
18 'Spellchecking in editable DIV triggered on focus.')
19 });
18 20
19 jsTestIsAsync = true; 21 spellcheck_test(
20 if (window.testRunner) 22 '<textarea>zz zz zz.</textarea>',
21 testRunner.setMockSpellCheckerEnabled(true); 23 '',
24 '<textarea>zz zz zz.</textarea>',
25 {
26 title: 'Misspelled text in TEXTAREA is not marked before focused.',
27 callback: sample => spellcheck_test(
28 sample,
29 document => document.querySelector('textarea').focus(),
30 '<textarea>#zz# #zz# #zz#.</textarea>',
31 'Spellchecking in TEXTAREA triggered on focus.')
32 });
22 33
23 function findFirstTextNodeOf(id) { 34 spellcheck_test(
24 return findFirstTextNode(document.getElementById(id)); 35 '<input value="zz zz zz.">',
25 } 36 '',
26 37 '<input value="zz zz zz.">',
27 var expectedNumberOfMarkers = "0"; 38 {
28 function checkMarkersFor(elementID, doFocus, continuation) { 39 title: 'Misspelled text in INPUT is not marked before focused.',
29 var element = document.getElementById(elementID); 40 callback: sample => spellcheck_test(
30 if (doFocus) 41 sample,
31 element.focus(); 42 document => document.querySelector('input').focus(),
32 shouldBecomeEqual('internals.markerCountForNode(findFirstTextNodeOf("' + ele mentID + '"), "spelling")', expectedNumberOfMarkers, continuation); 43 '<input value="#zz# #zz# #zz#.">',
33 } 44 'Spellchecking in INPUT triggered on focus.')
34
35 function verifySpellingMarkers(doFocus, doneCallback) {
36 checkMarkersFor('test_editable', doFocus, function () {
37 checkMarkersFor('test_textarea', doFocus, function () {
38 checkMarkersFor('test_textfield', doFocus, function () {
39 doneCallback && doneCallback();
40 // After focusing the editable elements, check whether they have spelling markers.
41 expectedNumberOfMarkers = "3";
42 verifySpellingMarkers(true, finishJSTest);
43 });
44 });
45 }); 45 });
46 }
47
48 function test() {
49 if (!window.internals) {
50 debug("Automatic testing impossible. Test manually.");
51 return;
52 }
53
54 // Check whether non-focused elements do not have spelling markers, then
55 // verify them when they get focused.
56 verifySpellingMarkers(false);
57 }
58 test();
59 </script> 46 </script>
60 </body>
61 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698