Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src=../../resources/js-test.js language="javascript" type="text/javascri pt"></script> | 4 <script src=../../resources/testharness.js></script> |
|
yosin_UTC9
2016/08/10 07:49:44
So nice! (^_^)b
| |
| 5 <title>Testing moving cursor to a misspelled word</title> | 5 <script src=../../resources/testharnessreport.js></script> |
| 6 </head> | 6 <script src=resources/util.js></script> |
| 7 <title>Testing moving cursor to a misspelled word</title> | |
| 8 </head> | |
| 7 <body> | 9 <body> |
| 8 <div id="src" contenteditable="true" spellcheck="true"></div><br/> | 10 <div id="src" contenteditable></div> |
| 9 <script language="javascript"> | 11 <script> |
| 10 description('Test if Chrome spellchecks a word again when changing a misspelled word.' + | 12 var node = document.getElementById('src'); |
| 11 'To test manually, type a misspelled word "zz " and type a backspace key twice.' + | |
| 12 'This test succeeds when "z" is not marked as misspelled.'); | |
| 13 | 13 |
| 14 jsTestIsAsync = true; | 14 var steps = [ |
| 15 function() { | |
| 16 node.focus(); | |
| 17 document.execCommand('InsertText', false, 'z'); | |
| 18 document.execCommand('InsertText', false, 'z'); | |
| 19 document.execCommand('InsertText', false, ' '); | |
| 20 }, | |
| 21 function() { | |
| 22 testRunner.execCommand("DeleteBackward"); | |
|
yosin_UTC9
2016/08/10 07:49:44
nit: Could you use single-quote since other parts
Xiaocheng
2016/08/10 08:06:33
Whoops. Didn't notice that during copy-and-paste.
| |
| 23 testRunner.execCommand("DeleteBackward"); | |
| 24 document.execCommand("InsertText", false, ' '); | |
| 25 } | |
| 26 ]; | |
| 15 | 27 |
| 16 var node = document.getElementById('src'); | 28 var assertions = [ |
| 17 node.focus(); | 29 () => assert_true(internals.hasSpellingMarker(document, 0, 2)), |
| 18 function insertText(text) { | 30 () => assert_false(internals.hasSpellingMarker(document, 0, 1)) |
| 19 document.execCommand("InsertText", false, text); | 31 ]; |
| 20 } | |
| 21 shouldBeTrue('insertText("z"); insertText("z"); insertText(" "); internals.hasSp ellingMarker(document, 0, 2)'); | |
| 22 | 32 |
| 23 debug('Enable asynchronous spellchecking, delete two characters, and insert a sp ace'); | 33 runSpellingTest(steps, assertions, 'Blink spellchecks a word again when changing a misspelled word'); |
| 24 internals.settings.setUnifiedTextCheckerEnabled(true); | |
| 25 | |
| 26 testRunner.execCommand("DeleteBackward"); | |
| 27 testRunner.execCommand("DeleteBackward"); | |
| 28 document.execCommand("InsertText", false, ' '); | |
| 29 | |
| 30 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 1)', 'false', finish JSTest); | |
| 31 </script> | 34 </script> |
| 32 </body> | 35 </body> |
| 33 </html> | 36 </html> |
| OLD | NEW |