chromium/third_party/blink/web_tests/editing/selection/modify_move/move_left_right_character_in_mixed_bidi.html

<!doctype HTML>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=51344">WebKit issue 51344</a>: move left/right by character should not hang.
<div id="ltr" dir="ltr" contenteditable>&#x0661;&#x0661;123&#x0645;&#x0627;&#x0631;&#x0633;</div>
<div id="rtl" dir="rtl" contenteditable>&#1494;&#1495; &#x202a;&#1491;&#1492;&#x202a;car &#1493;&#x202c;&#x202c;  </div>
<div id="log"></div>
<script>
test(function() {
    var sample = document.getElementById('ltr');
    var selection = window.getSelection();
    selection.collapse(sample.firstChild, 6);
    selection.modify('move', 'right', 'character');
    assert_equals(selection.anchorOffset, 7);
}, 'move right character');

test(function() {
    var sample = document.getElementById('rtl');
    var selection = window.getSelection();
    selection.collapse(sample.firstChild, 3);
    selection.modify('move', 'left', 'character');

    assert_equals(selection.anchorOffset, 4);
}, 'move left character');
</script>