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

Unified Diff: LayoutTests/editing/spelling/spelling-huge-text.html

Issue 23332004: Trigger spell check/remove markers if spell checker gets enabled/disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: true=>asynchronous 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
Index: LayoutTests/editing/spelling/spelling-huge-text.html
diff --git a/LayoutTests/editing/spelling/spelling-huge-text.html b/LayoutTests/editing/spelling/spelling-huge-text.html
new file mode 100644
index 0000000000000000000000000000000000000000..a5d3270d3f8d89f2efcd092b603cad58875f1e37
--- /dev/null
+++ b/LayoutTests/editing/spelling/spelling-huge-text.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body onload="test();">
+<div id="console"></div>
+<div id="editable" contenteditable></div>
+
+<script>
+description("Text to check is divided into chunks to make sure checking some huge text " +
+"does not freeze the page/UI. With the asynchronous spell checker the whole text is checked. " +
+"To test manaully trigger spell checking of the editable (e.g. by copy+paste) with unified " +
+"and asynchronous checker on. There should be 6 misspellings marked.");
+
+var testEditable = null;
+
+function test()
+{
+ testEditable = document.getElementById("editable");
+ var loopCount = 150;
+ var longText = "Good good good good good good good good good good good good good. " +
+ "Good good good good good good good good good good good good good. " +
+ "Good good good good good good good good good good good good good. " +
+ "Good good good good good good good good good good good good good.";
+
+ var testLongText = "";
+ for (var i = 0; i < loopCount; ++i)
+ testLongText += longText;
+
+ testLongText = "zz zz zz. " + testLongText + " zz zz zz.";
+ testEditable.innerText = testLongText;
+
+ if (!window.internals) {
+ log("Test manually. See the description for steps");
+ return;
+ }
+
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+
+ function waitForMarkersToAppear(node, nretry)
+ {
+ if (nretry > 0 && internals.markerCountForNode(node, "spelling") < 6) {
+ window.setTimeout(function() { waitForMarkersToAppear(node, nretry - 1); }, 1);
+ } else {
+ shouldBe('internals.markerCountForNode(testEditable.childNodes[0], "spelling")', '6');
+ testEditable.removeChild(testEditable.childNodes[0]);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ }
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ internals.setContinuousSpellCheckingEnabled(false);
+ testEditable.focus();
+ internals.setContinuousSpellCheckingEnabled(true);
+ waitForMarkersToAppear(testEditable.childNodes[0], 10);
+}
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698