Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 <style> | 4 <style> |
| 5 .editing { | 5 .editing { |
| 6 border: 2px solid red; | 6 border: 2px solid red; |
| 7 padding: 12px; | 7 padding: 12px; |
| 8 font-size: 24px; | 8 font-size: 24px; |
| 9 } | 9 } |
| 10 </style> | 10 </style> |
| 11 <script src="../../resources/js-test.js"></script> | |
| 11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > | 12 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > |
| 12 | 13 |
| 13 <script> | 14 <script> |
| 14 function log(msg) { | 15 |
| 15 document.getElementById("console").innerHTML += (msg + "\n"); | 16 jsTestIsAsync = true; |
| 17 | |
| 18 if (window.internals) { | |
| 19 internals.settings.setUnifiedTextCheckerEnabled(true); | |
| 20 internals.settings.setAsynchronousSpellCheckingEnabled(true); | |
| 16 } | 21 } |
|
groby-ooo-7-16
2014/03/12 16:37:36
again, probably just abort on missing internals. (
| |
| 17 | 22 |
| 18 function editingTest() { | 23 function editingTest() { |
| 19 | 24 |
| 20 if (window.testRunner) | |
| 21 testRunner.dumpAsText(); | |
| 22 var elem = document.getElementById("test"); | 25 var elem = document.getElementById("test"); |
| 23 var selection = window.getSelection(); | 26 var selection = window.getSelection(); |
| 24 selection.setPosition(elem, 6); | 27 selection.setPosition(elem, 6); |
| 25 | 28 |
| 26 typeCharacterCommand('z'); | 29 typeCharacterCommand('z'); |
| 27 typeCharacterCommand('z'); | 30 typeCharacterCommand('z'); |
| 28 typeCharacterCommand(' '); | 31 typeCharacterCommand(' '); |
| 29 typeCharacterCommand('a'); | 32 typeCharacterCommand('a'); |
| 30 typeCharacterCommand(' '); | 33 typeCharacterCommand(' '); |
| 31 typeCharacterCommand('a'); | 34 typeCharacterCommand('a'); |
| 32 moveSelectionBackwardByWordCommand(); | 35 moveSelectionBackwardByWordCommand(); |
| 33 insertLineBreakCommand(); | 36 insertLineBreakCommand(); |
| 34 | 37 |
| 35 if (window.testRunner) { | 38 if (window.testRunner) { |
| 36 selection.setPosition(elem, 0); | 39 selection.setPosition(elem, 0); |
| 37 if (internals.hasSpellingMarker(document, 6, 2)) | 40 shouldBecomeEqual("internals.hasSpellingMarker(document, 6, 2)", "true", function() { |
| 38 log("PASS"); | 41 document.getElementById("root").style.display = "none"; |
| 39 else | 42 finishJSTest(); |
| 40 log("FAIL"); | 43 }); |
| 41 document.getElementById("root").style.display = "none"; | |
| 42 } | 44 } |
| 43 | 45 |
| 44 } | 46 } |
| 45 | 47 |
| 46 </script> | 48 </script> |
| 47 | 49 |
| 48 <title>Editing Test</title> | 50 <title>Editing Test</title> |
| 49 </head> | 51 </head> |
| 50 <body> | 52 <body> |
| 51 <div>You should see 'zz a' on the first line below, and 'a' on the second line. 'zz' (and only 'zz') should be marked as misspelled.</div> | 53 <script> |
| 54 description("Misspellings should be preserved when a line-break command " | |
| 55 + "splits a text node. You should see 'Hello,zz a' on the first line below, " | |
| 56 + "and 'a' on the second line. " | |
| 57 + "This test succeeds when 'zz' (and only 'zz') is marked as misspelled."); | |
| 58 </script> | |
| 52 <div contenteditable id="root" class="editing"> | 59 <div contenteditable id="root" class="editing"> |
| 53 <!-- wee need leading "Hello," to preserve the marker even after setPosition() - -> | 60 <!-- wee need leading "Hello," to preserve the marker even after setPosition() - -> |
|
groby-ooo-7-16
2014/03/12 16:37:36
Nit: "we". I know it's not yours, but while you're
grzegorz
2014/03/12 21:33:08
Sure, I'll fix that as well.
| |
| 54 <span id="test">Hello,</span> | 61 <span id="test">Hello,</span> |
| 55 </div> | 62 </div> |
| 56 <pre id="console"></pre> | |
| 57 <script> | 63 <script> |
| 58 editingTest(); | 64 editingTest(); |
| 59 </script> | 65 </script> |
| 60 | |
| 61 </body> | 66 </body> |
| 62 </html> | 67 </html> |
| OLD | NEW |