blob: a75145b58e7f7a1a432dea804f0971521eb98f0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<!DOCTYPE html>
<style>
#test {
color: blue;
}
#test:hover {
color: green;
}
</style>
<script src="../../resources/js-test.js"></script>
<script>
function verify(expectedColor)
{
shouldBeEqualToString('window.getComputedStyle(document.getElementById("test")).color', expectedColor);
}
function runTest()
{
if (!window.eventSender)
return false;
document.onclick = function () { testFailed("Click should not have bubbled from embed!"); };
var pluginElement = document.getElementById('plugin');
var x = pluginElement.offsetLeft + pluginElement.offsetWidth / 2;
var y = pluginElement.offsetTop + pluginElement.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
var testElement = document.getElementById('test');
x = testElement.offsetLeft + testElement.offsetWidth / 2;
y = testElement.offsetTop + testElement.offsetHeight / 2;
// Due to how mouse press / hover state is updated, the first mouse move is expected to generate incorrect hover state.
eventSender.mouseMoveTo(x, y);
verify('rgb(0, 0, 255)');
eventSender.mouseMoveTo(x - 100, y);
eventSender.mouseMoveTo(x, y);
verify('rgb(0, 128, 0)');
}
</script>
<body onload="runTest()">
<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.
<embed id="plugin" type="application/x-shockwave-flash"></embed>
<p><a id="test" href="#">Hover me</a>
<div id="console"></div>
</body>
|