| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <body> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 <script src="../../editing/editing.js"></script> | 5 <script src="spellcheck_test.js"></script> |
| 6 <div id="div" contenteditable="true"></div> | 6 |
| 7 <script> | 7 <script> |
| 8 description('This tests for a bug when moving the caret backward through ' | 8 spellcheck_test( |
| 9 + 'a misspelled word. Once the caret is no longer adjacent to it, ' | 9 '<div contenteditable>|</div>', |
| 10 + 'it should be marked as misspelled.'); | 10 'insertText This sentence ends with a misspelled word asd.', |
| 11 | 11 '<div contenteditable>This sentence ends with a misspelled word #asd#.</div>
', |
| 12 jsTestIsAsync = true; | 12 { |
| 13 if (window.testRunner) | 13 title: 'Mark misspelled word "asd" after typing.', |
| 14 testRunner.setMockSpellCheckerEnabled(true); | 14 callback: sample => spellcheck_test( |
| 15 | 15 sample, |
| 16 var div = document.getElementById("div"); | 16 () => { |
| 17 div.focus(); | 17 const selection = sample.selection; |
| 18 document.execCommand("InsertText", false, "This sentence ends with a misspelled
word asd."); | 18 selection.modify('move', 'backward', 'character'); |
| 19 | 19 selection.modify('move', 'backward', 'character'); |
| 20 moveSelectionBackwardByCharacterCommand(); | 20 selection.modify('move', 'backward', 'character'); |
| 21 moveSelectionBackwardByCharacterCommand(); | 21 selection.modify('move', 'backward', 'character'); |
| 22 moveSelectionBackwardByCharacterCommand(); | 22 selection.modify('move', 'backward', 'character'); |
| 23 moveSelectionBackwardByCharacterCommand(); | 23 }, |
| 24 moveSelectionBackwardByCharacterCommand(); | 24 '<div contenteditable>This sentence ends with a misspelled word #asd#.
</div>', |
| 25 moveSelectionBackwardByCharacterCommand(); | 25 'Misspelled word should still be marked when caret is no longer adjace
nt with it.') |
| 26 | 26 }); |
| 27 if (window.internals) | |
| 28 shouldBecomeEqual("internals.hasSpellingMarker(document, 42, 3)", "true", fi
nishJSTest); | |
| 29 </script> | 27 </script> |
| 30 </body> | |
| 31 </html> | |
| OLD | NEW |