OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body onload="test(document.getElementById('destination'), document.getElementBy
Id('frame').contentWindow.document);"> |
| 7 <pre id="console"></pre> |
| 8 <div id="container"> |
| 9 <div id="destination" contentEditable></div> |
| 10 <iframe id="frame" src="data:text/html,<body contenteditable></body>"></iframe
> |
| 11 </div> |
| 12 |
| 13 <script> |
| 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.
" + |
| 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 " + |
| 18 "turn spell checker on again. Misspellings in the editable should be marked agai
n."); |
| 19 |
| 20 var destination_elm = null; |
| 21 var destination_elm_in_frame = null; |
| 22 |
| 23 function test(destination, frame_doc) |
| 24 { |
| 25 if (!window.internals) |
| 26 { |
| 27 document.getElementById("console").innerHTML = "Automatic testing imposs
ible. Test manually.\n"; |
| 28 return; |
| 29 } |
| 30 |
| 31 internals.settings.setAsynchronousSpellCheckingEnabled(false); |
| 32 internals.settings.setUnifiedTextCheckerEnabled(true); |
| 33 |
| 34 function waitForMarkersToAppear(node, nretry) |
| 35 { |
| 36 if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) { |
| 37 window.setTimeout(function() { waitForMarkersToAppear(node, nretry -
1); }, 1); |
| 38 } |
| 39 } |
| 40 |
| 41 destination_elm = destination; |
| 42 destination_elm_in_frame = frame_doc.body; |
| 43 destination_elm.focus(); |
| 44 document.execCommand("InsertText", false, "zz."); |
| 45 waitForMarkersToAppear(destination_elm.childNodes[0], 10); |
| 46 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); |
| 47 destination_elm_in_frame.focus(); |
| 48 frame_doc.execCommand("InsertText", false, "zz."); |
| 49 waitForMarkersToAppear(destination_elm_in_frame.childNodes[0], 10); |
| 50 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '1'); |
| 51 internals.setContinuousSpellCheckingEnabled(false); |
| 52 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '0'); |
| 53 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0
], "spelling")', '0'); |
| 54 destination_elm.focus(); |
| 55 internals.setContinuousSpellCheckingEnabled(true); |
| 56 waitForMarkersToAppear(destination_elm.childNodes[0], 10); |
| 57 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell
ing")', '1'); |
| 58 |
| 59 } |
| 60 |
| 61 </script> |
| 62 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 63 </body> |
| 64 </html> |
OLD | NEW |