Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <style> | |
| 5 .editing { | |
| 6 border: 2px solid red; | |
| 7 padding: 12px; | |
| 8 font-size: 24px; | |
| 9 } | |
| 10 </style> | |
| 11 <script src="../editing.js" language="JavaScript" type="text/JavaScript" ></scri pt> | |
| 12 <script src="../../fast/js/resources/js-test-pre.js"></script> | |
| 13 </head> | |
| 14 <body> | |
| 15 <textarea id="testTextArea"></textarea><br/> | |
| 16 <input type="text" id="testInput" /><br/> | |
| 17 <br/> | |
| 18 <textarea id="aux"></textarea> | |
| 19 <script> | |
| 20 description("Markers in text inpus should only be visible if an input is being e dited" + | |
|
please use gerrit instead
2013/07/30 21:32:00
spelling: inpus -> inputs
| |
| 21 " 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
| |
| 22 "When testing manually type something misspelled in the first textarea, " + | |
| 23 "focus the text input and type something with misspellings there too." + | |
| 24 "Then focus the second text area. Mispelling marks should be removed from the in put" + | |
| 25 "but not for the first textarea. Focus the input again - misspelling marks shoul d be restored."); | |
| 26 | |
| 27 function findFirstTextNode(node) | |
|
please use gerrit instead
2013/07/30 21:32:00
These functions look like they can be reused in ot
| |
| 28 { | |
| 29 function iterToFindFirstTextNode(node) | |
| 30 { | |
| 31 if (node instanceof Text) | |
| 32 return node; | |
| 33 | |
| 34 var childNodes = node.childNodes; | |
| 35 for (var i = 0; i < childNodes.length; ++i) { | |
| 36 var n = iterToFindFirstTextNode(childNodes[i]); | |
| 37 if (n) | |
| 38 return n; | |
| 39 } | |
| 40 | |
| 41 return null; | |
| 42 } | |
| 43 | |
|
please use gerrit instead
2013/07/30 21:32:00
Please remove the second blank line here.
| |
| 44 | |
| 45 if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) { | |
| 46 return iterToFindFirstTextNode(internals.shadowRoot(node)); | |
| 47 } else | |
| 48 return iterToFindFirstTextNode(node); | |
| 49 } | |
| 50 | |
| 51 function typeText(elem, text) { | |
| 52 elem.focus(); | |
| 53 for (var i = 0; i < text.length; ++i) { | |
| 54 typeCharacterCommand(text[i]); | |
| 55 } | |
| 56 } | |
| 57 if (!window.internals) { | |
|
please use gerrit instead
2013/07/30 21:32:00
Please add a space after the closing brace of type
| |
| 58 alert("Test manually. See the description for steps"); | |
| 59 var successfullyParsed = true; | |
| 60 return; | |
| 61 } | |
| 62 | |
| 63 var testTextArea = document.getElementById("testTextArea"); | |
| 64 var testInput = document.getElementById("testInput"); | |
| 65 | |
| 66 if (window.internals) { | |
| 67 // internals.settings.setAsynchronousSpellCheckingEnabled(false); | |
| 68 internals.settings.setUnifiedTextCheckerEnabled(true); | |
| 69 } | |
| 70 | |
| 71 if (window.testRunner) | |
| 72 testRunner.dumpAsText(); | |
| 73 | |
| 74 typeText(testTextArea, 'zz. '); | |
| 75 if (window.internals) { | |
| 76 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe lling")', '1'); | |
| 77 } | |
| 78 | |
| 79 typeText(testInput, 'zz zz zz zz. '); | |
| 80 if (window.internals) { | |
| 81 shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelli ng")', '4'); | |
| 82 | |
| 83 } | |
| 84 | |
| 85 document.getElementById("aux").focus(); | |
| 86 | |
| 87 if (window.internals) { | |
| 88 shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelli ng")', '0'); | |
| 89 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe lling")', '1'); | |
| 90 } | |
| 91 | |
| 92 testInput.focus(); | |
| 93 if (window.internals) { | |
| 94 shouldBe('internals.markerCountForNode(findFirstTextNode(testInput), "spelli ng")', '4'); | |
| 95 shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spe lling")', '1'); | |
| 96 } | |
| 97 | |
| 98 var successfullyParsed = true; | |
| 99 </script> | |
| 100 <script src="../../fast/js/resources/js-test-post.js"></script> | |
| 101 </body> | |
| 102 </html> | |
| OLD | NEW |