Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / hover-after-clicking-embed.html
bloba75145b58e7f7a1a432dea804f0971521eb98f0f
1 <!DOCTYPE html>
2 <style>
3 #test {
4 color: blue;
6 #test:hover {
7 color: green;
9 </style>
10 <script src="../../resources/js-test.js"></script>
11 <script>
13 function verify(expectedColor)
15 shouldBeEqualToString('window.getComputedStyle(document.getElementById("test")).color', expectedColor);
18 function runTest()
20 if (!window.eventSender)
21 return false;
23 document.onclick = function () { testFailed("Click should not have bubbled from embed!"); };
24 var pluginElement = document.getElementById('plugin');
25 var x = pluginElement.offsetLeft + pluginElement.offsetWidth / 2;
26 var y = pluginElement.offsetTop + pluginElement.offsetHeight / 2;
27 eventSender.mouseMoveTo(x, y);
28 eventSender.mouseDown();
29 eventSender.mouseUp();
31 var testElement = document.getElementById('test');
32 x = testElement.offsetLeft + testElement.offsetWidth / 2;
33 y = testElement.offsetTop + testElement.offsetHeight / 2;
35 // Due to how mouse press / hover state is updated, the first mouse move is expected to generate incorrect hover state.
36 eventSender.mouseMoveTo(x, y);
37 verify('rgb(0, 0, 255)');
39 eventSender.mouseMoveTo(x - 100, y);
40 eventSender.mouseMoveTo(x, y);
41 verify('rgb(0, 128, 0)');
43 </script>
44 <body onload="runTest()">
45 <p>Test that mouse state is correctly reset after clicking on a node that captures mouse events. To run this test, first click on the embed element, then mouse over "Hover me". It should change from blue to green.
46 <embed id="plugin" type="application/x-shockwave-flash"></embed>
47 <p><a id="test" href="#">Hover me</a>
48 <div id="console"></div>
49 </body>