4 <script src=
"../../resources/js-test.js"></script>
6 <body onload=
"test();">
7 <div id=
"console"></div>
8 <div id=
"editable" contenteditable
></div>
11 description("Text to check is divided into chunks to make sure checking some huge text " +
12 "does not freeze the page/UI. With the synchronous spell checker only one chunk is checked. " +
13 "To test manaully trigger spell checking of the editable (e.g. by copy+paste) with unified " +
14 "and synchronous checker on. Only 3 first misspellings should be marked.");
16 var testEditable
= null;
20 testEditable
= document
.getElementById("editable");
22 var longText
= "Good good good good good good good good good good good good good. " +
23 "Good good good good good good good good good good good good good. " +
24 "Good good good good good good good good good good good good good. " +
25 "Good good good good good good good good good good good good good.";
27 var testLongText
= "";
28 for (var i
= 0; i
< loopCount
; ++i
)
29 testLongText
+= longText
;
31 testLongText
= "zz zz zz. " + testLongText
+ "zz zz zz.";
32 testEditable
.innerText
= testLongText
;
34 if (!window
.internals
) {
35 log("Test manually. See the description for steps");
39 internals
.settings
.setUnifiedTextCheckerEnabled(true);
40 internals
.settings
.setAsynchronousSpellCheckingEnabled(false);
42 function waitForMarkersToAppear(node
, nretry
)
44 if (nretry
> 0 && !internals
.markerCountForNode(node
, "spelling")) {
45 window
.setTimeout(function() { waitForMarkersToAppear(node
, nretry
- 1); }, 5);
47 shouldBe('internals.markerCountForNode(testEditable.childNodes[0], "spelling")', '3');
48 testEditable
.removeChild(testEditable
.childNodes
[0]);
49 if (window
.testRunner
)
50 testRunner
.notifyDone();
54 if (window
.testRunner
) {
55 testRunner
.waitUntilDone();
58 internals
.setContinuousSpellCheckingEnabled(false);
60 internals
.setContinuousSpellCheckingEnabled(true);
61 waitForMarkersToAppear(testEditable
.childNodes
[0], 10);