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

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

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style & spurious comment removal. Created 7 years, 4 months 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../editing.js"></script>
5 <script src="resources/util.js"></script>
6 <script src="../../fast/js/resources/js-test-pre.js"></script>
7 </head>
8 <body onload="test();">
9 <pre id="console"></pre>
10 <div id="container">
11 <div id="test_editable" contentEditable>zz zz zz. </div>
12 <textarea id="test_textarea">zz zz zz.</textarea>
13 <input type="text" id="test_textfield" value="zz zz zz."></input>
14 </div>
15 <script>
16 description("Spell checking should be triggered on focus of an editable. " +
17 "To test manually type focus above editable and textarea. Misspellings in them " +
18 "should be marked on focus.");
19
20 var testEditable = document.getElementById('test_editable');
21 var testTextArea = document.getElementById('test_textarea');
22 var testTextField = document.getElementById('test_textfield');
23
24 function test()
25 {
26 if (!window.internals)
27 {
28 log("Automatic testing impossible. Test manually.");
29 return;
30 }
31
32 internals.settings.setUnifiedTextCheckerEnabled(true);
33 internals.settings.setAsynchronousSpellCheckingEnabled(true);
34 internals.setContinuousSpellCheckingEnabled(true);
35
36 function waitForMarkersToAppear(nretry)
37 {
38 if (nretry > 0
39 && !internals.markerCountForNode(findFirstTextNode(testEditable), "s pelling")
40 && !internals.markerCountForNode(findFirstTextNode(testTextArea), "s pelling")
41 && !internals.markerCountForNode(findFirstTextNode(testTextField), " spelling")) {
42 window.setTimeout(function() { waitForMarkersToAppear(nretry - 1); } , 5);
43 } else {
44 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextAre a), "spelling")', '3');
45 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditabl e), "spelling")', '3');
46 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextFie ld), "spelling")', '3');
47 if (window.testRunner)
48 testRunner.notifyDone();
49 }
50 }
51
52 if (window.testRunner) {
53 testRunner.dumpAsText();
54 testRunner.waitUntilDone();
55 }
56
57 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spe lling")', '0');
58 testEditable.focus();
59 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe lling")', '0');
60 testTextArea.focus();
61 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextField), "sp elling")', '0');
62 testTextField.focus();
63 waitForMarkersToAppear(10);
64 }
65
66 </script>
67 <script src="../../fast/js/resources/js-test-post.js"></script>
68 </body>
69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698