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="../../resources/js-test.js"></script> | 6 <script src="../../resources/js-test.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
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 if (window.testRunner) |
| 21 testRunner.setMockSpellCheckerEnabled(true); |
| 22 |
20 var testEditable = document.getElementById('test_editable'); | 23 var testEditable = document.getElementById('test_editable'); |
21 var testTextArea = document.getElementById('test_textarea'); | 24 var testTextArea = document.getElementById('test_textarea'); |
22 var testTextField = document.getElementById('test_textfield'); | 25 var testTextField = document.getElementById('test_textfield'); |
23 | 26 |
24 if (!window.internals) { | 27 if (!window.internals) { |
25 log("Automatic testing impossible. Test manually."); | 28 log("Automatic testing impossible. Test manually."); |
26 } else { | 29 } else { |
27 internals.setSpellCheckingEnabled(true); | 30 internals.setSpellCheckingEnabled(true); |
28 | 31 |
29 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spe
lling")', '0'); | 32 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spe
lling")', '0'); |
30 testEditable.focus(); | 33 testEditable.focus(); |
31 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spe
lling")', '3'); | 34 shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spe
lling")', '3'); |
32 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe
lling")', '0'); | 35 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe
lling")', '0'); |
33 testTextArea.focus(); | 36 testTextArea.focus(); |
34 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe
lling")', '3'); | 37 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe
lling")', '3'); |
35 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextField), "sp
elling")', '0'); | 38 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextField), "sp
elling")', '0'); |
36 testTextField.focus(); | 39 testTextField.focus(); |
37 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextField), "sp
elling")', '3'); | 40 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextField), "sp
elling")', '3'); |
38 } | 41 } |
39 </script> | 42 </script> |
40 </body> | 43 </body> |
41 </html> | 44 </html> |
OLD | NEW |