Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / grammar-edit-word.html
blob0a47170ebf6c54e2f2b916f6c28628b58e68330e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <title>Editing a grammatically-incorrect word</title>
6 </head>
7 <body>
8 <div id="src" contenteditable="true" spellcheck="true"></div><br/>
9 <script language="javascript">
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 right." and type '
12 + 'a backspace key to delete the last character of "has". '
13 + 'This test succeeds when "ha" does not have grammar markers.');
15 jsTestIsAsync = true;
17 if (window.internals) {
18 internals.settings.setUnifiedTextCheckerEnabled(true);
19 internals.settings.setAsynchronousSpellCheckingEnabled(true);
22 function editAndCheckSentence()
24 // Delete the end of this sentence until it becomes "You ha".
25 for (var i = 0; i < 12; ++i)
26 testRunner.execCommand("DeleteBackward");
28 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', finishJSTest);
31 var target = document.getElementById('src');
32 target.focus();
33 document.execCommand("InsertText", false, "You has the right.");
35 if (window.internals)
36 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', editAndCheckSentence);
37 </script>
38 </body>
39 </html>