chromium/third_party/blink/web_tests/editing/selection/contains-boundaries.html

<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Test for http://bugs.webkit.org/show_bug.cgi?id=14347
// REGRESSION (r21291): Initiating a drag near the edge of a selection deselects
// it.
selection_test(
    [
        '<div id="src">^W|</div>',
        '<div contenteditable id="dst"></div>',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';

        // Drag the selected letter W into the yellow rectangle.
        const source = selection.document.getElementById('src');
        const destination = selection.document.getElementById('dst');

        const x = selection.computeLeft(source) + 1;
        const srcY = selection.computeTop(source) + source.offsetHeight / 2;
        const dstY = selection.computeTop(destination) + source.offsetHeight / 2;

        eventSender.mouseMoveTo(x, srcY);
        eventSender.mouseDown();
        eventSender.leapForward(1000);
        eventSender.mouseMoveTo(x, dstY);
        eventSender.mouseUp();
    },
    [
        '<div id="src">W</div>',
        '<div contenteditable id="dst">^W|</div>',
    ]);
</script>