OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Element#requestFullscreen() on two elements in the same document</title> | 2 <title>Element#requestFullscreen() on two elements in the same document</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="a"></div> | 7 <div id="a"></div> |
8 <div id="b"></div> | 8 <div id="b"></div> |
9 <script> | 9 <script> |
10 async_test(t => { | 10 async_test(t => { |
11 // Request fullscreen on both elements, but in reverse tree order. | 11 // Request fullscreen on both elements, but in reverse tree order. |
12 const a = document.getElementById('a'); | 12 const a = document.getElementById('a'); |
13 const b = document.getElementById('b'); | 13 const b = document.getElementById('b'); |
14 | 14 |
15 // Expect two fullscreenchange events, with document.fullscreenElement | 15 // Expect two fullscreenchange events, with document.fullscreenElement |
16 // changing in the same order as the requests. | 16 // changing in the same order as the requests. |
17 const order = []; | 17 const order = []; |
18 document.onfullscreenchange = t.step_func(() => { | 18 document.onfullscreenchange = t.step_func(() => { |
19 assert_in_array(document.fullscreenElement, [a, b]); | 19 assert_in_array(document.fullscreenElement, [a, b]); |
20 order.push(document.fullscreenElement.id); | 20 order.push(document.fullscreenElement.id); |
21 if (order.length == 2) { | 21 if (order.length == 2) { |
22 assert_array_equals(order, ['b', 'a'], | 22 assert_array_equals(order, ['b', 'a'], |
23 'fullscreenElement IDs in fullscreenchange events'); | 23 'fullscreenElement IDs in fullscreenchange events'); |
24 t.done(); | 24 t.done(); |
25 } | 25 } |
26 }); | 26 }); |
27 document.onfullscreenerror = t.unreached_func('fullscreenerror event'); | 27 document.onfullscreenerror = t.unreached_func('fullscreenerror event'); |
28 | 28 |
29 trusted_click(t.step_func(() => { | 29 trusted_click(t, () => { |
30 b.requestFullscreen(); | 30 b.requestFullscreen(); |
31 a.requestFullscreen(); | 31 a.requestFullscreen(); |
32 }), document.body); | 32 }, document.body); |
33 }); | 33 }); |
34 </script> | 34 </script> |
OLD | NEW |