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

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

Issue 74003003: spellcheck-editable-on-focus.html does not tests all elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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 | 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 <html>
3 <head> 3 <head>
4 <script src="../editing.js"></script> 4 <script src="../editing.js"></script>
5 <script src="resources/util.js"></script> 5 <script src="resources/util.js"></script>
6 <script src="../../resources/js-test.js"></script> 6 <script src="../../resources/js-test.js"></script>
7 </head> 7 </head>
8 <body onload="test();"> 8 <body onload="test();">
9 <div id="container"> 9 <div id="container">
10 <div id="test_editable" contentEditable>zz zz zz.</div> 10 <div id="test_editable" contentEditable>zz zz zz.</div>
11 <textarea id="test_textarea">zz zz zz.</textarea> 11 <textarea id="test_textarea">zz zz zz.</textarea>
12 <input type="text" id="test_textfield" value="zz zz zz."></input> 12 <input type="text" id="test_textfield" value="zz zz zz."></input>
13 </div> 13 </div>
14 <script> 14 <script>
15 description("Spell checking should be triggered on focus of an editable. " 15 description("Spell checking should be triggered on focus of an editable. "
16 + "To test manually, set focus on above elements. The test succeed if " 16 + "To test manually, set focus on above elements. The test succeed if "
17 + "misspellings are marked."); 17 + "misspellings are marked.");
18 18
19 jsTestIsAsync = true; 19 jsTestIsAsync = true;
20 20
21 var testEditable = document.getElementById('test_editable'); 21 var testEditable = document.getElementById('test_editable');
22 var testTextArea = document.getElementById('test_textarea'); 22 var testTextArea = document.getElementById('test_textarea');
23 var testTextField = document.getElementById('test_textfield'); 23 var testTextField = document.getElementById('test_textfield');
24 24
25 function setFocusOnEditableElements() { 25 function triggerSpellingForEditables() {
26 testEditable.focus(); 26 testEditable.focus();
27 testTextArea.focus(); 27 testTextArea.focus();
28 testTextField.focus(); 28 testTextField.focus();
29 } 29 }
30 30
31 var expectedNumberOfMarkers; 31 var expectedNumberOfMarkers;
32 var textNode; 32 var textNode;
33
34 function verifySpellingMarkers(expectation, doneCallback) { 33 function verifySpellingMarkers(expectation, doneCallback) {
35 expectedNumberOfMarkers = expectation; 34 expectedNumberOfMarkers = expectation;
36 textNode = findFirstTextNode(testEditable); 35 shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(testEditab le), "spelling")', 'expectedNumberOfMarkers', function() {
37 shouldBecomeEqual('internals.markerCountForNode(textNode, "spelling")', 'exp ectedNumberOfMarkers', function() { 36 shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(testTe xtArea), "spelling")', 'expectedNumberOfMarkers', function() {
38 shouldBecomeEqual('internals.markerCountForNode(textNode, "spelling")', 'expectedNumberOfMarkers', function() { 37 shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(te stTextField), "spelling")', 'expectedNumberOfMarkers', function() {
39 shouldBecomeEqual('internals.markerCountForNode(textNode, "spelling" )', 'expectedNumberOfMarkers', function() {
40 doneCallback(); 38 doneCallback();
41 // After focusing the editable elements, check whether they have spelling markers. 39 // After focusing the editable elements, check whether they have spelling markers.
42 verifySpellingMarkers(3, finishJSTest); 40 verifySpellingMarkers(3, finishJSTest);
43 }); 41 });
44 }); 42 });
45 }); 43 });
46 } 44 }
47 45
48 function test() { 46 function test() {
49 if (!window.internals) { 47 if (!window.internals) {
50 debug("Automatic testing impossible. Test manually."); 48 debug("Automatic testing impossible. Test manually.");
51 return; 49 return;
52 } 50 }
53 51
54 internals.settings.setUnifiedTextCheckerEnabled(true); 52 internals.settings.setUnifiedTextCheckerEnabled(true);
55 internals.settings.setAsynchronousSpellCheckingEnabled(true); 53 internals.settings.setAsynchronousSpellCheckingEnabled(true);
56 54
57 // Check whether non-focused elements do not have spelling markers, then 55 // Check whether non-focused elements do not have spelling markers, then
58 // verify them when they get focused. 56 // verify them when they get focused.
59 verifySpellingMarkers(0, setFocusOnEditableElements); 57 verifySpellingMarkers(0, triggerSpellingForEditables);
60 } 58 }
61 59
62 </script> 60 </script>
63 </body> 61 </body>
64 </html> 62 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698