element-request-fullscreen-same-element.html (1180B)
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 <div id="log"></div> 8 <script> 9 promise_test(async (t) => { 10 t.add_cleanup(() => { 11 if (document.fullscreenElement) return document.exitFullscreen(); 12 }); 13 14 // Use the body element as the fullscreen element, because the second 15 // test_driver.bless() call needs to insert a button inside of it, which 16 // can't be clicked if another element is already fullscreen. 17 const target = document.body; 18 19 // First enter fullscreen. 20 await test_driver.bless("fullscreen", () => target.requestFullscreen()); 21 assert_equals(document.fullscreenElement, target, "fullscreen element after first request"); 22 23 // Now request fullscreen again, which should be a no-op. 24 await test_driver.bless("fullscreen", () => target.requestFullscreen()); 25 assert_equals(document.fullscreenElement, target, "fullscreen element after second request"); 26 }); 27 </script>