chromium/third_party/blink/web_tests/editing/deleting/delete_at_paragraph_boundaries.html

<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p><p>^<br></p><p>B|</p><p><br></p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<p>A</p><p>|<br></p><p><br></p>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a block with a BR placeholder in it and extends to the end of a block.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p>^<br><p>B|</p><p><br></p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<p>A</p>|<br><p><br></p>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a BR element and extends to the end of a block.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p><p>^<br></p><p>B|C</p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<p>A</p><p>|C</p>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a block with a BR placeholder in it and extends to a character that is not at the end of a block. This ensures that some of our "special-case" code does not run for this case');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p>^<br><p>B|C</p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div><p>A</p><p>|C</p></div>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a BR element and extends to a character that is not at the end of a block. This ensures that some of our "special-case" code does not run for this case.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p>^<br><p>B</p>|<br>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p>|<br>',
                '</div>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a BR element and extends to the end of the document.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p><p>^<br></p><p>B</p><p>|<br></p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>',
                    '<p>A</p><p>|<br></p>',
                '</div>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in a blank line created by a block with a BR placeholder in it and extends to the end of the document.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    'one<p>two</p><p>^three</p><p>fo|ur</p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                'one<p>two</p><p>|ur</p>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts at the beginning of a paragraph preceded by another block and extends into the middle of a following paragraph.');


    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    'one<p>two</p><p>three</p><p>fo^ur|</p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>',
                    'one<p>two</p><p>three</p><p>fo|</p>',
                '</div>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts in the middle of the last paragraph and extends to the end of that paragraph');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    'one<p>^two</p><p>thr|ee</p><p>four</p>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                // TODO(yosin): We should revise "delete" command not have BR
                // after "four".
                'one<p>|ee</p><p>four<br></p>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts at the beginning of a paragraph preceded by a text element and extends into the middle of a following paragraph.');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>',
                    'one',
                    '<div>two</div>',
                    '<div>',
                        '<div>before</div>',
                        '^three',
                    '</div>',
                    '<div>fo|ur</div>',
                    '<div>after</div>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>',
                    'one',
                    '<div>two</div>',
                    '<div>',
                        '<div>before</div>',
                    '</div>',
                    '<div>|ur</div>',
                    '<div>after</div>',
                '</div>',
            '</div>',
        ].join('')),
        'Deleting when a selection starts at the beginning of a text following a nested block, and extends out of the enclosing block into the following block.');
</script>