summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen/rendering/fullscreen-css-invalidation.html
blob: e855d0c19352ccfec41a54fc20300c2b9323e39b (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
<!DOCTYPE html>
<title>Invalidate :fullscreen based style</title>
<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>
<style>
  #pass {
    color: red;
  }
  :root:fullscreen #pass {
    color: green;
  }
</style>
<div id="pass">Should be green</div>
<script>
  async_test(t => {
    document.onfullscreenchange = t.step_func_done(() => {
      assert_equals(document.fullscreenElement, document.documentElement);
      assert_equals(getComputedStyle(pass).color, "rgb(0, 128, 0)", "Green when :root is fullscreened.");
    });
    document.documentElement.addEventListener('click', t.step_func(() => {
      document.documentElement.requestFullscreen();
    }), {once: true});
    assert_equals(getComputedStyle(pass).color, "rgb(255, 0, 0)", "Initially red.");
    test_driver.click(document.documentElement);
  });
</script>