OLD | NEW |
1 <html> | 1 <!doctype html> |
2 <head> | 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 [ |
| 8 '<div contenteditable>', |
| 9 '|<img src="../resources/abe.png">', |
| 10 '<img src="../resources/abe.png">', |
| 11 ' <img src="../resources/abe.png">', |
| 12 '</div>', |
| 13 ].join(''), |
| 14 selection => { |
| 15 selection.document.execCommand('insertText', false, 'a'); |
| 16 selection.modify('move', 'forward', 'character'); |
| 17 selection.document.execCommand('insertText', false, 'bcd'); |
| 18 selection.modify('move', 'forward', 'character'); |
| 19 selection.document.execCommand('insertText', false, 'efg'); |
| 20 selection.modify('move', 'forward', 'character'); |
| 21 selection.document.execCommand('insertText', false, 'hij'); |
| 22 selection.modify('move', 'forward', 'character'); |
| 23 selection.document.execCommand('insertText', false, 'klm'); |
3 | 24 |
4 <style> | 25 }, |
5 .editing { | 26 [ |
6 border: 2px solid red; | 27 '<div contenteditable>', |
7 padding: 12px; | 28 'a<img src="../resources/abe.png">', |
8 font-size: 24px; | 29 'bcd<img src="../resources/abe.png">', |
9 } | 30 'efg\u{00A0}hij<img src="../resources/abe.png">', |
10 </style> | 31 'klm|', |
11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | 32 '</div>', |
12 | 33 ].join('')), |
13 <script> | 34 'insertText around image'); |
14 | |
15 function moveNSpacesAndType(n) { | |
16 for (i = 0; i < n; i++) { | |
17 moveSelectionForwardByCharacterCommand(); | |
18 } | |
19 for (i = 0; i < 3; i++) { | |
20 typeCharacterCommand(); | |
21 } | |
22 } | |
23 | |
24 function editingTest() { | |
25 typeCharacterCommand(); | |
26 moveNSpacesAndType(1); | |
27 moveNSpacesAndType(1); | |
28 moveNSpacesAndType(1); | |
29 moveNSpacesAndType(1); | |
30 } | |
31 | |
32 </script> | 35 </script> |
33 | |
34 <title>Editing Test</title> | |
35 </head> | |
36 <body> | |
37 <div contenteditable id="root" class="editing"> | |
38 <span id="test"><img src="../resources/abe.png"><img src="../resources/abe.png">
<img src="../resources/abe.png"></span> | |
39 </div> | |
40 | |
41 <script> | |
42 runEditingTest(); | |
43 </script> | |
44 | |
45 </body> | |
46 </html> | |
OLD | NEW |