4 var textarea
= document
.getElementById("textarea");
5 var tx
= textarea
.offsetLeft
+ textarea
.offsetWidth
/ 2;
6 var ty
= textarea
.offsetTop
+ 4;
8 var input
= document
.getElementById("input");
9 var ix
= input
.offsetLeft
+ input
.offsetWidth
/ 2;
10 var iy
= input
.offsetTop
+ input
.offsetHeight
/ 2;
14 if (!window
.testRunner
)
16 if (!window
.eventSender
)
19 testRunner
.dumpAsText();
20 testRunner
.waitUntilDone();
22 eventSender
.mouseMoveTo(tx
, ty
);
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(ix
, iy
);
27 eventSender
.mouseUp();
29 if (input
.value
== "drag this text into the text field above" && textarea
.value
== "")
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 a textarea element to an input element.
</p>
42 <p>When the test is run, the follow textarea should be empty:
</p>
43 <p><textarea id=
"textarea" cols=
"50" rows=
"10">drag this text into the text field above
</textarea></p>
44 <p>And the following input should have text in it:
</p>
45 <p><input id=
"input" type=
"text" size=
"50"></p>
46 <p id=
"result">If the test has completed this sentence should be replaced by a success message.
</p>