2 <script src=../editing.js
></script>
5 function editingTest() {
6 // Select "beta" and "gamma".
7 moveSelectionForwardByLineCommand();
8 for (i
= 0; i
< 2; i
++)
9 extendSelectionForwardByLineCommand();
12 // Paste with the cursor right before "delta".
13 moveSelectionForwardByLineCommand();
16 // Verify that the cursor is in the right place (still before delta).
17 var selection
= window
.getSelection();
18 if (selection
.baseNode
.parentNode
!= document
.getElementById("delta") ||
19 selection
.baseOffset
!= 0 || !selection
.isCollapsed
)
20 throw "Wrong selection position on before paste.";
22 // Paste with the cursor at the end of "delta".
23 moveSelectionForwardByWordCommand();
26 // Verify that the cursor is in the right place (new list item after delta).
27 var selection
= window
.getSelection();
28 if (!selection
.isCollapsed
|| selection
.baseNode
.value
!= "")
29 throw "Wrong selection position on after paste.";
34 <div contentEditable=
"true">
35 <p>Copy/pasting list items in a list. This test should be run with DRT for pasteboard access.
</p>
36 <p id=
"results">FAIL
</p>
41 <li id=
"delta">delta
</li>
46 if (window
.testRunner
)
47 testRunner
.dumpAsText();
49 var elem
= document
.getElementById("test");
50 var selection
= window
.getSelection();
51 selection
.collapse(elem
, 0);
54 // Rerun the test but have the source list be indented.
55 document
.getElementById("test").innerHTML
= "<li>alpha</li><ul><li>beta</li><li>gamma</li></ul><li id='delta'>delta</li>";
56 selection
.collapse(elem
, 0);
59 document
.getElementById("results").innerText
= "PASS: " + document
.getElementById("test").innerHTML
;