blob: 7bf1289ebef1e963a159b89675030d1b71c37065 [file] [log] [blame] [edit]
<!DOCTYPE html>
<meta charset=utf-8>
<title>The default scroll-timeline at rule with paused animations</title>
<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-at-rule">
<link rel="help" href="https://drafts.csswg.org/css-animations/#animation-play-state">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-animations/support/testcommon.js"></script>
<style>
@keyframes anim {
from { width: 100px; }
to { width: 200px; }
}
@scroll-timeline timeline {
source: auto;
orientation: auto;
scroll-offsets: none;
}
.fill-vh {
width: 100px;
height: 100vh;
}
</style>
<body>
<div id="log"></div>
<script>
'use strict';
test(t => {
const div = addDiv(t, { style: 'width: 50px; height: 100px;' });
const filling = addDiv(t, { class: 'fill-vh' });
const scroller = document.scrollingElement;
getComputedStyle(document.scrollingElement).height
div.style.animation = 'anim 100s linear timeline paused';
assert_equals(getComputedStyle(div).width, '100px');
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
scroller.scrollTop = maxScroll;
assert_equals(getComputedStyle(div).width, '100px');
// Reset to 0 so we don't affect following tests.
document.scrollingElement.scrollTop = 0;
}, 'Test that the scroll animation is paused');
test(t => {
const div = addDiv(t, { style: 'width: 50px; height: 100px;' });
const filling = addDiv(t, { class: 'fill-vh' });
const scroller = document.scrollingElement;
getComputedStyle(document.scrollingElement).height
div.style.animation = 'anim 100s linear timeline';
assert_equals(getComputedStyle(div).width, '100px');
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
scroller.scrollTop = maxScroll;
assert_equals(getComputedStyle(div).width, '200px');
div.style.animationPlayState = "paused";
getComputedStyle(div).animationPlayState;
document.scrollingElement.scrollTop = 0;
assert_equals(getComputedStyle(div).width, '200px');
}, 'Test that the scroll animation is paused by updating animation-play-state');
</script>
</body>