acb4124ee996b7aab1cd1731b2082af28d1f9759
[WebKit-https.git] / LayoutTests / fast / events / drag-and-drop-set-drag-data-arguments.html
1 <!DOCTYPE html>
2 <script src="../../fast/js/resources/js-test-pre.js"></script>
3 <div draggable="true" id="dragger">Drag me</div>
4 <script>
5
6 description('Tests correct behavior of event.dataTransfer.setData with wrong number of arguments');
7
8 var event;
9 var notEnoughArgumentsError = '"TypeError: Not enough arguments"';
10
11 var dragger = document.getElementById('dragger');
12 dragger.addEventListener('dragstart', function(e) {
13     event = e;
14     shouldThrow('event.dataTransfer.setData()', notEnoughArgumentsError);
15     shouldThrow('event.dataTransfer.setData("Text")', notEnoughArgumentsError);
16 }, false);
17
18 if (window.eventSender) {
19     var rect = dragger.getBoundingClientRect();
20     var x = rect.left + rect.width / 2;
21     var y = rect.top + rect.height / 2;
22     eventSender.mouseMoveTo(x, y);
23     eventSender.mouseDown();
24     eventSender.leapForward(400);
25     eventSender.mouseMoveTo(x + 100, y);
26     eventSender.mouseUp();
27 }
28
29 </script>
30 <script src="../../fast/js/resources/js-test-post.js"></script>