summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/css/scroll-timeline-sibling-gcs.html
blob: 6062e795f43e3057f8fd580e9b949c91bee567fa (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
<!DOCTYPE html>
<title>scroll-timeline and container queries</title>
<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-shorthand">
<link rel="help" src="https://drafts.csswg.org/css-contain-3/#container-queries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="support/testcommon.js"></script>
<style>
  #scroller {
    overflow: auto;
    width: auto;
    height: 100px;
  }
  #scroller > div {
    height: 200px;
  }

  @keyframes anim {
    from { background-color: rgb(100, 100, 100); }
    to { background-color: rgb(200, 200, 200); }
  }
  #element {
    height: 10px;
    width: 10px;
    animation: anim 10s linear;
    animation-timeline: timeline;
    background-color: rgb(0, 0, 0);
  }
</style>
<div>
  <div id=scroller>
    <div></div>
  </div>
  <div>
    <div id=element></div>
  </div>
</div>
<script>
  setup(assert_implements_animation_timeline);

  promise_test(async (t) => {
    element.offsetTop;
    scroller.scrollTop = 50;
    await waitForNextFrame();
    // Unknown timeline, time held at zero.
    assert_equals(getComputedStyle(element).backgroundColor, 'rgb(100, 100, 100)');
    scroller.style.scrollTimeline = 'timeline';
    await waitForCSSScrollTimelineStyle();
    assert_equals(getComputedStyle(element).backgroundColor, 'rgb(150, 150, 150)');
  }, 'Timelines appearing on preceding siblings are visible to getComputedStyle');
</script>