chromium/third_party/blink/web_tests/editing/inserting/insert_div_with_attr.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 style="height: 12px"></div>',
            '<div spellcheck="false">|baz</div>bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false"><br></div>',
            '<div spellcheck="false">|baz</div>bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR with attribute before "baz"');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz|</div>bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>',
            '<div spellcheck="false">|<br></div>bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR with attribute after "baz"');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>|bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>',
            '<div><br></div>|bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR without attribute before "bar"');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar|',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>|<br>',
                '<div>foo</div>',
                '<div><br class="xyz"></div>',
            '</div>',
        '</div>',
    ].join('')),
    'insert DIV+BR without attribute after "bar"');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>|foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div><br></div>',
            '<div>|foo</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR without attribute before "foo"')

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>foo|</div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>foo</div>',
            '<div>|<br></div>',
            '<div><br class="xyz"></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR without attribute after "foo"')

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>foo</div>',
            '<div>|<br class="xyz"></div>',
        '</div>',
    ].join(''),
    'insertParagraph',
    [
        '<div contenteditable>',
            '<div style="height: 12px"></div>',
            '<div spellcheck="false">baz</div>bar',
            '<div>foo</div>',
            '<div><br class="xyz"></div>',
            '<div>|<br></div>',
        '</div>',
    ].join('')),
    'insert DIV+BR without attribute after BR')
</script>