chromium/third_party/blink/web_tests/editing/selection/caret-ltr-right.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This tests that clicking in a contenteditable div will set the caret in the
// right position for LTR text in a LTR block.
//
// To test manually, click the right of the text. The caret should be on the
// right edge.
const kStyle = [
    'border: solid thin black;',
    'font-size: 20px;',
    'padding: 10px;',
    'width: 20ex;',
].join('');

selection_test(
    `<div contenteditable id="target" style="${kStyle}">XYZ</div>`,
    selection => {
        const target = selection.document.getElementById('target');
        if (!window.eventSender)
            throw 'This test requires eventSender.';
        eventSender.leapForward(9999); // reset mouse click state
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + target.offsetWidth - 5,
            selection.computeTop(target) + target.offsetHeight / 2);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    `<div contenteditable id="target" style="${kStyle}">XYZ|</div>`,
    'Click the right of text.');
</script>