chromium/third_party/blink/web_tests/editing/execCommand/insert-list-and-stitch.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>

// InsertOrderedList command insert a list, and also tries to stitch with
// already present ordered list.

// Initially no list present, insert ordered list at 'item1'
selection_test(
  [
      '<div contenteditable>',
        '<div id="item1">|foo</div>',
        '<div id="item2">bar</div>',
        '<div id="item3">baz</div>',
      '</div>'
  ],
  'InsertOrderedList',
  [
      '<div contenteditable>',
        '<div id="item1"><ol><li>|foo</li></ol></div>',
        '<div id="item2">bar</div>',
        '<div id="item3">baz</div>',
      '</div>'
  ],
  'InsertOrderedList commands insert list'
);

// InsertOrderedList at already exisiting <ol> adds to list
// and also stitches as well.
selection_test(
  [
      '<div contenteditable>',
        '<div id="item1"><ol><li>foo</li></ol></div>',
        '<div id="item2">|bar</div>',
        '<div id="item3">baz</div>',
      '</div>'
  ],
  'InsertOrderedList',
  [
      '<div contenteditable>',
        '<div id="item1"><ol><li>foo</li>',
        '<li>|bar</li></ol></div>',
        '<div id="item3">baz</div>',
      '</div>'
  ],
  'InsertOrderedList commands insert list and stitches items together'
);

// InsertOrderedList at already exisiting <ol> adds to list
// and also stitches as well.
selection_test(
  [
      '<div contenteditable>',
        '<div id="item1"><ol><li>foo</li>',
        '<li>bar</li></ol></div>',
        '<div id="item3">|baz</div>',
      '</div>'
  ],
  'InsertOrderedList',
  [
      '<div contenteditable>',
        '<div id="item1"><ol><li>foo</li>',
        '<li>bar</li>',
        '<li>|baz</li></ol></div>',
      '</div>'
  ],
  'InsertOrderedList insert list and stitches items together'
);
</script>