summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen/api/document-fullscreen-element-manual.html
blob: 473bdbb0f6174971d75425eea0e6f51595d6e4aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<title>Document.fullscreenElement</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<script>
async_test(function(t)
{
    var div = document.querySelector("div");

    document.onfullscreenchange = t.step_func(function()
    {
        assert_equals(document.fullscreenElement, div, "fullscreenElement before exitFullscreen()");
        document.exitFullscreen();
        assert_equals(document.fullscreenElement, div, "fullscreenElement after exitFullscreen()");

        document.onfullscreenchange = t.step_func(function()
        {
            assert_equals(document.fullscreenElement, null, "fullscreenElement after exiting fullscreen");
            t.done();
        });
    });

    trusted_click(t.step_func(function()
    {
        assert_equals(document.fullscreenElement, null, "fullscreenElement before requestFullscreen()");
        div.requestFullscreen();
        assert_equals(document.fullscreenElement, null, "fullscreenElement after requestFullscreen()");
    }), document.body);
});
</script>