chromium/third_party/blink/web_tests/editing/selection/vertical-rl-ltr-extend-line-backward-wrap.html

<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>This tests horizontal caret movement in vertical writing mode. "ある。" and "名前はまだ" must be selected.</p>
<div id="test" style="-webkit-writing-mode: vertical-rl; outline: none;" contenteditable>
<p id="p1">吾輩は猫である。名前はまだ無い。</p>
</div>
<span id="span-for-height-calc" style="-webkit-writing-mode: vertical-rl; outline: none;">
<p>吾輩は猫である。<br>名前はまだ無い。</p>
</span>
<div id="log"></div>
<script>
test(function() {
    var desiredHeight = document.getElementById('span-for-height-calc');
    var test = document.getElementById('test');
    test.style.height = (desiredHeight.offsetHeight + 2) + 'px';
    desiredHeight.style.display = 'none';

    var selection = window.getSelection();
    var p1 = document.getElementById('p1');
    selection.collapse(p1.firstChild, 13);
    selection.modify('Extend', 'Backward', 'Line');

    assert_false(selection.isCollapsed, 'isCollapsed');
    assert_equals(selection.anchorNode, p1.firstChild, 'anchorNode');
    assert_equals(selection.anchorOffset, 13, 'anchorOffset');
    assert_equals(selection.focusNode, p1.firstChild, 'focusNode');
    assert_equals(selection.focusOffset, 5, 'focusOffset');
});
</script>