| OLD | NEW |
| 1 <html> | 1 <!doctype html> |
| 2 <head> | 2 <script src="../../resources/testharness.js"></script> |
| 3 | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style> | 4 <script src="../assert_selection.js"></script> |
| 5 .editing { | |
| 6 border: 2px solid red; | |
| 7 padding: 12px; | |
| 8 font-size: 24px; | |
| 9 } | |
| 10 .explanation { | |
| 11 border: 2px solid blue; | |
| 12 padding: 12px; | |
| 13 font-size: 24px; | |
| 14 margin-bottom: 24px; | |
| 15 } | |
| 16 </style> | |
| 17 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
| 18 | |
| 19 <script> | 5 <script> |
| 20 | 6 test(() => { |
| 21 function editingTest() { | 7 assert_selection( |
| 22 for (i = 0; i < 4; i++) | 8 '<div contenteditable>foo ^bar |baz</div>', |
| 23 moveSelectionForwardByCharacterCommand(); | 9 selection => { |
| 24 for (i = 0; i < 5; i++) | 10 selection.document.execCommand('delete'); |
| 25 extendSelectionForwardByCharacterCommand(); | 11 selection.document.execCommand('undo'); |
| 26 for (i = 0; i < 5; i++) | 12 }, |
| 27 deleteCommand(); | 13 '<div contenteditable>foo ^bar |baz</div>'); |
| 28 undoCommand(); | 14 }, '"delete" then "undo" changes nothing'); |
| 29 moveSelectionForwardByCharacterCommand(); | |
| 30 } | |
| 31 | |
| 32 </script> | 15 </script> |
| 33 | |
| 34 <title>Editing Test</title> | |
| 35 </head> | |
| 36 <body> | |
| 37 <div class="explanation"> | |
| 38 Should see "foo bar baz" in the red box. Insertion point should be between the "
b" and "a" of "baz". | |
| 39 </div> | |
| 40 | |
| 41 <div id="root" contenteditable="true" style="word-wrap: break-word; -webkit-nbsp
-mode: space; -webkit-line-break: after-white-space;"> | |
| 42 <div id="test" class="editing">foo bar baz</div></div> | |
| 43 | |
| 44 <script> | |
| 45 runEditingTest(); | |
| 46 </script> | |
| 47 | |
| 48 </body> | |
| 49 </html> | |
| OLD | NEW |