Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: LayoutTests/editing/spelling/spellcheck-disable-enable.html

Issue 21130005: Trigger spell check/remove markers if spell checker gets enabled/disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert paste related changes Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-disable-enable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-disable-enable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698