2 <script src=
"../../resources/js-test.js"></script>
4 <textarea id=textarea rows=
1>Hello World
</textarea>
6 description("This tests that text is copied (rather than moved) when the copy key is down.");
8 if (window
.testRunner
) {
9 // Drag a word in the textarea
10 var textarea
= document
.getElementById("textarea");
11 textarea
.setSelectionRange(0, 5);
12 x
= textarea
.offsetLeft
+ 10;
13 y
= textarea
.offsetTop
+ textarea
.offsetHeight
/ 2;
14 eventSender
.mouseMoveTo(x
, y
);
15 eventSender
.mouseDown();
16 // and drop it off to the right
17 eventSender
.leapForward(500);
18 eventSender
.mouseMoveTo(textarea
.offsetLeft
+
19 textarea
.offsetWidth
- 10, y
);
21 // Simulate pressing the copy key. This will
22 // transform the drag into a copy, rather
24 eventSender
.mouseUp(0, ["copyKey"]);
26 shouldBeEqualToString("textarea.value", "Hello WorldHello");