summaryrefslogtreecommitdiffstats
path: root/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-23 11:54:06 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-23 11:54:06 +0200
commitd9d3b687b7c892b400e781dd5c57897efd7173aa (patch)
tree835dacc8cb3df7b05d4b62f4c551d8ad9f791371 /dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
parent1ea8529cfb0a246d09daf1ec742d063c08cf1899 (diff)
downloadUXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.gz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.lz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.xz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.zip
moebius#195: DOM - PointerEvent - improvements
https://github.com/MoonchildProductions/moebius/pull/195
Diffstat (limited to 'dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html')
-rw-r--r--dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html b/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
new file mode 100644
index 000000000..53d390996
--- /dev/null
+++ b/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for triggering Fullscreen by pointer events</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ let win = window.open("data:text/html,<body><div id='target' style='width: 50px; height: 50px; background: green'></div></body>", "_blank");
+ win.addEventListener("load", () => {
+ let target = win.document.getElementById("target");
+ target.addEventListener("pointerdown", () => {
+ target.requestFullscreen();
+ target.addEventListener("pointerdown", () => {
+ win.document.exitFullscreen();
+ }, {once: true});
+ }, {once: true});
+
+ win.document.addEventListener("fullscreenchange", () => {
+ if (win.document.fullscreenElement) {
+ ok(win.document.fullscreenElement, target, "fullscreenElement should be the div element");
+ // synthesize mouse events to generate pointer events and leave full screen.
+ synthesizeMouseAtCenter(target, { type: "mousedown" }, win);
+ synthesizeMouseAtCenter(target, { type: "mouseup" }, win);
+ } else {
+ win.close();
+ SimpleTest.finish();
+ }
+ });
+ // Make sure our window is focused before starting the test
+ SimpleTest.waitForFocus(() => {
+ // synthesize mouse events to generate pointer events and enter full screen.
+ synthesizeMouseAtCenter(target, { type: "mousedown" }, win);
+ synthesizeMouseAtCenter(target, { type: "mouseup" }, win);
+ }, win);
+ });
+}
+
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPrefEnv({
+ "set": [
+ ["full-screen-api.unprefix.enabled", true],
+ ["full-screen-api.allow-trusted-requests-only", false],
+ ["dom.w3c_pointer_events.enabled", true]
+ ]
+ }, startTest);
+});
+</script>
+</body>
+</html>