element-request-fullscreen-two-elements.html (1243B)
1 <!DOCTYPE html> 2 <title>Element#requestFullscreen() on two elements in the same document</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="../trusted-click.js"></script> 8 <body> 9 <div id="a"></div> 10 <div id="b"></div> 11 </body> 12 <script> 13 promise_test(async (t) => { 14 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); 15 16 // Request fullscreen on both elements, but in reverse tree order. 17 const a = document.getElementById("a"); 18 const b = document.getElementById("b"); 19 20 // Expect two fullscreenchange events, with document.fullscreenElement 21 // changing in the same order as the requests. 22 await trusted_click(b); 23 await Promise.all([b.requestFullscreen(), fullScreenChange()]); 24 assert_equals(document.fullscreenElement, b); 25 26 await trusted_click(b); 27 await Promise.all([a.requestFullscreen(), fullScreenChange()]); 28 assert_equals(document.fullscreenElement, a); 29 }, "Element#requestFullscreen() on two elements in the same document"); 30 </script>