Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7569d137c4e4f8d3e0bf3de48258aff15def202 |
| --- /dev/null |
| +++ b/LayoutTests/editing/spelling/markers-input-type-text.html |
| @@ -0,0 +1,102 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<style> |
| +.editing { |
| + border: 2px solid red; |
| + padding: 12px; |
| + font-size: 24px; |
| +} |
| +</style> |
| +<script src="../editing.js" language="JavaScript" type="text/JavaScript" ></script> |
| +<script src="../../fast/js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body> |
| +<textarea id="testTextArea"></textarea><br/> |
| +<input type="text" id="testInput" /><br/> |
| +<br/> |
| +<textarea id="aux"></textarea> |
| +<script> |
| +description("Markers in text inpus should only be visible if an input is being edited" + |
|
please use gerrit instead
2013/07/30 21:32:00
spelling: inpus -> inputs
|
| +" but removing markers from the input must not touch other markers." + |
|
please use gerrit instead
2013/07/30 21:32:00
Please add a space before " at the end of the line
|
| +"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."); |
| + |
| +function findFirstTextNode(node) |
|
please use gerrit instead
2013/07/30 21:32:00
These functions look like they can be reused in ot
|
| +{ |
| + function iterToFindFirstTextNode(node) |
| + { |
| + if (node instanceof Text) |
| + return node; |
| + |
| + var childNodes = node.childNodes; |
| + for (var i = 0; i < childNodes.length; ++i) { |
| + var n = iterToFindFirstTextNode(childNodes[i]); |
| + if (n) |
| + return n; |
| + } |
| + |
| + return null; |
| + } |
| + |
|
please use gerrit instead
2013/07/30 21:32:00
Please remove the second blank line here.
|
| + |
| + if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) { |
| + return iterToFindFirstTextNode(internals.shadowRoot(node)); |
| + } else |
| + return iterToFindFirstTextNode(node); |
| +} |
| + |
| +function typeText(elem, text) { |
| + elem.focus(); |
| + for (var i = 0; i < text.length; ++i) { |
| + typeCharacterCommand(text[i]); |
| + } |
| +} |
| +if (!window.internals) { |
|
please use gerrit instead
2013/07/30 21:32:00
Please add a space after the closing brace of type
|
| + alert("Test manually. See the description for steps"); |
| + var successfullyParsed = true; |
| + return; |
| +} |
| + |
| +var testTextArea = document.getElementById("testTextArea"); |
| +var testInput = document.getElementById("testInput"); |
| + |
| +if (window.internals) { |
| + // internals.settings.setAsynchronousSpellCheckingEnabled(false); |
| + internals.settings.setUnifiedTextCheckerEnabled(true); |
| +} |
| + |
| +if (window.testRunner) |
| + testRunner.dumpAsText(); |
| + |
| +typeText(testTextArea, 'zz. '); |
| +if (window.internals) { |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1'); |
| +} |
| + |
| +typeText(testInput, 'zz zz zz zz. '); |
| +if (window.internals) { |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '4'); |
| + |
| +} |
| + |
| +document.getElementById("aux").focus(); |
| + |
| +if (window.internals) { |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '0'); |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1'); |
| +} |
| + |
| +testInput.focus(); |
| +if (window.internals) { |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelling")', '4'); |
| + shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '1'); |
| +} |
| + |
| +var successfullyParsed = true; |
| +</script> |
| +<script src="../../fast/js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |