13 <script src=
"../../resources/js-test.js"></script>
15 function verify(expectedColor
)
17 shouldBeEqualToString('window.getComputedStyle(document.getElementById("drag")).color', expectedColor
);
22 if (!window
.eventSender
)
25 verify('rgb(0, 0, 255)');
26 var draggedElement
= document
.getElementById('drag');
27 var x
= draggedElement
.offsetLeft
+ draggedElement
.offsetWidth
/ 2;
28 var y
= draggedElement
.offsetTop
+ draggedElement
.offsetHeight
/ 2;
29 eventSender
.mouseMoveTo(x
, y
);
30 eventSender
.mouseDown();
31 eventSender
.leapForward(200);
32 eventSender
.mouseMoveTo(x
, y
+ 200);
33 verify('rgb(255, 0, 0)');
34 eventSender
.mouseUp();
36 // Due to how mouse press / hover state is updated, the first mouse move is expected to generate incorrect hover state.
37 eventSender
.mouseMoveTo(x
, y
);
38 verify('rgb(255, 0, 0)');
40 eventSender
.mouseMoveTo(x
, y
+ 200);
41 eventSender
.mouseMoveTo(x
, y
);
42 verify('rgb(0, 128, 0)');
45 <body onload=
"runTest()">
46 <p>Test that mouse state is correctly reset after a drag. To run this test, use a mouse to drag the link
"Drag me" around. It should change from blue to red while being dragged, and red to green once the drag ends by releasing the mouse button.
</p>
47 <div draggable=
"true" id=
"drag" href=
"#">Drag me
</div>
48 <div id=
"console"></div>