OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Element#requestFullscreen() vs. Document#exitFullscreen()</title> | 2 <title>Element#requestFullscreen() vs. Document#exitFullscreen()</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="../trusted-click.js"></script> | 5 <script src="../trusted-click.js"></script> |
6 <div id="log"></div> | 6 <div id="log"></div> |
7 <div id="target"></div> | 7 <div id="target"></div> |
8 <script> | 8 <script> |
9 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 | 9 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 |
10 // TODO(foolip): Remove this test when the above is imported and passing. | 10 // TODO(foolip): Remove this test when the above is imported and passing. |
11 async_test(t => { | 11 async_test(t => { |
12 const target = document.getElementById("target"); | 12 const target = document.getElementById("target"); |
13 | 13 |
14 trusted_click(t.step_func(() => { | 14 trusted_click(t.step_func(() => { |
15 // Request fullscreen and exit at the same time. The exitFullscreen call | 15 // Request fullscreen and exit at the same time. The exitFullscreen call |
16 // should have no effect as the fullscreen element is null. | 16 // should have no effect as the fullscreen element is null. |
17 document.onfullscreenchange = t.step_func_done(); | 17 document.onfullscreenchange = t.step_func_done(); |
18 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); | 18 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); |
19 | 19 |
20 target.requestFullscreen(); | 20 target.requestFullscreen(); |
21 assert_equals(document.fullscreenElement, target, "fullscreenElement after r
equestFullscreen()"); | 21 assert_equals(document.fullscreenElement, null, "fullscreenElement after req
uestFullscreen()"); |
22 document.exitFullscreen(); | 22 document.exitFullscreen(); |
23 assert_equals(document.fullscreenElement, null, "fullscreenElement after exi
tFullscreen()"); | 23 assert_equals(document.fullscreenElement, null, "fullscreenElement after exi
tFullscreen()"); |
24 }), document.body); | 24 }), document.body); |
25 }); | 25 }); |
26 </script> | 26 </script> |
OLD | NEW |