Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <head> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 <title>Editing a grammatically-incorrect word</title> | 5 <script src="spellcheck_test.js"></script> |
| 6 </head> | 6 <script> |
| 7 <body> | 7 spellcheck_test( |
| 8 <div id="src" contenteditable="true" spellcheck="true"></div><br/> | 8 '<div contenteditable>You has the right.|</div>', |
| 9 <script language="javascript"> | 9 '', |
| 10 description('Test if WebKit removes grammar markers when we edit a grammatically -incorrect word. ' | 10 '<div contenteditable>You ~has~ the right.</div>', |
| 11 + 'To test manually, type a grammatically-incorrect sentence "You has the ri ght." and type ' | 11 { |
| 12 + 'a backspace key to delete the last character of "has". ' | 12 title: 'Has marker on ungrammatical intial text', |
| 13 + 'This test succeeds when "ha" does not have grammar markers.'); | 13 callback: sample => spellcheck_test( |
| 14 | 14 sample, |
| 15 jsTestIsAsync = true; | 15 () => { |
| 16 if (window.testRunner) | 16 // Delete the end of this sentence until it becomes 'You ha'. |
| 17 testRunner.setMockSpellCheckerEnabled(true); | 17 for (var i = 0; i < 12; ++i) |
|
yosin_UTC9
2016/10/26 08:15:33
nit: s/var/let/
Xiaocheng
2016/10/26 08:19:25
Done.
| |
| 18 | 18 testRunner.execCommand('DeleteBackward'); |
| 19 function editAndCheckSentence() | 19 }, |
| 20 { | 20 '<div contenteditable>You ha</div>', |
| 21 // Delete the end of this sentence until it becomes "You ha". | 21 'Remove grammar markers when editing a grammatically-incorrect word.' |
| 22 for (var i = 0; i < 12; ++i) | 22 ) |
| 23 testRunner.execCommand("DeleteBackward"); | 23 }); |
| 24 | |
| 25 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', fin ishJSTest); | |
| 26 } | |
| 27 | |
| 28 var target = document.getElementById('src'); | |
| 29 target.focus(); | |
| 30 document.execCommand("InsertText", false, "You has the right."); | |
| 31 | |
| 32 if (window.internals) | |
| 33 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', edit AndCheckSentence); | |
| 34 </script> | 24 </script> |
| 35 </body> | |
| 36 </html> | |
| OLD | NEW |