chromium/third_party/blink/web_tests/editing/pasteboard/drop-text-without-selection.html

<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<p>
    This is a test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=8394">http://bugzilla.opendarwin.org/show_bug.cgi?id=8394</a>
    Editable region does not accept dropped text if there is no selection</i>.
</p>
<p>
    The text field should accept drag-and-dropped text, such as the link, even if
    no text is currently selected.
</p>
<hr>
<input id="field">
<a id="link" href="http://www.ibm.com/">drop me into the text field</a>

<script>
test(() => {
    assert_own_property(window, 'eventSender');

    var link = document.getElementById("link");

    var x = link.offsetLeft + link.offsetWidth / 2;
    var y = link.offsetTop + link.offsetHeight / 2;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    // Wait a moment so that the mouseDown will kick off a drag instead of starting a new selection.
    eventSender.leapForward(400);
    var field = document.getElementById("field");
    
    x = field.offsetLeft + field.offsetWidth / 2;
    y = field.offsetTop + field.offsetHeight / 2;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseUp();

    assert_equals(field.value, 'http://www.ibm.com/');
});

</script>

</body>