<!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>',
'foo<p style="font-style: italic;">|bar</p>',
'</div>',
].join(''),
'delete',
[
'<div contenteditable>',
'foo|<span style="font-style: italic;">bar</span>',
'</div>',
].join('')),
'1 deleting line break before P with style');
test(() =>assert_selection(
[
'<style>div p { color: red }</style>',
'<div contenteditable style="color: red;">',
'<h1>foo</h1><p><i>|bar</i></p>',
'</div>',
].join(''),
'delete',
[
'<style>div p { color: red }</style>',
'<div contenteditable style="color: red;">',
'<h1>foo|<i>bar</i></h1>',
'</div>',
].join('')),
'2-1 deleting line break before P+I+style');
test(() =>assert_selection(
[
'<div contenteditable>',
'<h1>foo</h1><p><i>|bar</i></p>',
'</div>',
].join(''),
'delete',
[
'<div contenteditable>',
'<h1>foo|<i>bar</i></h1>',
'</div>',
].join('')),
'2-2 deleting line break before P+I');
test(() =>assert_selection(
[
'<div contenteditable style="color: red;">',
'<h1>foo</h1><p><font color="red"><span style="color: green;">|bar</span></p>',
'</div>',
].join(''),
'delete',
[
'<div contenteditable style="color: red;">',
// Correct expectation would be retaining style for span element.
'<h1>foo|<span style="color: green;">bar</span></h1>',
'</div>',
].join('')),
'3 deleting line break before P+FONT+style');
</script>