Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/no-hover-when-mouse-drag.html

Issue 2965603002: Update hover states when dragging the mouse into an element (Closed)
Patch Set: hover drag Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../../resources/testharness.js'></script>
3 <script src='../../resources/testharnessreport.js'></script>
4 <style type="text/css">
5 .box:hover {background-color: rgb(0, 255, 255);}
6 .box:active {background-color: rgb(0, 0, 255);}
7 .box:active:hover {background-color: rgb(255, 255, 0);}
8
9 .box{border:2px solid #aaa; width:100px; height:100px; background-color: rgb(0, 0, 0);}
10 </style>
11
12 <body>
13 <div class="box" draggable="true" id="upbox"></div>
14 <div class="box" id="downbox"></div>
15
16 <script type="text/javascript">
17 var upbox = document.getElementById("upbox");
18 var downbox = document.getElementById("downbox");
19 var targetRect = upbox.getBoundingClientRect();
20 var offset = 20;
21 var x1 = targetRect.left + offset;
22 var y1 = targetRect.top + offset;
23 targetRect = downbox.getBoundingClientRect();
24 var x2 = targetRect.left + offset;
25 var y2 = targetRect.top + offset;
26
27
28 function mouseDownHandler(event) {
29 testHover.step(function () {
30 assert_equals(event.target.id, "upbox");
31 assert_equals(getComputedStyle(event.target).backgroundColor, "rgb(255, 255, 0)");
32 });
33 }
34
35 function mouseDragHandler(event) {
36 testHover.step(function () {
37 assert_equals(getComputedStyle(downbox).backgroundColor, "rgb(0, 0, 0)") ;
Navid Zolghadr 2017/07/07 18:21:00 nit: I assume we expect this to also be true. Righ
lanwei 2017/07/12 21:03:10 Done.
38 });
39 }
40
41 function mouseDragEndHandler(event) {
42 testHover.step(function () {
43 assert_equals(getComputedStyle(downbox).backgroundColor, "rgb(0, 255, 25 5)");
44 assert_equals(getComputedStyle(upbox).backgroundColor, "rgb(0, 0, 0)");
45 });
46 testHover.done();
47 }
48
49 function testHoverMouseDrag() {
50 if (window.eventSender) {
51 eventSender.mouseMoveTo(x1, y1);
52 eventSender.mouseDown();
53 eventSender.leapForward(100);
54 eventSender.mouseMoveTo(x1, y1+10);
55 eventSender.mouseMoveTo(x1, y1+20);
56 eventSender.mouseMoveTo(x2, y2);
57 eventSender.mouseUp();
58 }
59 }
60
61 var testHover = async_test('Tests that we do not update the hover states of any element when we are dragging an element around.');
62 upbox.addEventListener('drag', mouseDragHandler);
63 upbox.addEventListener('dragend', mouseDragEndHandler);
64 upbox.addEventListener('mousedown', mouseDownHandler);
65 testHoverMouseDrag();
66
67 </script>
68 </body>
69
70
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698