summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scrollbars/scrollbar-color-004.html
blob: cff00c634f72ee509050c24557cb3d1faa89e24a (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
57
58
59
60
<!doctype html>
<meta charset="utf-8">
<title>CSS Scrollbars: scrollbar-color on body correctly interacts with ::-webkit-scrollbar</title>
<link rel="author" title="Luke Warlow" href="mailto:luke@warlow.dev" />
<link rel="help" href="https://drafts.csswg.org/css-scrollbars-1/#color-compat" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<style>
  .container {
    overflow: auto;
    height: 200px;
    width: 200px;
    margin: 1px;
    padding: 0px;
    border: none;
    background: deepskyblue;
  }

  .content {
    height: 300px;
    width: 100%;
    background: lightsalmon;
  }

  body {
    scrollbar-color: yellow blue;
  }

  ::-webkit-scrollbar {
    display: none;
  }
</style>
<script>
  function performTest() {
    setup({ explicit_done: true });

    test(function () {
      let container = document.getElementById('container_themed');
      let content = document.getElementById('content_themed');
      assert_less_than(container.scrollWidth, container.offsetWidth, "themed scrollWidth");
      assert_less_than(container.clientWidth, container.offsetWidth, "themed clientWidth");
      assert_equals(container.offsetLeft, content.offsetLeft, "themed offsetLeft");
      assert_equals(container.clientWidth, content.clientWidth, "themed clientWidth");
      assert_not_equals(container.offsetWidth, content.offsetWidth, "themed offsetWidth");
    }, "scrollbar-color yellow blue on body overrides ::-webkit-scrollbar");

    done();
  }
</script>

<body onload="performTest()">

  Test scrollbar-color: vertical scrollbar

  <div class="container themed" id="container_themed">
    <div class="content" id="content_themed">themed</div>
  </div>

</body>