Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 5 <title>Editing a grammatically-incorrect word</title> | 5 <title>Editing a grammatically-incorrect word</title> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <div id="src" contenteditable="true" spellcheck="true"></div><br/> | 8 <div id="src" contenteditable="true" spellcheck="true"></div><br/> |
| 9 <script language="javascript"> | 9 <script language="javascript"> |
| 10 description('Test if WebKit removes grammar markers when we edit a grammatically -incorrect word. To test manually, type a grammatically-incorrect sentence "You has the right." and type a backspace key to delete the last character of "has". This test succeeds when "ha" does not have grammar markers.'); | 10 description('Test if WebKit removes grammar markers when we edit a grammatically -incorrect word. ' |
| 11 + 'To test manually, type a grammatically-incorrect sentence "You has the ri ght." and type ' | |
| 12 + 'a backspace key to delete the last character of "has". ' | |
| 13 + 'This test succeeds when "ha" does not have grammar markers.'); | |
| 11 | 14 |
| 12 internals.settings.setUnifiedTextCheckerEnabled(true); | 15 jsTestIsAsync = true; |
| 16 | |
| 17 if (window.internals) { | |
| 18 internals.settings.setUnifiedTextCheckerEnabled(true); | |
| 19 internals.settings.setAsynchronousSpellCheckingEnabled(true); | |
| 20 } | |
| 21 | |
| 22 function editAndCheckSentence() | |
| 23 { | |
| 24 // Delete the end of this sentence until it becomes "You ha". | |
| 25 for (var i = 0; i < 12; ++i) | |
| 26 testRunner.execCommand("DeleteBackward"); | |
| 27 | |
| 28 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', fin ishJSTest); | |
| 29 } | |
| 30 | |
| 13 var target = document.getElementById('src'); | 31 var target = document.getElementById('src'); |
| 14 target.focus(); | 32 target.focus(); |
| 33 document.execCommand("InsertText", false, "You has the right."); | |
| 15 | 34 |
| 16 evalAndLog('document.execCommand("InsertText", false, "You has the right.")'); | 35 if (window.internals) |
| 17 shouldBeTrue('internals.hasGrammarMarker(document, 4, 3)'); | 36 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', edit AndCheckSentence); |
| 18 | |
| 19 debug('Delete the end of this sentence until it becomes "You ha".'); | |
| 20 for (var i = 0; i < 12; ++i) | |
| 21 evalAndLog('testRunner.execCommand("DeleteBackward")'); | |
| 22 shouldBeFalse('internals.hasGrammarMarker(document, 4, 2)'); | |
| 23 | 37 |
| 24 internals.settings.setUnifiedTextCheckerEnabled(false); | 38 internals.settings.setUnifiedTextCheckerEnabled(false); |
|
groby-ooo-7-16
2013/10/24 16:47:49
Is that actually needed? I don't think there's a p
grzegorz
2013/10/25 09:41:08
Done.
| |
| 25 </script> | 39 </script> |
| 26 <script src="../../fast/js/resources/js-test-post.js"></script> | 40 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 27 </body> | 41 </body> |
| 28 </html> | 42 </html> |
| OLD | NEW |