| <!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>', |
| '<p id="test"><b>foo|</b><br>bar</p>', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('insertParagraph'); |
| selection.document.execCommand('insertText', false, 'x'); |
| }, |
| [ |
| '<div contenteditable>', |
| '<p id="test"><b>foo</b></p>', |
| '<p id="test"><b>x|<br></b>bar</p>', |
| '</div>', |
| ].join('')), |
| 'Insert "x" before BR, since insertParagraph puts caret before BR'); |
| </script> |