chromium/third_party/blink/web_tests/editing/execCommand/remove-list-items.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>',
            '<ol>',
                '<li>item1</li>',
                '|one<br>',
                '<br>',
                'one-1',
                '<li>item2</li>',
                'two',
            '</ol>',
        '</div>',
    ].join(''),
    'InsertOrderedList',
    [
        '<div contenteditable>',
            '<ol>',
                '<li>item1</li>',
            '</ol>',
            '|one<br>',
            '<ol>',
                '<br>',
                'one-1',
                '<li>item2</li>',
                'two',
            '</ol>',
        '</div>',
    ].join('')),
    '1 insertOrderedList on text outside LI with BR');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<ol>',
                '<li>item2</li>',
                '|two',
            '</ol>',
        '</div>',
    ].join(''),
    'InsertOrderedList',
    [
        '<div contenteditable>',
            '<ol>',
                '<li>item2</li>',
            '</ol>',
            '|two',
        '</div>',
    ].join('')),
    '2 insertOrderedList on text outside LI');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<ol>',
                '<li>|item1</li>',
            '</ol>',
        '</div>',
    ].join(''),
    'InsertOrderedList',
    '<div contenteditable>|item1</div>'),
    '3 insertOrderedList on text inside LI -> remove list');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<li>|item1</li>',
        '</div>',
    ].join(''),
    'InsertOrderedList',
    [
        '<div contenteditable>',
            '<ol>',
                '<li>|item1</li>',
            '</ol>',
        '</div>',
    ].join('')),
    '4-1 insertOrderedList on LI outside list -> listify');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<li>|item1</li>',
        '</div>',
    ].join(''),
    'InsertUnorderedList',
    [
        '<div contenteditable>',
            '|item1',
        '</div>',
    ].join('')),
    '4-2 insertUnorderedList on LI outside list -> unlistify');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<ul>',
                '<li>|item1</li>',
            '</ul>',
        '</div>',
    ].join(''),
    'InsertOrderedList',
    [
        '<div contenteditable>',
            '<ol>',
                '<li>|item1</li>',
            '</ol>',
        '</div>',
    ].join('')),
    '5-1 insertOrderedList on LI in UL -> switch list type');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<ul>',
                '<li>|item1</li>',
            '</ul>',
        '</div>',
    ].join(''),
    'InsertUnorderedList',
    [
        '<div contenteditable>',
            '|item1',
        '</div>',
    ].join('')),
    '5-2 insertUnrderedList on LI in UL -> unlistify');
</script>