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 word in the textarea
19 var textarea
= document
.getElementById("textarea");
20 textarea
.setSelectionRange(0, 4);
21 x
= textarea
.offsetLeft
+ 10;
22 y
= textarea
.offsetTop
+ textarea
.offsetHeight
/ 2;
23 eventSender
.mouseMoveTo(x
, y
);
24 eventSender
.mouseDown();
25 // and drop it off to the input field
26 var input
= document
.getElementById("destination");
27 eventSender
.leapForward(500);
28 eventSender
.mouseMoveTo(input
.offsetLeft
+ 10, input
.offsetTop
+ input
.offsetHeight
/ 2);
29 eventSender
.mouseUp();
31 var result
= input
.value
;
32 debug(result
== 'What' ? 'PASS: to input' : 'FAIL: expected value="What", actual value="' + result
+ '"');
34 // Drag from the input to the textarea.
37 input
.setSelectionRange(0, 4);
38 eventSender
.mouseMoveTo(input
.offsetLeft
+ 10, input
.offsetTop
+ input
.offsetHeight
/ 2);
39 eventSender
.mouseDown();
40 eventSender
.leapForward(500);
41 eventSender
.mouseMoveTo(textarea
.offsetLeft
+ 10, textarea
.offsetTop
+ 10);
42 eventSender
.mouseUp();
43 var result
= textarea
.value
;
44 debug(result
== 'What' ? 'PASS: to textarea' : 'FAIL: expected value="What", actual value="' + result
+ '"');
46 testRunner
.notifyDone();
49 <p>This tests text selection drag from a textarea and drop to an input, and vice versa.
50 There was a bug of an assertion failure in a case of the selected text was
51 longer than the destination text.
</p>
52 <div id=console
></div>
53 <input id=destination
>
54 <textarea id=textarea rows=
1>What steps will reproduce the problem?
56 <script>editingTest();</script>