| <!doctype html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../assert_selection.js"></script> |
| <script> |
| const isMac = navigator.platform.indexOf('Mac') === 0; |
| const kDeleteWordModifiers = isMac ? ['altKey'] : ['ctrlKey']; |
| |
| test(() => { |
| assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.'); |
| assert_selection( |
| [ |
| '<div contenteditable>', |
| 'one two |cha cha three four cha cha cha', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('insertText', false, ' abc'); |
| eventSender.keyDown('Backspace', kDeleteWordModifiers); |
| selection.document.execCommand('insertText', false, ' cha'); |
| }, |
| [ |
| '<div contenteditable>', |
| 'one two\u{00A0} \u{00A0}cha|cha cha three four cha cha cha', |
| '</div>', |
| ].join('')); |
| }, 'Delete word'); |
| |
| test(() => { |
| assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.'); |
| assert_selection( |
| [ |
| '<div contenteditable>', |
| 'one two |three four', |
| '</div>', |
| ].join(''), |
| selection => { |
| eventSender.keyDown('Backspace', kDeleteWordModifiers); |
| selection.document.execCommand('undo'); |
| }, |
| [ |
| '<div contenteditable>', |
| isMac |
| ? 'one |two ^three four' |
| : 'one two |three four', |
| '</div>', |
| ].join('')); |
| }, 'Delete word then undo'); |
| </script> |