| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Editing a grammatically-incorrect word</title> |
| </head> |
| <body> |
| <script src="../../resources/js-test-pre.js"></script> |
| <div id="src" contenteditable="true" spellcheck="true"></div><br/> |
| <script language="javascript"> |
| description('Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. ' |
| + 'To test manually, press backspace key to delete the last character of "has". ' |
| + 'This test succeeds when "ha" does not have grammar markers.'); |
| |
| jsTestIsAsync = true; |
| |
| if (window.internals) { |
| internals.settings.setUnifiedTextCheckerEnabled(true); |
| internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| } |
| |
| function editSentenceAndCheckMarker() |
| { |
| debug('Delete the end of this sentence until it becomes "You ha".'); |
| for (var i = 0; i < 12; ++i) |
| evalAndLog('testRunner.execCommand("DeleteBackward")'); |
| |
| shouldBecomeEqual('internals.hasGrammarMarker(4, 2)', 'false', finishJSTest); |
| } |
| |
| var target = document.getElementById('src'); |
| target.focus(); |
| evalAndLog('document.execCommand("InsertText", false, "You has the right.")'); |
| |
| if (window.internals) |
| shouldBecomeEqual('internals.hasGrammarMarker(4, 3)', 'true', editSentenceAndCheckMarker); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |