blob: 66bf00f03ed2d0e5c595c1e200102ff5dfe9586a [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.eventSender, undefined,
'This test requires eventSender');
assert_selection(
'<div contenteditable><span id="dragme">^hello|</span> world</div>',
selection => {
// Drag 'hello'
const dragMe = selection.document.getElementById('dragme');
const editor = dragMe.parentNode;
const editorLeft = editor.offsetLeft + selection.document.offsetLeft;
const editorTop = editor.offsetTop + selection.document.offsetTop;
const x = editorLeft + dragMe.offsetWidth / 2;
const y = editorTop + dragMe.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
// and drop it off to the right somewhere
eventSender.leapForward(500);
eventSender.mouseMoveTo(editorLeft + editor.offsetWidth, y);
eventSender.mouseUp();
},
'<div contenteditable>world^hello|</div>',
'Drag "hello" after "wold"');
});
</script>