| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../assert_selection.js"></script> |
| 5 <script> |
| 6 test(() => assert_selection( |
| 7 '<div contenteditable><span>|XXXX</span></div>', |
| 8 selection => { |
| 9 for (var i = 0; i < 3; ++i) |
| 10 selection.document.execCommand('insertText', false, 'a'); |
| 11 for (var i = 0; i < 2; ++i) |
| 12 selection.modify('move', 'forward', 'character'); |
| 13 for (var i = 0; i < 3; ++i) |
| 14 selection.document.execCommand('insertText', false, 'b'); |
| 15 for (var i = 0; i < 2; ++i) |
| 16 selection.modify('move', 'forward', 'character'); |
| 17 for (var i = 0; i < 3; ++i) |
| 18 selection.document.execCommand('insertText', false, 'c'); |
| 19 }, |
| 20 '<div contenteditable><span>aaaXXbbbXXccc|</span></div>'), |
| 21 'Typing simulation 1'); |
| 22 |
| 23 test(() => assert_selection( |
| 24 '<div contenteditable>|Foo <i> bar</i></div>', |
| 25 selection => { |
| 26 for (var i = 0; i < 4; ++i) |
| 27 selection.modify('move', 'forward', 'character'); |
| 28 for (var i = 0; i < 3; ++i) |
| 29 selection.document.execCommand('insertText', false, 'x'); |
| 30 }, |
| 31 '<div contenteditable>Foo xxx|<i>bar</i></div>'), |
| 32 'Typing simulation 2'); |
| 33 |
| 34 test(() => assert_selection( |
| 35 '<div contenteditable><span>|</span></div>', |
| 36 selection => { |
| 37 function typeWord(n) { |
| 38 for (var i = 0; i < n; ++i) |
| 39 selection.document.execCommand('insertText', false, 'x'); |
| 40 selection.document.execCommand('insertText', false, ' '); |
| 41 } |
| 42 typeWord(4); |
| 43 typeWord(1); |
| 44 typeWord(2); |
| 45 }, |
| 46 '<div contenteditable>xxxx x xx\u{00A0}|<span></span></div>'), |
| 47 'Typing simulation 3'); |
| 48 </script> |
| OLD | NEW |