| <!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>f|oo</div>', |
| 'insertHTML <div>bar</div>baz', |
| '<div contenteditable>fbar<br>baz|oo</div>', |
| 'insert DIV into text.'); |
| |
| assert_selection( |
| '<div contenteditable><span>f|oo</spane>bar</div>', |
| 'insertHTML <div>ABC</div>DEF', |
| [ |
| '<div contenteditable>', |
| '<span>f</span>ABC<span><br></span>DEF|<span>oobar</span>', |
| '</div>', |
| ].join(''), |
| 'insert DIV into SPAN'); |
| |
| assert_selection( |
| '<div contenteditable>one t|hree</div>', |
| 'insertHTML <br class="Apple-interchange-newline"><div>two</div>', |
| [ |
| '<div contenteditable>', |
| 'one t<div>two|hree</div>', |
| '</div>', |
| ].join(''), |
| 'insert DIV with interchange newline'); |
| |
| assert_selection( |
| '<div contenteditable>x|y</div>', |
| 'insertHTML <div>foo</div><div>bar</div>baz', |
| [ |
| '<div contenteditable>', |
| 'xfoo<div>bar</div>baz|y', |
| '</div>', |
| ].join(''), |
| 'insert multiple DIVs into text'); |
| |
| assert_selection( |
| '<div contenteditable><div>x^</div><div>y it.|</div></div>', |
| 'insertHTML <div><div>AB</div></div>', |
| [ |
| '<div contenteditable>', |
| '<div>xAB|</div>', |
| '</div>', |
| ].join(''), |
| 'Replace with DIV'); |
| }); |
| </script> |