blob: d1acf2d9dadab4380b5cc0245b5f4f455f2937ca [file] [log] [blame]
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// For http://wkb.ug/19653 - Typing style lost when creating list from,
// indenting or outdenting an empty paragraph
test(() => assert_selection(
'<div contentEditable><div><b>|<br></b></div></div>',
selection => {
selection.document.execCommand('insertUnorderedList');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable><div><ul><li><b>Bold|</b></li></ul></div></div>'),
'1 creating a list from an empty paragraph with bold already applied to it');
test(() => assert_selection(
'<div contentEditable>|</div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('insertUnorderedList');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable><ul><li><b>Bold|</b></li></ul></div>'),
'2 creating a list from an empty paragraph');
test(() => assert_selection(
'<div contentEditable><div><b>|<br></b></div></div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('indent');
selection.document.execCommand('insertText', false, 'Bold');
},
[
'<div contenteditable>',
'<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
'<div>Bold|</div>',
'</blockquote>',
'</div>',
]), '3 indenting an empty paragraph with bold already applied to it');
test(() => assert_selection(
'<div contentEditable>|</div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('indent');
selection.document.execCommand('insertText', false, 'Bold');
},
[
'<div contenteditable>',
'<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
'<b>Bold|</b>',
'</blockquote>',
'</div>'
]), '4 indenting an empty paragraph');
test(() => assert_selection(
'<div contentEditable><blockquote><b>|<br></b></blockquote></div>',
selection => {
selection.document.execCommand('outdent');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable><b>Bold|</b></div>'),
'5 outdenting an empty paragraph with bold already applied to it');
test(() => assert_selection(
'<div contentEditable>|</div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('outdent');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable><b>Bold|</b></div>'),
'6 outdenting an empty paragraph');
test(() => assert_selection(
'<div contentEditable>x|x</div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('insertParagraph');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable>x<div><b>Bold|</b>x</div></div>'),
'7 splitting two paragraphs with insertParagraph');
test(() => assert_selection(
'<div contentEditable>x|x</div>',
selection => {
selection.document.execCommand('bold');
selection.document.execCommand('insertLineBreak');
selection.document.execCommand('insertText', false, 'Bold');
},
'<div contenteditable>x<b><br>Bold|</b>x</div>'),
'8 splitting two paragraphs with insertLineBreak');
</script>