| Index: LayoutTests/editing/spelling/markers-input-type-text.html
|
| diff --git a/LayoutTests/editing/spelling/markers-input-type-text.html b/LayoutTests/editing/spelling/markers-input-type-text.html
|
| index 9c58585e3d46b95837db51ad3b02f6dac727660a..122585a51609d4894cc9fd49765ea0964a37f6d5 100644
|
| --- a/LayoutTests/editing/spelling/markers-input-type-text.html
|
| +++ b/LayoutTests/editing/spelling/markers-input-type-text.html
|
| @@ -13,44 +13,65 @@
|
| <script src="../../resources/js-test.js"></script>
|
| </head>
|
| <body>
|
| -<pre id="console"></pre>
|
| <textarea id="testTextArea"></textarea><br/>
|
| <input type="text" id="testInput" /><br/>
|
| <br/>
|
| <textarea id="aux"></textarea>
|
| <script>
|
| -description("Markers in text inputs should only be visible if an input is being edited " +
|
| -"but removing markers from the input must not touch other markers." +
|
| -"When testing manually type something misspelled in the first textarea, " +
|
| -"focus the text input and type something with misspellings there too." +
|
| -"Then focus the second text area. Mispelling marks should be removed from the input" +
|
| -"but not for the first textarea. Focus the input again - misspelling marks should be restored.");
|
| +description("Misspelling markers in text inputs should only be visible if an input is being edited "
|
| + + "but removing markers from the input must not touch other markers. "
|
| + + "To test manually, focus the text input, then focus the second text area. "
|
| + + "The test succeed if misspellings were removed from the input "
|
| + + "but not for the first textarea. Focus the input again - misspelling markers should be restored.");
|
|
|
| -var testTextArea = document.getElementById("testTextArea");
|
| -var testInput = document.getElementById("testInput");
|
| -
|
| -if (!window.internals) {
|
| - log("Test manually. See the description for steps.");
|
| - return;
|
| +if (window.internals) {
|
| + internals.settings.setUnifiedTextCheckerEnabled(true);
|
| + internals.settings.setAsynchronousSpellCheckingEnabled(true);
|
| }
|
|
|
| -internals.settings.setUnifiedTextCheckerEnabled(true);
|
| +jsTestIsAsync = true;
|
| +
|
| +var testTextArea = document.getElementById("testTextArea");
|
| +var testInput = document.getElementById("testInput");
|
| +var auxTextArea = document.getElementById("aux");
|
|
|
| typeText(testTextArea, 'zz. ');
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1');
|
| +typeText(testInput, 'zz. ');
|
|
|
| -typeText(testInput, 'zz zz zz zz. ');
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '4');
|
| +function verifyMisspellings(e, shouldBeMarked) {
|
| + if (!window.internals)
|
| + return;
|
|
|
| -document.getElementById("aux").focus();
|
| + element = e;
|
| + expectedMarkerCount = shouldBeMarked ? 1 : 0;
|
| + shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(element), "spelling")', 'expectedMarkerCount', done);
|
| +}
|
|
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '0');
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1');
|
| +function setFocus(e) {
|
| + e.focus();
|
| + done();
|
| +}
|
|
|
| -testInput.focus();
|
| +var tests = [
|
| + function() { verifyMisspellings(testInput, true); },
|
| + function() { verifyMisspellings(testTextArea, true); },
|
| + function() { setFocus(auxTextArea);}, // Focusing text area should remove markers of input element.
|
| + function() { verifyMisspellings(testInput, false); },
|
| + function() { verifyMisspellings(testTextArea, true); },
|
| + function() { setFocus(testInput); }, // Focusing input element should preserve markers of text area.
|
| + function() { verifyMisspellings(testInput, true); },
|
| + function() { verifyMisspellings(testTextArea, true); }
|
| +];
|
|
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '4');
|
| -shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1');
|
| +function done()
|
| +{
|
| + var next = tests.shift();
|
| + if (next)
|
| + return window.setTimeout(next, 0);
|
| +
|
| + finishJSTest();
|
| +}
|
| +done();
|
| </script>
|
| </body>
|
| </html>
|
|
|