element-request-fullscreen-twice.html (1436B)
1 <!DOCTYPE html> 2 <title>Element#requestFullscreen() twice</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 <div id="log"></div> 9 <script> 10 promise_test(async (t) => { 11 const div = document.querySelector("div"); 12 await trusted_click(document.body); 13 const p = div.requestFullscreen(); 14 assert_equals( 15 document.fullscreenElement, 16 null, 17 "fullscreenElement after first requestFullscreen()" 18 ); 19 const rejectedPromises = [ 20 promise_rejects_js(t, TypeError, div.requestFullscreen()), 21 promise_rejects_js(t, TypeError, div.requestFullscreen()), 22 ]; 23 await Promise.all([p, fullScreenChange()]); 24 assert_equals( 25 document.fullscreenElement, 26 div, 27 "fullscreenElement after entering fullscreen" 28 ); 29 // Ensure that there's are not more changes fullscreenchange event. 30 document.onfullscreenchange = t.unreached_func( 31 "second fullscreenchange event" 32 ); 33 await Promise.all(rejectedPromises); 34 await new Promise((r) => requestAnimationFrame(r)); 35 }, "requestFullscreen() multiple times after going fullscreen"); 36 </script>