summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen/api/fullscreen-display-contents.html
blob: fc6f232747dd7c37f2377a49cec6422aa2bd99e6 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html class="reftest-wait">
    <title>
        Test that display:contents on fullscreen elements acts like
        display:block
    </title>
    <meta charset="utf-8" />
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/resources/testdriver.js"></script>
    <script src="/resources/testdriver-vendor.js"></script>
    <script src="../trusted-click.js"></script>
    <link rel="author" href="mailto:masonf@chromium.org" />
    <link
        rel="help"
        href="https://fullscreen.spec.whatwg.org/#new-stacking-layer"
    />
    <div id="target"></div>
    <style>
        #target {
            display: contents;
            background-color: green;
        }
        #target::backdrop {
            display: contents;
        }
    </style>

    <script>
        promise_test(async (t) => {
            const target = document.querySelector("#target");
            await test_driver.bless("fullscreen");
            await target.requestFullscreen();
            await new Promise((resolve) => requestAnimationFrame(resolve));
            assert_equals(document.fullscreenElement, target);
            assert_equals(
                getComputedStyle(target).display,
                "block",
                "fullscreen element should have display:block"
            );
            assert_equals(
                getComputedStyle(target, "::backdrop").display,
                "block",
                "fullscreen element's ::backdrop should have display:block"
            );
            await document.exitFullscreen();
            new Promise((resolve) => requestAnimationFrame(resolve));
            assert_equals(document.fullscreenElement, null);
            assert_equals(
                getComputedStyle(target).display,
                "contents",
                "fullscreen element should have display:contents after exiting fullscreen"
            );
        });
    </script>
</html>