blob: 4f8041a720d0b5272c16bc60a314a495160100b3 [file] [log] [blame]
<!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>