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> | |
5 .editing { | |
6 border: 2px solid red; | |
7 padding: 12px; | |
8 font-size: 24px; | |
9 } | |
10 </style> | |
11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
12 | |
13 <script> | |
14 | |
15 function editingTest() { | |
16 for (i = 0; i < 33; i++) { | |
17 extendSelectionForwardByCharacterCommand(); | |
18 } | |
19 for (i = 0; i < 30; i++) { | |
20 extendSelectionBackwardByCharacterCommand(); | |
21 } | |
22 } | |
23 | |
24 </script> | |
25 | |
26 <title>Editing Test</title> | |
27 </head> | |
28 <body> | 4 <body> |
29 <div contenteditable id="root" class="editing"> | 5 <div contenteditable id="root" class="editing"> |
30 <span id="test">a<img src="../resources/abe.png">new | 6 <span id="span">a<img src="../resources/abe.png">new |
31 <br>nation <i> </i> <img src="../resources/abe.png"> conceived | 7 <br>nation <i> </i> <img src="../resources/abe.png"> conceived |
32 <br>nation<img src="../resources/abe.png"></span> | 8 <br>nation<img src="../resources/abe.png"></span> |
33 </div> | 9 </div> |
34 | 10 <div id="log"></div> |
35 <script> | 11 <script> |
36 runEditingTest(); | 12 test(function () { |
| 13 var selection = getSelection(); |
| 14 selection.collapse(span.firstChild, 0); |
| 15 for (i = 0; i < 33; i++) { |
| 16 selection.modify("extend", "forward", "character"); |
| 17 } |
| 18 for (i = 0; i < 30; i++) { |
| 19 selection.modify("extend", "backward", "character"); |
| 20 } |
| 21 assert_equals(selection.anchorNode, span.firstChild); |
| 22 assert_equals(selection.anchorOffset, 0); |
| 23 assert_equals(selection.focusNode, span.childNodes[2]); |
| 24 assert_equals(selection.focusOffset, 1); |
| 25 }); |
37 </script> | 26 </script> |
38 | |
39 </body> | 27 </body> |
40 </html> | |
OLD | NEW |