chromium/third_party/blink/web_tests/fast/dom/Range/deleteData-replaceData-count-overflow.html

<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
test(() => {
    const textNode = new Text('chopped off and then some');
    const range = new Range();
    range.setStart(textNode, textNode.length);
    textNode.deleteData(11, 0xfffffff7);
    assert_equals(textNode.data, 'chopped off');
    assert_equals(range.endOffset, 11);
}, 'Range#deleteData() with huge end offset');

test(() => {
    const textNode = new Text('hello world');
    const range = new Range();
    range.setStart(textNode, textNode.length);
    textNode.replaceData(6, 0xfffffffe, 'bob');
    assert_equals(textNode.data, 'hello bob');
    assert_equals(range.endOffset, 6);
}, 'Range#replaceData() with huge end offset');

test(() => {
    const textNode = new Text('hello world');
    const range = new Range();
    range.setStart(textNode, textNode.length);
    textNode.replaceData(6, -1, 'bob');
    assert_equals(textNode.data, 'hello bob');
    assert_equals(range.endOffset, 6);
}, 'Range#replaceData() with negative end offset(-1)');

test(() => {
    const textNode = new Text('hello world');
    const range = new Range();
    range.setStart(textNode, textNode.length);
    textNode.replaceData(6, -2, 'bob');
    assert_equals(textNode.data, 'hello bob');
    assert_equals(range.endOffset, 6);
}, 'Range#replaceData() with negative end offset(-2)');
</script>