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 const isMac = navigator.platform.indexOf('Mac') === 0; |
| 7 const kDeleteWordModifiers = isMac ? ['altKey'] : ['ctrlKey']; |
| 8 |
| 9 test(() => { |
| 10 assert_not_equals(window.eventSender, undefined, 'This test requires eve
ntSender.'); |
| 11 assert_selection( |
| 12 [ |
| 13 '<div contenteditable>', |
| 14 'one two |cha cha three four cha cha cha', |
| 15 '</div>', |
| 16 ].join(''), |
| 17 selection => { |
| 18 selection.document.execCommand('insertText', false, ' abc'); |
| 19 eventSender.keyDown('Backspace', kDeleteWordModifiers); |
| 20 selection.document.execCommand('insertText', false, ' cha'); |
| 21 }, |
| 22 // BR is a placeholder. |
| 23 [ |
| 24 '<div contenteditable>', |
| 25 'one two \u{00A0}abc cha|cha cha three four cha cha cha', |
| 26 '</div>', |
| 27 ].join('')); |
| 28 }, 'Delete word'); |
| 29 |
| 30 test(() => { |
| 31 assert_not_equals(window.eventSender, undefined, 'This test requires eve
ntSender.'); |
| 32 assert_selection( |
| 33 [ |
| 34 '<div contenteditable>', |
| 35 'one two |three four', |
| 36 '</div>', |
| 37 ].join(''), |
| 38 selection => { |
| 39 eventSender.keyDown('Backspace', kDeleteWordModifiers); |
| 40 selection.document.execCommand('undo'); |
| 41 }, |
| 42 // BR is a placeholder. |
| 43 [ |
| 44 '<div contenteditable>', |
| 45 'one two |three four', |
| 46 '</div>', |
| 47 ].join('')); |
| 48 }, 'Delete word then undo'); |
| 49 </script> |
OLD | NEW |