Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / mouseenter-mouseleave-on-drag.html
blob1a5207ff835cfd6c7f3e35ea623aaaf461af1714
1 <!DOCTYPE HTML>
2 <script src="../../resources/js-test.js"></script>
3 <style>
4 #outer {
5 background: grey;
6 position: absolute;
7 left: 100px;
8 top: 100px;
9 width: 100px;
10 height: 100px;
12 #inner {
13 background: red;
14 position: absolute;
15 left: 30px;
16 top: 30px;
17 width: 40px;
18 height: 40px;
20 </style>
22 <div id="outer">
23 <div id="inner"></div>
24 </div>
26 <div id="console"></div>
28 <script>
29 description("Verifies that dragging mouse in/out of an element doesn't fire redundant mouseenter or mouseleave events (crbug.com/470258)");
31 var wasInside = {};
33 function init() {
34 ["outer", "inner"].forEach(function(id) {
35 wasInside[id] = false;
37 var targetDiv = document.getElementById(id);
39 targetDiv.addEventListener("mouseenter", function(event) {
40 debug(id + " received mouseenter");
41 shouldBeFalse("wasInside['" + id + "']");
42 wasInside[id] = true;
43 });
45 targetDiv.addEventListener("mouseleave", function(event) {
46 debug(id + " received mouseleave");
47 shouldBeTrue("wasInside['" + id + "']");
48 wasInside[id] = false;
49 });
51 targetDiv.addEventListener("mousedown", function(event) {
52 debug(id + " received mousedown");
53 });
55 targetDiv.addEventListener("mouseup", function(event) {
56 debug(id + " received mouseup");
57 });
58 });
61 init();
62 if (window.eventSender) {
63 eventSender.mouseMoveTo(1, 150);
65 eventSender.mouseMoveTo(110, 150);
66 eventSender.mouseDown();
68 eventSender.mouseMoveTo(140, 150);
69 eventSender.mouseMoveTo(150, 150);
70 eventSender.mouseMoveTo(160, 150);
72 eventSender.mouseMoveTo(190, 150);
73 eventSender.mouseUp();
75 eventSender.mouseMoveTo(201, 150);
76 } else {
77 debug("This test requires eventSender");
79 </script>