4 var input
= document
.getElementById("input");
5 var x
= input
.offsetLeft
+ input
.offsetWidth
/ 2;
6 var y
= input
.offsetTop
+ input
.offsetHeight
/ 2;
8 var textarea
= document
.getElementById("textarea");
9 var tx
= textarea
.offsetLeft
+ textarea
.offsetWidth
/ 2;
10 var ty
= textarea
.offsetTop
+ textarea
.offsetHeight
/ 2;
14 if (!window
.testRunner
)
16 if (!window
.eventSender
)
19 testRunner
.dumpAsText();
20 testRunner
.waitUntilDone();
22 eventSender
.mouseMoveTo(x
, y
);
23 eventSender
.mouseDown();
24 // Leap the event time so that mouseMove will start a new drag instead of changing selection.
25 eventSender
.leapForward(400);
26 eventSender
.mouseMoveTo(tx
, ty
);
27 eventSender
.mouseUp();
29 if (input
.value
== "" && textarea
.value
== "drag this text into the text area below")
30 document
.getElementById("result").innerText
= "Test succeeded!";
32 document
.getElementById("result").innerText
= "Test failed! Input value was " + input
.value
+ " and text area value was " + textarea
.value
+ ".";
34 testRunner
.notifyDone();
39 <body onload=
"runTest()">
41 <p>This tests dragging text from an input element into a text area element.
</p>
42 <p>When the test is run, the follow text field should be empty:
</p>
43 <p><input id=
"input" type=
"text" value=
"drag this text into the text area below" size=
"50"></p>
44 <p>And the following text area should have text in it:
</p>
45 <p><textarea id=
"textarea" cols=
"50" rows=
"10"></textarea></p>
46 <p id=
"result">If the test has completed this sentence should be replaced by a success message.
</p>