element-request-fullscreen-same.html (1334B)
1 <!DOCTYPE html> 2 <title>Element#requestFullscreen() on the current fullscreen element</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 <div id="target"></div> 10 <script> 11 promise_test(async (t) => { 12 const target = document.getElementById("target"); 13 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); 14 15 await Promise.all([ 16 fullScreenChange(), 17 trusted_request(target), 18 ]); 19 20 assert_equals(document.fullscreenElement, target); 21 22 // The next requestFullscreen() should fire no events due to "If element is 23 // doc's fullscreen element, terminate these subsubsteps." 24 document.onfullscreenchange = t.unreached_func( 25 "fullscreenchange event" 26 ); 27 28 await trusted_click(target); 29 await target.requestFullscreen(); 30 assert_equals(document.fullscreenElement, target); 31 // Wait until after the next animation frame. 32 await new Promise((r) => requestAnimationFrame(r)); 33 }, "Element#requestFullscreen() on the current fullscreen element"); 34 </script>