chromium/third_party/blink/web_tests/editing/selection/modify-by-lineboundary-in-inline-editable-contexts.html

<!doctype html>
<script src="../../resources/ahem.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This test ensures that modifying the selection by line boundary granularity
// (like home/end do) functions properly in an inline editable context.

// adjacent, editable spans
selection_test(
    '<span contenteditable>a|bc</span><span contenteditable>xyz</span>',
    selection => selection.modify('move', 'forward', 'lineboundary'),
    '<span contenteditable>abc|</span><span contenteditable>xyz</span>',
    '1 End key: adjacent, editable spans');
selection_test(
    '<span contenteditable>a|bc</span><span contenteditable>xyz</span>',
    selection => selection.modify('move', 'backward', 'lineboundary'),
    '<span contenteditable>|abc</span><span contenteditable>xyz</span>',
    '2 Home key: adjacent, editable spans');

// editable span in non-editable content
selection_test(
    'abc <span contenteditable>X|YZ</span> def',
    selection => selection.modify('move', 'forward', 'lineboundary'),
    'abc <span contenteditable>XYZ|</span> def',
    '1 End key: editable span in non-editable content');
selection_test(
    'abc <span contenteditable>X|YZ</span> def',
    selection => selection.modify('move', 'backward', 'lineboundary'),
    'abc <span contenteditable>|XYZ</span> def',
    '2 Home key: editable span in non-editable content');
</script>