blob: 2d23c24f03e90b90771ea4b97c3ba5d812dd58cb [file] [log] [blame]
<!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>hello</div><div>world</div><div>Blink</div>|',
'</div>',
].join(''),
'formatBlock P',
[
'<div contenteditable>',
'<p>^hello<br>world<br>Blink|</p>',
'</div>',
].join('')), '0 select all children with P');
test(() => assert_selection(
[
'<div contenteditable>',
'^<p>hello</p><p>world</p>|',
'</div>',
].join(''),
'formatBlock blockquote',
[
'<div contenteditable>',
'^<blockquote>hello<br>world</blockquote>|',
'</div>',
].join('')), '1 select all children BLOCKQUOTE');
test(() => assert_selection(
[
'<div contenteditable>',
'^<div>hello<pre>world</pre></div>|',
'</div>',
].join(''),
'formatBlock blockquote',
[
'<div contenteditable>',
'<blockquote>^hello<br>world|</blockquote>',
'</div>',
].join('')), '2 select all children P');
test(() => assert_selection(
[
'<div contenteditable>',
'^<h1>hello</h1><div><h2>world</h2><h3>Blink</h3></div>|',
'</div>',
].join(''),
'formatBlock blockquote',
[
'<div contenteditable>',
'^<blockquote>hello<br>world<br>Blink</blockquote>|',
'</div>',
].join('')), '3 select all children PRE');
test(() => assert_selection(
[
'<div contenteditable>',
'<div>hello<p>^world</p>Blin|k</div>',
'</div>',
].join(''),
'formatBlock H1',
[
'<div contenteditable>',
'hello<h1>^world<br>Blink|</h1>',
'</div>',
].join('')), '4 select for lines 2, 3 with H1');
test(() => assert_selection(
[
'<div contenteditable>',
'<pre>^hello\nworld|\nBlink\n</pre>',
'</div>',
].join(''),
'formatBlock BLOCKQUOTE',
[
'<div contenteditable>',
'<pre><blockquote>^hello<br>world|</blockquote>Blink\n</pre>',
'</div>',
].join('')), '5 select for lines 1, 2 with BLOCKQUOTE');
test(() => assert_selection(
[
'<div contenteditable>',
'<pre>hello\n^world\nBlin|k\n</pre>',
'</div>',
].join(''),
'formatBlock BLOCKQUOTE',
[
'<div contenteditable>',
'<pre>hello\n<blockquote>^world<br>Blin|k</blockquote></pre>',
'</div>',
].join('')), '6 select for lines 2, 3 with BLOCKQUOTE');
test(() => assert_selection(
[
'<div contenteditable>',
'^hello<p>world|</p><p>webkit</p>',
'</div>',
].join(''),
'formatBlock PRE',
[
'<div contenteditable>',
'<pre>^hello<br>world|</pre><p>webkit</p>',
'</div>',
].join('')), '7 select for lines 2, 3 with PRE');
test(() => assert_selection(
[
'<div contenteditable>',
'<div>hello</div><div>^world</div><div>blin|k</div>',
'</div>',
].join(''),
'formatBlock PRE',
[
'<div contenteditable>',
'<div>hello</div><pre>^world<br>blin|k</pre>',
'</div>',
].join('')), '8 select for lines 2, 3 with PRE');
test(() => assert_selection(
[
'<div contenteditable>',
'^<ul><li>hello</li><li>world</li></ul>|',
'</div>',
].join(''),
'formatBlock BLOCKQUOTE',
[
'<div contenteditable>',
'<blockquote>',
'<ul><li>^hello</li></ul><ul><li>world|</li></ul>',
'</blockquote>',
'</div>',
].join('')), '9 select all children with BLOCKQUOTE');
</script>