| 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();"> | |
| 7 <div id="console"></div> | |
| 8 <div id="editable" contenteditable></div> | |
| 9 | |
| 10 <script> | |
| 11 description("Text to check is divided into chunks to make sure checking some hug
e 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) wi
th unified " + | |
| 14 "and synchronous checker on. Only 3 first misspellings should be marked."); | |
| 15 | |
| 16 var testEditable = null; | |
| 17 | |
| 18 function test() | |
| 19 { | |
| 20 testEditable = document.getElementById("editable"); | |
| 21 var loopCount = 150; | |
| 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."; | |
| 26 | |
| 27 var testLongText = ""; | |
| 28 for (var i = 0; i < loopCount; ++i) | |
| 29 testLongText += longText; | |
| 30 | |
| 31 testLongText = "zz zz zz. " + testLongText + "zz zz zz."; | |
| 32 testEditable.innerText = testLongText; | |
| 33 | |
| 34 if (!window.internals) { | |
| 35 log("Test manually. See the description for steps"); | |
| 36 return; | |
| 37 } | |
| 38 | |
| 39 internals.settings.setUnifiedTextCheckerEnabled(true); | |
| 40 internals.settings.setAsynchronousSpellCheckingEnabled(false); | |
| 41 | |
| 42 function waitForMarkersToAppear(node, nretry) | |
| 43 { | |
| 44 if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) { | |
| 45 window.setTimeout(function() { waitForMarkersToAppear(node, nretry -
1); }, 5); | |
| 46 } else { | |
| 47 shouldBe('internals.markerCountForNode(testEditable.childNodes[0], "
spelling")', '3'); | |
| 48 testEditable.removeChild(testEditable.childNodes[0]); | |
| 49 if (window.testRunner) | |
| 50 testRunner.notifyDone(); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 if (window.testRunner) { | |
| 55 testRunner.dumpAsText(); | |
| 56 testRunner.waitUntilDone(); | |
| 57 } | |
| 58 | |
| 59 internals.setContinuousSpellCheckingEnabled(false); | |
| 60 testEditable.focus(); | |
| 61 internals.setContinuousSpellCheckingEnabled(true); | |
| 62 waitForMarkersToAppear(testEditable.childNodes[0], 10); | |
| 63 } | |
| 64 </script> | |
| 65 <script src="../../fast/js/resources/js-test-post.js"></script> | |
| 66 </body> | |
| 67 </html> | |
| OLD | NEW |