OLD | NEW |
1 <html> | 1 <html> |
2 <body onload="runTest()"> | 2 <body onload="runTest()"> |
3 <div contenteditable>drag<img src=abe.png id=dragme>me<span id=target> &nbs
p; </span></div> | 3 <div contenteditable>drag<img src=abe.png id=dragme>me<span id=target> &nbs
p; </span></div> |
4 <script> | 4 <script> |
5 function moveToCenter(element) { | 5 function moveToCenter(element) { |
6 var x, y; | 6 var x, y; |
7 x = element.offsetLeft + element.offsetWidth / 2; | 7 x = element.offsetLeft + element.offsetWidth / 2; |
8 y = element.offsetTop + element.offsetHeight / 2; | 8 y = element.offsetTop + element.offsetHeight / 2; |
9 eventSender.mouseMoveTo(x, y); | 9 eventSender.mouseMoveTo(x, y); |
10 } | 10 } |
11 | 11 |
12 function runTest() { | 12 function runTest() { |
13 e = document.getElementById("dragme"); | 13 e = document.getElementById("dragme"); |
14 moveToCenter(e); | 14 moveToCenter(e); |
15 eventSender.mouseDown(); | 15 eventSender.mouseDown(); |
16 | 16 |
17 e = document.getElementById("target"); | 17 e = document.getElementById("target"); |
18 moveToCenter(e); | 18 moveToCenter(e); |
19 eventSender.mouseUp(); | 19 eventSender.mouseUp(); |
20 | 20 |
21 if (document.getElementById("dragme").parentNode.tagName == "SPAN" && docume
nt.getElementById("dragme").src.length > 10) | 21 if (document.getElementById("dragme").parentNode.tagName == "SPAN" && docume
nt.getElementById("dragme").src.length > 10) |
22 alert("PASS"); | 22 console.log("PASS"); |
23 else | 23 else |
24 alert("FAIL"); | 24 console.log("FAIL"); |
25 | 25 |
26 testRunner.notifyDone(); | 26 testRunner.notifyDone(); |
27 } | 27 } |
28 </script> | 28 </script> |
29 </body> | 29 </body> |
30 </html> | 30 </html> |
OLD | NEW |