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