chromium/third_party/blink/web_tests/editing/selection/caret-ltr.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 left of the text. The caret should be on the left
// 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) + 5,
            selection.computeTop(target) + 5);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    `<div contenteditable id="target" style="${kStyle}">|XYZ</div>`,
    'Click the left of text.');
</script>