chromium/third_party/blink/web_tests/editing/execCommand/indent-pre-paragraphs.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>',
      '^<pre>hello</pre>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>^hello|</pre>',
      '</blockquote>',
    '</div>',
  ].join('')), '0 select all children');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '^<pre>\nhello\n\nworld\n\nblink\n</pre>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>^hello</pre>',
        '<pre>\n</pre><pre>world</pre><pre>\n</pre><pre>blink|</pre>',
      '</blockquote>',
    '</div>',
  ].join('')), '1 select all children with blank lines');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '^<pre>\nhello\nworld\nblink\n</pre>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>^hello</pre><pre>world</pre><pre>blink|</pre>',
      '</blockquote>',
    '</div>',
  ].join('')), '2 select all children with newlines');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<pre>\n^hello|\n\nworld\n</pre>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>^hello|</pre>',
      '</blockquote>',
      '<pre>\nworld\n</pre>',
    '</div>',
  ].join('')), '3 select line 1');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<pre>\nhello\n|\nworld\n</pre>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<pre>hello|\n</pre>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>\n</pre>',
      '</blockquote>',
      '<pre>world\n</pre>',
    '</div>',
  ].join('')), '4 select line 2');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<pre>\nhello\n\n^worl|d\n</pre>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<pre>hello\n^\n</pre>',
      '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
        '<pre>worl|d</pre>',
      '</blockquote>',
    '</div>',
  ].join('')), '5 select line 3');
</script>