| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!doctype html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <body> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <p id="description">This tests for a bug where deleting a paragraph in preserveN
ewline text would introduce an extra line. You should see '\nbar' below.</p> | 4 <script src="../assert_selection.js"></script> |
| 5 <div id="test" contenteditable="true"><pre>foo | 5 <script> |
| 6 bar</pre></div> | 6 test(() => { |
| 7 assert_not_equals(window.internals, undefined, |
| 8 'This test requires window.internals'); |
| 9 ['mac', 'win', 'unix', 'android'].forEach(platform => { |
| 10 internals.settings.setEditingBehavior(platform); |
| 11 assert_selection( |
| 12 '<div contenteditable><pre>^foo|\n</pre></div>', |
| 13 'delete', |
| 14 '<div contenteditable><pre>|\n</pre></div>', |
| 15 `${platform}: Delete a paragraph in preserving newline`); |
| 7 | 16 |
| 8 <script src="../../resources/dump-as-markup.js"></script> | 17 assert_selection( |
| 9 <script> | 18 '<div contenteditable><pre>^foo|\n</pre></div>', |
| 10 function runTestsOn(platform) { | 19 selection => { |
| 11 var sel = window.getSelection(); | 20 selection.document.execCommand('delete'); |
| 12 var e = document.getElementById("test"); | 21 selection.document.execCommand('undo'); |
| 13 | 22 }, |
| 14 if (window.internals) | 23 '<div contenteditable><pre>^foo|\n</pre></div>', |
| 15 internals.settings.setEditingBehavior(platform); | 24 '${platform}: Undo after delete a paragraph in preserving newlin
e'); |
| 16 | 25 }); |
| 17 sel.collapse(e, 0); | 26 }); |
| 18 sel.modify("extend", "forward", "character"); | |
| 19 sel.modify("extend", "forward", "character"); | |
| 20 sel.modify("extend", "forward", "character"); | |
| 21 document.execCommand("Delete"); | |
| 22 Markup.dump("test", "on " + platform); | |
| 23 document.execCommand("undo"); | |
| 24 Markup.dump("test", "after undo on " + platform); | |
| 25 } | |
| 26 | |
| 27 if (window.testRunner) | |
| 28 testRunner.dumpEditingCallbacks(); | |
| 29 Markup.description(description.textContent); | |
| 30 Markup.dump("test", "initial state"); | |
| 31 runTestsOn("mac"); | |
| 32 runTestsOn("win"); | |
| 33 runTestsOn("unix"); | |
| 34 runTestsOn("android"); | |
| 35 </script> | 27 </script> |
| 36 </body> | |
| 37 </html> | |
| OLD | NEW |