blob: aabf8999c7239b72381783ad94fa38bb07163d8f [file] [log] [blame]
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => {
assert_not_equals(window.internals, undefined,
'This test requires window.internals to access clipboard');
assert_selection(
[
'<div contenteditable>',
'^<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>|',
'<div id="target">replaceme</div>',
'</div>',
].join(''),
selection => {
selection.document.execCommand('copy');
const target = selection.document.getElementById('target');
selection.collapse(target, 0);
selection.extend(target, 1);
selection.document.execCommand('paste');
},
[
'<div contenteditable>',
'<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
'<div id="target">',
'<table><tbody><tr><td>one</td><td>two<br>|<br></td></tr></tbody></table>',
'</div>',
'</div>',
].join(''),
'Paste TABLE to replace text');
}, 'Paste TABLE');
</script>