| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../assert_selection.js"></script> |
| 5 <script> |
| 6 test(() => assert_selection( |
| 7 '<div contenteditable><span>foo|</span></div>', |
| 8 'insertLineBreak', |
| 9 '<div contenteditable><span>foo<br>|<br></span></div>'), |
| 10 'Insert line break at end of text'); |
| 11 |
| 12 test(() => assert_selection( |
| 13 '<div contenteditable><span>foo|<br>bar</span></div>', |
| 14 'insertLineBreak', |
| 15 '<div contenteditable><span>foo<br>|<br>bar</span></div>'), |
| 16 'Insert line break before line break'); |
| 17 |
| 18 test(() => assert_selection( |
| 19 '<div contenteditable><span>foo|bar</span></div>', |
| 20 'insertLineBreak', |
| 21 '<div contenteditable><span>foo<br>|bar</span></div>'), |
| 22 'Insert line break between text'); |
| 23 |
| 24 test(() => assert_selection( |
| 25 '<div contenteditable><span>foo|</span></div>', |
| 26 selection => { |
| 27 selection.document.execCommand('insertLineBreak'); |
| 28 selection.document.execCommand('insertLineBreak'); |
| 29 }, |
| 30 '<div contenteditable><span>foo<br><br>|<br></span></div>'), |
| 31 'Insert two line breaks'); |
| 32 |
| 33 test(() => assert_selection( |
| 34 '<div contenteditable><span>foo|</span></div>', |
| 35 selection => { |
| 36 selection.document.execCommand('insertLineBreak'); |
| 37 selection.document.execCommand('insertLineBreak'); |
| 38 selection.document.execCommand('insertText', false, 'c'); |
| 39 }, |
| 40 '<div contenteditable><span>foo<br><br>c|</span></div>'), |
| 41 'Insert two line breaks and a character'); |
| 42 |
| 43 test(() => assert_selection( |
| 44 '<div contenteditable><span>|foo</span></div>', |
| 45 'insertLineBreak', |
| 46 '<div contenteditable><span><br>|foo</span></div>'), |
| 47 'Insert line break before text'); |
| 48 |
| 49 test(() => assert_selection( |
| 50 '<div contenteditable><span>foo| bar</span></div>', |
| 51 'insertLineBreak', |
| 52 '<div contenteditable><span>foo<br>|\u{00A0}bar</span></div>'), |
| 53 'Insert line break between words'); |
| 54 |
| 55 test(() => assert_selection( |
| 56 '<div contenteditable>|foo</div>', |
| 57 selection => { |
| 58 selection.document.execCommand('insertLineBreak'); |
| 59 selection.document.execCommand('insertText', false, ' '); |
| 60 }, |
| 61 '<div contenteditable><br>\u{00A0}|foo</div>'), |
| 62 'Insert space after BR becomeas NBSP'); |
| 63 |
| 64 test(() => assert_selection( |
| 65 '<div contenteditable style="white-space:pre">foo\n|\n</div>', |
| 66 'insertLineBreak', |
| 67 '<div contenteditable style="white-space:pre">foo\n\n|\n</div>'), |
| 68 'Insert a newline character for white-space:pre'); |
| 69 </script> |
| OLD | NEW |