<!DOCTYPE html>
<html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<textarea id="text" rows="3" cols="100">Dragging and dropping second line including interchange newline
at the start should set the event.data with the text for inputType
insertFromDrop</textarea>
<script>
const text = document.getElementById("text");
let eventData;
text.addEventListener('input', (evt) => {
if(evt.inputType == 'insertFromDrop')
eventData = evt.data;
});
test(function () {
text.focus();
// Selecting second line of the text including newline at start.
text.setSelectionRange(63, 130);
const selectedData = getSelection().toString();
// Note drag and drop doesn't work well with pointerActionSequence, so using
// eventSender.
// Move mouse to the second line of the text.
eventSender.mouseMoveTo((text.offsetLeft + 10), (text.offsetHeight + text.offsetTop) / 2);
eventSender.mouseDown();
eventSender.leapForward(500);
// Move mouse to the first line of the text.
eventSender.mouseMoveTo(text.offsetLeft + 10 , text.offsetTop);
eventSender.mouseUp();
// Event data should now be set with the first line of the text
assert_equals(selectedData, "\nat the start should set the event.data with the text for inputType");
assert_equals(eventData, selectedData);
}, 'Input event data for inputType insertFromDrop should be set');
</script>
</body>
</html>