summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
blob: ac92a9c24b9088316b206d1ed3a73627fabfef03 (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
<!DOCTYPE html>
<title>Document#onfullscreenerror</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
    promise_test(async (t) => {
        assert_equals(
            document.onfullscreenerror,
            null,
            "initial onfullscreenerror"
        );
        const [, event] = await Promise.all([
            promise_rejects_js(
                t,
                TypeError,
                document.documentElement.requestFullscreen()
            ),
            new Promise((r) => document.addEventListener("fullscreenerror", r)),
        ]);
        assert_equals(event.target, document.documentElement);
        assert_true(event instanceof Event);
    }, "Checks that the fullscreenerror event is fired when entering fullscreen fails");
</script>