chromium/third_party/blink/web_tests/editing/selection/caret-rtl-2.html

<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
const bidiCaretAffinityEnabled =
    window.internals && internals.runtimeFlags.bidiCaretAffinityEnabled;

selection_test(
    [
        '<div contenteditable id="target">',
            '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';
        const target = selection.document.getElementById('target');
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + 3,
            selection.computeLeft(target) + 3);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    [
        '<div contenteditable id="target">',
            bidiCaretAffinityEnabled
              ? '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;|'
              : '|\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ], 'Click left');
selection_test(
    [
        '<div contenteditable id="target">',
            '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';
        const target = selection.document.getElementById('target');
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + target.offsetWidth - 3,
            selection.computeLeft(target) + 3);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    [
        '<div contenteditable id="target">',
            bidiCaretAffinityEnabled
              ? '|\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;'
              : '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;|',
        '</div>',
    ], 'Click right');
</script>