| <!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>one</p>', |
| '<p><br></p>', |
| '<p><b>two|</b></p>', |
| '<p><br></p>', |
| '<p>three</p>', |
| '</div>', |
| ].join(''), |
| 'insertParagraph', |
| [ |
| '<div contenteditable>', |
| '<p>one</p>', |
| '<p><br></p>', |
| '<p><b>two</b></p>', |
| '<p><b>|<br></b></p>', |
| '<p><br></p>', |
| '<p>three</p>', |
| '</div>', |
| ].join('')), |
| 'insert BR in B'); |
| |
| test(() => assert_selection( |
| [ |
| '<div contenteditable>', |
| '<p>^one|</p>', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('bold'); |
| selection.modify('move', 'forward', 'character'); |
| selection.document.execCommand('insertParagraph'); |
| // Set typing style to non-bold |
| selection.document.execCommand('bold'); |
| selection.document.execCommand('insertText', false, 'abc'); |
| selection.document.execCommand('insertParagraph'); |
| selection.document.execCommand('insertParagraph'); |
| }, |
| [ |
| '<div contenteditable>', |
| '<p><b>one</b></p>', |
| '<p>abc</p>', |
| '<p><br></p>', |
| '<p>|<br></p>', |
| '</div>', |
| ].join('')), |
| 'insert BR twice'); |
| </script> |