blob: dd4f1901e19a1629527e9a0304932821f7737d1c [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><a href="http://foo">bar</a></div>',
selection => {
assert_false(selection.document.execCommand('removeFormat'),
'RemoveFormat enabled with no selection');
},
'<div contenteditable><a href="http://foo">bar</a></div>'),
'RemoveFormat command with no selection');
test(() => assert_selection(
'<div contenteditable><b>|abc</b></div>',
selection => {
assert_false(selection.document.execCommand('removeFormat'),
'RemoveFormat enabled with no selection');
},
'<div contenteditable><b>|abc</b></div>'),
'RemoveFormat command with caret');
test(() => assert_selection(
[
'<div contenteditable>',
'<b>^abc</b>',
'<a href="#foo">def</a>',
'<i>ghi</i><br>',
'<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
'<u>jkl</u>',
'mno',
'<span style="text-decoration:line-through">baz|</span><br>',
'</div>',
].join(''),
'removeFormat',
[
'<div contenteditable>',
'^abc',
'<a href="#foo">def</a>',
'ghi<br>',
'<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
'jkl',
'mno',
'baz|<br>',
'</div>',
].join('')),
'RemoveFormat command with range selection');
</script>