chromium/third_party/blink/web_tests/editing/selection/collapse/collapse_around_table.html

<!doctype HTML>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="sample" contenteditable><table contenteditable="false" style="border: 1px solid #aaa"><tr><td>foo</td></tr></table></div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    var sample = document.getElementById('sample');
    selection.collapse(sample, 0);

    assert_equals(selection.anchorNode, sample, 'anchorNode');
    assert_equals(selection.anchorOffset, 0, 'anchorOffset');
    assert_equals(selection.focusNode, sample, 'focusNode');
    assert_equals(selection.focusOffset, 0, 'focusOffset');
}, 'collapse at before table');
test(function() {
    var selection = window.getSelection();
    var sample = document.getElementById('sample');
    selection.collapse(sample, sample.childNodes.length);

    var length = sample.childNodes.length;
    assert_equals(selection.anchorNode, sample, 'anchorNode');
    assert_equals(selection.anchorOffset, length, 'anchorOffset');
    assert_equals(selection.focusNode, sample, 'focusNode');
    assert_equals(selection.focusOffset, length, 'focusOffset');
}, 'collapse at after table');
</script>