5 var console
= document
.getElementById('console');
6 var line
= document
.createElement('div');
7 line
.textContent
= msg
;
8 console
.appendChild(line
);
11 function editingTest() {
12 if (!window
.testRunner
)
15 testRunner
.dumpAsText();
16 testRunner
.waitUntilDone();
18 // Drag a URL text in the source
19 var source
= document
.getElementById("source");
20 source
.setSelectionRange(0, source
.value
.length
);
21 x
= source
.offsetLeft
+ 10;
22 y
= source
.offsetTop
+ source
.offsetHeight
/ 2;
23 eventSender
.mouseMoveTo(x
, y
);
24 eventSender
.mouseDown();
25 // and drop it off to the destination field.
26 var destination
= document
.getElementById("destination");
27 eventSender
.leapForward(500);
28 eventSender
.mouseMoveTo(destination
.offsetLeft
+ 10, destination
.offsetTop
+ destination
.offsetHeight
/ 2);
29 eventSender
.mouseUp();
31 var result
= destination
.value
;
32 debug(result
== 'http://www.apple.com/' ? 'PASS' : 'FAIL: expected value="http://www.apple.com/", actual value="' + result
+ '"');
34 testRunner
.notifyDone();
37 <p>This tests text selection drag for a URL-like text.
</p>
38 To test this by hand, select all of the text in this input:
<input id=source
value=
"http://www.apple.com/"><br>
39 and drag/drop it into this input:
<input id=destination
>
40 <br><br>If you see that the text
"http://www.apple.com/" was put in the second box, then the test passed.
41 <div id=console
></div>
42 <script>editingTest();</script>