blob: 72145c487fe4fd43419d51d86b11c7a209a6276f [file] [log] [blame]
<!DOCTYPE html>
<title>Overflow menu hides when clicking on the page even when propagation is stopped.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<script src="media-file.js"></script>
<script src="overflow-menu.js"></script>
<!--Padding ensures the overflow menu is visible for the tests. -->
<body style="padding-top: 200px; padding-left: 100px">
<video controls></video>
<script>
async_test(function(t) {
// Set up video
var video = document.querySelector("video");
video.src = findMediaFile("video", "content/test");
video.setAttribute("width", "60");
// Add captions
var track = video.addTextTrack("captions");
// Listener blocking propogation.
window.addEventListener('click', e => e.stopPropagation(), true);
video.onloadeddata = t.step_func_done(function() {
var overflowList = getOverflowList(video);
var overflowMenu = getOverflowMenuButton(video);
// Clicking on the overflow menu button should make the overflow list visible
var coords = elementCoordinates(overflowMenu);
clickAtCoordinates(coords[0], coords[1]);
assert_not_equals(getComputedStyle(overflowList).display, "none");
// Click anywhere outside the overflow menu should close overflow list.
var coords = coordinatesOutsideElement(overflowList);
clickAtCoordinates(coords[0], coords[1]);
assert_equals(getComputedStyle(overflowList).display, "none");
});
});
</script>
</body>