OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body onload="test(document.getElementById('destination'), document.getElementBy
Id('frame').contentWindow.document);"> | 6 <body onload="test(document.getElementById('destination'), document.getElementBy
Id('frame').contentWindow.document);"> |
7 <pre id="console"></pre> | 7 <pre id="console"></pre> |
8 <div id="container"> | 8 <div id="container"> |
9 <div id="destination" contentEditable></div> | 9 <div id="destination" contentEditable></div> |
10 <iframe id="frame" src="data:text/html,<body contenteditable></body>"></iframe
> | 10 <iframe id="frame" src="data:text/html,<body contenteditable></body>"></iframe
> |
11 </div> | 11 </div> |
12 | 12 |
13 <script> | 13 <script> |
14 description("Spell check markers should be removed from the whole page when disa
bling spell checker but " + | 14 description("Spell check markers should be removed from the whole page when disa
bling spell checker but " + |
15 "they should be restored in the focused editable if spell checker gets enabled.
" + | 15 "they should be restored in the focused editable if spell checker gets enabled.
" + |
16 "To test manually type something with mispellings in the above editable element
and iframe and turn " + | 16 "To test manually type something with mispellings in the above editable element
and iframe and turn " + |
17 "spell checker off - misspelling markers should disappear. Having the editable f
ocused " + | 17 "spell checker off - misspelling markers should disappear. Having the editable f
ocused " + |
18 "turn spell checker on again. Misspellings in the editable should be marked agai
n."); | 18 "turn spell checker on again. Misspellings in the editable should be marked agai
n."); |
19 | 19 |
| 20 jsTestIsAsync = true; |
| 21 |
20 var destination_elm = null; | 22 var destination_elm = null; |
21 var destination_elm_in_frame = null; | 23 var destination_elm_in_frame = null; |
22 | 24 |
23 function test(destination, frame_doc) | 25 function test(destination, frame_doc) |
24 { | 26 { |
25 if (!window.internals) | 27 if (!window.internals) |
26 { | 28 { |
27 document.getElementById("console").innerHTML = "Automatic testing imposs
ible. Test manually.\n"; | 29 document.getElementById("console").innerHTML = "Automatic testing imposs
ible. Test manually.\n"; |
28 return; | 30 return; |
29 } | 31 } |
30 | 32 |
31 internals.settings.setAsynchronousSpellCheckingEnabled(false); | 33 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
32 internals.settings.setUnifiedTextCheckerEnabled(true); | 34 internals.settings.setUnifiedTextCheckerEnabled(true); |
33 | 35 |
34 function waitForMarkersToAppear(node, nretry) | 36 function waitForMarkersToAppear(node, nretry) |
35 { | 37 { |
36 if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) { | 38 if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) { |
37 window.setTimeout(function() { waitForMarkersToAppear(node, nretry -
1); }, 1); | 39 window.setTimeout(function() { waitForMarkersToAppear(node, nretry -
1); }, 1); |
38 } | 40 } |
39 } | 41 } |
40 | 42 |
41 destination_elm = destination; | 43 destination_elm = destination; |
42 destination_elm_in_frame = frame_doc.body; | 44 destination_elm_in_frame = frame_doc.body; |
43 destination_elm.focus(); | 45 destination_elm.focus(); |
44 document.execCommand("InsertText", false, "zz."); | 46 document.execCommand("InsertText", false, "zz."); |
45 waitForMarkersToAppear(destination_elm.childNodes[0], 10); | 47 waitForMarkersToAppear(destination_elm.childNodes[0], 10); |
46 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); | 48 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); |
47 destination_elm_in_frame.focus(); | 49 destination_elm_in_frame.focus(); |
48 frame_doc.execCommand("InsertText", false, "zz."); | 50 frame_doc.execCommand("InsertText", false, "zz."); |
49 waitForMarkersToAppear(destination_elm_in_frame.childNodes[0], 10); | 51 waitForMarkersToAppear(destination_elm_in_frame.childNodes[0], 10); |
50 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '1'); | 52 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '1'); |
51 internals.setContinuousSpellCheckingEnabled(false); | 53 internals.setContinuousSpellCheckingEnabled(false); |
52 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '0'); | 54 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '0'); |
53 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '0'); | 55 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '0'); |
54 destination_elm.focus(); | 56 destination_elm.focus(); |
55 internals.setContinuousSpellCheckingEnabled(true); | 57 internals.setContinuousSpellCheckingEnabled(true); |
56 waitForMarkersToAppear(destination_elm.childNodes[0], 10); | 58 waitForMarkersToAppear(destination_elm.childNodes[0], 10); |
57 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); | 59 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); |
58 | 60 |
| 61 finishJSTest(); |
59 } | 62 } |
60 | 63 |
61 </script> | 64 </script> |
62 <script src="../../fast/js/resources/js-test-post.js"></script> | 65 <script src="../../fast/js/resources/js-test-post.js"></script> |
63 </body> | 66 </body> |
64 </html> | 67 </html> |
OLD | NEW |