blob: 91d13241b2748ad887e3c59d865e83574f7d0b3d [file] [log] [blame]
<!DOCTYPE html>
<html>
<script src="../../../../resources/js-test-pre.js"></script>
<style type="text/css">
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
div {
line-height: 100px;
}
#hoverme {
background-color: lightblue;
}
#clickme {
background-color: lightgreen;
display: none;
}
#dontclickme {
background-color: yellow;
}
#hoverme:hover #clickme {
display: block;
}
</style>
<body style="margin:0">
<div id='hoverme'>Hover over me
<div id='clickme'>Click me</div>
</div>
<div id='dontclickme'>Don't click me</div>
<p id="description"></p>
<p>See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.</p>
<div id="console"></div>
<script>
description("Tests that a gesture tap is dispatched before the hover state on the active element is cleared.");
var clickMe = document.getElementById('clickme');
var dontClickMe = document.getElementById('dontclickme');
var clickMeCount = 0;
var dontClickMeCount = 0;
function runTests()
{
if (!window.eventSender) {
debug('This test requires DRT.');
return;
}
if (!eventSender.gestureTapDown || !eventSender.gestureTap) {
debug('GestureTapDown or GestureTap is not supported by this platform');
return;
}
clickMe.addEventListener("click", function() { clickMeCount++; }, false);
dontClickMe.addEventListener("click", function() { dontClickMeCount++; }, false);
debug("The Click Me div should not be visible.");
shouldBe("clickMe.offsetTop", "0");
debug("The Click Me div should be visible after a GestureTapDown on the Hover Over Me div.");
shouldBe(document.elementFromPoint(50, 50).id, "hoverme");
eventSender.gestureTapDown(50, 50);
shouldBe("clickMe.offsetTop", "100");
debug("Tapping on the Click Me div should dispatch a click to the Click Me div and not to the Don't Click Me div and the Click Me div should still be visible.");
shouldBe(document.elementFromPoint(150, 150).id, "clickme");
eventSender.gestureTap(150, 150);
shouldBe("clickMeCount", "1");
shouldBe("dontClickMeCount", "0");
shouldBe("clickMe.offsetTop", "100");
}
runTests();
</script>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>