OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.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. ' | 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 ' | 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". ' | 12 + 'a backspace key to delete the last character of "has". ' |
13 + 'This test succeeds when "ha" does not have grammar markers.'); | 13 + 'This test succeeds when "ha" does not have grammar markers.'); |
14 | 14 |
15 jsTestIsAsync = true; | 15 jsTestIsAsync = true; |
| 16 if (window.testRunner) |
| 17 testRunner.setMockSpellCheckerEnabled(true); |
16 | 18 |
17 function editAndCheckSentence() | 19 function editAndCheckSentence() |
18 { | 20 { |
19 // Delete the end of this sentence until it becomes "You ha". | 21 // Delete the end of this sentence until it becomes "You ha". |
20 for (var i = 0; i < 12; ++i) | 22 for (var i = 0; i < 12; ++i) |
21 testRunner.execCommand("DeleteBackward"); | 23 testRunner.execCommand("DeleteBackward"); |
22 | 24 |
23 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', fin
ishJSTest); | 25 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', fin
ishJSTest); |
24 } | 26 } |
25 | 27 |
26 var target = document.getElementById('src'); | 28 var target = document.getElementById('src'); |
27 target.focus(); | 29 target.focus(); |
28 document.execCommand("InsertText", false, "You has the right."); | 30 document.execCommand("InsertText", false, "You has the right."); |
29 | 31 |
30 if (window.internals) | 32 if (window.internals) |
31 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', edit
AndCheckSentence); | 33 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', edit
AndCheckSentence); |
32 </script> | 34 </script> |
33 </body> | 35 </body> |
34 </html> | 36 </html> |
OLD | NEW |