OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 div { background: rgb(0, 0, 0); } | 3 div { background: rgb(0, 0, 0); } |
4 div:hover { background: rgb(255, 0, 0); } | 4 div:hover { background: rgb(255, 0, 0); } |
5 div:hover:active { background: rgb(255, 255, 0); } | 5 div:hover:active { background: rgb(255, 255, 0); } |
6 div:active { background: rgb(0, 255, 0); } | 6 div:active { background: rgb(0, 255, 0); } |
7 div { | 7 div { |
8 width: 100px; | 8 width: 100px; |
9 height: 100px; | 9 height: 100px; |
10 border: 2px solid rgb(0, 0, 255); | 10 border: 2px solid rgb(0, 0, 255); |
(...skipping 13 matching lines...) Expand all Loading... |
24 background = getComputedStyle(element, null).getPropertyValue("background-co
lor") | 24 background = getComputedStyle(element, null).getPropertyValue("background-co
lor") |
25 shouldBeEqualToString('background', bg) | 25 shouldBeEqualToString('background', bg) |
26 } | 26 } |
27 | 27 |
28 if (window.testRunner) { | 28 if (window.testRunner) { |
29 description("Dragging out of an element should cause it to lose :hover") | 29 description("Dragging out of an element should cause it to lose :hover") |
30 var box = document.getElementById('box') | 30 var box = document.getElementById('box') |
31 var box2 = document.getElementById('box2') | 31 var box2 = document.getElementById('box2') |
32 testRunner.dumpAsText(); | 32 testRunner.dumpAsText(); |
33 | 33 |
| 34 // Mouse events only work after an initial layout |
| 35 document.body.offsetLeft; |
| 36 |
34 eventSender.dragMode = false; | 37 eventSender.dragMode = false; |
35 // This mouse click seems to be required for WebKit's event handling to | 38 // This mouse click seems to be required for WebKit's event handling to |
36 // pick up the :hover class. See https://bugs.webkit.org/show_bug.cgi?id=742
64 | 39 // pick up the :hover class. See https://bugs.webkit.org/show_bug.cgi?id=742
64 |
37 eventSender.mouseDown() | 40 eventSender.mouseDown() |
38 eventSender.mouseUp() | 41 eventSender.mouseUp() |
39 | 42 |
40 // Move into the first box. | 43 // Move into the first box. |
41 eventSender.mouseMoveTo(50, 50) | 44 eventSender.mouseMoveTo(50, 50) |
42 shouldHaveBackground(box, 'rgb(255, 0, 0)') | 45 shouldHaveBackground(box, 'rgb(255, 0, 0)') |
43 shouldHaveBackground(box2, 'rgb(0, 0, 0)') | 46 shouldHaveBackground(box2, 'rgb(0, 0, 0)') |
(...skipping 10 matching lines...) Expand all Loading... |
54 // Mouse still down, move outside of both boxes. | 57 // Mouse still down, move outside of both boxes. |
55 eventSender.mouseMoveTo(400, 50) | 58 eventSender.mouseMoveTo(400, 50) |
56 shouldHaveBackground(box, 'rgb(0, 255, 0)') | 59 shouldHaveBackground(box, 'rgb(0, 255, 0)') |
57 shouldHaveBackground(box2, 'rgb(0, 0, 0)') | 60 shouldHaveBackground(box2, 'rgb(0, 0, 0)') |
58 | 61 |
59 eventSender.mouseUp() | 62 eventSender.mouseUp() |
60 shouldHaveBackground(box, 'rgb(0, 0, 0)') | 63 shouldHaveBackground(box, 'rgb(0, 0, 0)') |
61 shouldHaveBackground(box2, 'rgb(0, 0, 0)') | 64 shouldHaveBackground(box2, 'rgb(0, 0, 0)') |
62 } | 65 } |
63 </script> | 66 </script> |
OLD | NEW |