1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
3 <script src=
"../../resources/js-test.js"></script>
5 #dropTarget, #dragMe { text-align: center; display: table-cell; vertical-align: middle }
6 #dropTarget {width:
256px; height:
256px; border:
1px dashed}
7 #dragMe {-webkit-user-drag: element; -webkit-user-select: none; background: #ff0000; width:
64px; height:
64px; color: white}
16 window
.onload = function()
18 dragMe
= document
.getElementById("dragMe");
19 dropTarget
= document
.getElementById("dropTarget");
20 dropEffectElem
= document
.getElementById("dropEffect");
21 consoleElm
= document
.getElementById("console");
23 if (!dragMe
|| !dropTarget
|| !dropEffectElem
|| !consoleElm
)
26 dropEffectElem
.onclick
= changeDropZone
;
28 dropTarget
.ondrop
= drop
;
29 dragMe
.ondragend = function()
31 debug("Received dragend event");
37 function changeDropZone()
39 dropTarget
.setAttribute("webkitdropzone", " StRinG:text/plain sTrING:url " + dropEffectElem
.options
[dropEffectElem
.selectedIndex
].value
);
42 function printDropEvent(e
)
44 chosenDropEffect
= dropEffectElem
.options
[dropEffectElem
.selectedIndex
].value
;
45 debug("Received drop event when chosenDropEffect is " + chosenDropEffect
);
50 if (!window
.eventSender
)
53 if (window
.testRunner
)
54 testRunner
.dumpAsText();
56 var startX
= dragMe
.offsetLeft
+ 10;
57 var startY
= dragMe
.offsetTop
+ dragMe
.offsetHeight
/ 2;
58 var endX
= dropTarget
.offsetLeft
+ 10;
59 var endY
= dropTarget
.offsetTop
+ dropTarget
.offsetHeight
/ 2
61 var numEffects
= dropEffectElem
.options
.length
;
63 for (var j
= 0; j
< numEffects
; ++j
) {
64 dropEffectElem
.options
[j
].selected
= true;
67 eventSender
.mouseMoveTo(startX
, startY
);
68 eventSender
.mouseDown();
69 eventSender
.leapForward(100);
70 eventSender
.mouseMoveTo(endX
, endY
);
71 eventSender
.mouseUp();
74 var testContainer
= document
.getElementById("test-container");
76 document
.body
.removeChild(testContainer
);
77 debug('<br /><span class="pass">TEST COMPLETE</span>');
80 <script src=
"resources/dropzone.js"></script>
83 <p id=
"description"></p>
84 <div id=
"test-container">
85 <div id=
"dropTarget">Drop the image onto me.
<br/><br/>
86 <label for=
"dropEffect">Expects dropEffect
</label> <select id=
"dropEffect">
87 <option value=
"copy">Copy
</option>
88 <option value=
"move">Move
</option>
89 <option value=
"link">Link
</option>
90 <option value=
"dummy">Nonexistent (Dummy) Effect should be converted to copy
</option>
94 <p>Items that can be dragged to the drop target:
</p>
95 <img id=
"dragMe" src=
"resources/greenbox.png">
98 <div id=
"console"></div>
100 description("This test checks that dragging an image on to a drop zone doesn't match string:url.<br/>");