| Index: LayoutTests/editing/spelling/spellcheck-disable-enable.html
|
| diff --git a/LayoutTests/editing/spelling/spellcheck-disable-enable.html b/LayoutTests/editing/spelling/spellcheck-disable-enable.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c82f4033ea576617acb9c9ce8a2b43cdf2b96c17
|
| --- /dev/null
|
| +++ b/LayoutTests/editing/spelling/spellcheck-disable-enable.html
|
| @@ -0,0 +1,64 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../fast/js/resources/js-test-pre.js"></script>
|
| +</head>
|
| +<body onload="test(document.getElementById('destination'), document.getElementById('frame').contentWindow.document);">
|
| +<pre id="console"></pre>
|
| +<div id="container">
|
| + <div id="destination" contentEditable></div>
|
| + <iframe id="frame" src="data:text/html,<body contenteditable></body>"></iframe>
|
| +</div>
|
| +
|
| +<script>
|
| +description("Spell check markers should be removed from the whole page when disabling spell checker but " +
|
| +"they should be restored in the focused editable if spell checker gets enabled. " +
|
| +"To test manually type something with mispellings in the above editable element and iframe and turn " +
|
| +"spell checker off - misspelling markers should disappear. Having the editable focused " +
|
| +"turn spell checker on again. Misspellings in the editable should be marked again.");
|
| +
|
| +var destination_elm = null;
|
| +var destination_elm_in_frame = null;
|
| +
|
| +function test(destination, frame_doc)
|
| +{
|
| + if (!window.internals)
|
| + {
|
| + document.getElementById("console").innerHTML = "Automatic testing impossible. Test manually.\n";
|
| + return;
|
| + }
|
| +
|
| + internals.settings.setAsynchronousSpellCheckingEnabled(false);
|
| + internals.settings.setUnifiedTextCheckerEnabled(true);
|
| +
|
| + function waitForMarkersToAppear(node, nretry)
|
| + {
|
| + if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) {
|
| + window.setTimeout(function() { waitForMarkersToAppear(node, nretry - 1); }, 1);
|
| + }
|
| + }
|
| +
|
| + destination_elm = destination;
|
| + destination_elm_in_frame = frame_doc.body;
|
| + destination_elm.focus();
|
| + document.execCommand("InsertText", false, "zz.");
|
| + waitForMarkersToAppear(destination_elm.childNodes[0], 10);
|
| + shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spelling")', '1');
|
| + destination_elm_in_frame.focus();
|
| + frame_doc.execCommand("InsertText", false, "zz.");
|
| + waitForMarkersToAppear(destination_elm_in_frame.childNodes[0], 10);
|
| + shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0], "spelling")', '1');
|
| + internals.setContinuousSpellCheckingEnabled(false);
|
| + shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spelling")', '0');
|
| + shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0], "spelling")', '0');
|
| + destination_elm.focus();
|
| + internals.setContinuousSpellCheckingEnabled(true);
|
| + waitForMarkersToAppear(destination_elm.childNodes[0], 10);
|
| + shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spelling")', '1');
|
| +
|
| +}
|
| +
|
| +</script>
|
| +<script src="../../fast/js/resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|