summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html')
-rw-r--r--testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html145
1 files changed, 145 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html b/testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html
new file mode 100644
index 0000000000..32cb89c4ef
--- /dev/null
+++ b/testing/web-platform/tests/scroll-animations/css/animation-timeline-ignored.tentative.html
@@ -0,0 +1,145 @@
+<!DOCTYPE html>
+<link rel="help" src="https://github.com/w3c/csswg-drafts/pull/5666">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/web-animations/testcommon.js"></script>
+<style>
+ main {
+ overflow: hidden;
+ height: 0px;
+ }
+ main > div {
+ overflow: hidden;
+ width: 100px;
+ height: 100px;
+ }
+ main > div > div {
+ height: 200px;
+ }
+ @keyframes expand {
+ from { width: 100px; }
+ to { width: 200px; }
+ }
+ #scroller1 {
+ scroll-timeline: timeline1;
+ }
+ #scroller2 {
+ scroll-timeline: timeline2;
+ }
+ #scroller3 {
+ scroll-timeline: timeline3;
+ }
+ #element {
+ width: 0px;
+ height: 20px;
+ animation-name: expand;
+ animation-duration: 1000s;
+ animation-timing-function: linear;
+ animation-timeline: timeline1;
+ }
+ /* Ensure stable expectations if feature is not supported */
+ @supports not (animation-timeline:foo) {
+ #element { animation-play-state: paused; }
+ }
+</style>
+<main>
+ <div id=scroller1><div></div></div>
+ <div id=scroller2><div></div></div>
+ <div id=scroller3><div></div></div>
+ <div id=scroller4><div></div></div>
+ <div id=container></div>
+</main>
+<script>
+ // Force layout of scrollers.
+ scroller1.offsetTop;
+ scroller2.offsetTop;
+ scroller3.offsetTop;
+ scroller4.offsetTop;
+
+ scroller1.scrollTop = 20;
+ scroller2.scrollTop = 40;
+ scroller3.scrollTop = 60;
+ scroller4.scrollTop = 80;
+
+ // Create #element in #container, run |func|, then clean up afterwards.
+ function test_animation_timeline(func, description) {
+ promise_test(async () => {
+ try {
+ let element = document.createElement('element');
+ element.setAttribute('id', 'element');
+ container.append(element);
+ await func();
+ } finally {
+ while (container.firstChild)
+ container.firstChild.remove();
+ }
+ }, description);
+ }
+
+ test_animation_timeline(async () => {
+ await waitForNextFrame();
+ assert_equals(getComputedStyle(element).width, '120px');
+ element.style = 'animation-timeline:timeline2';
+ assert_equals(getComputedStyle(element).width, '140px');
+ }, 'Changing animation-timeline changes the timeline (sanity check)');
+
+ test_animation_timeline(async () => {
+ await waitForNextFrame();
+ assert_equals(getComputedStyle(element).width, '120px');
+
+ // Set a (non-CSS) ScrollTimeline on the CSSAnimation.
+ let timeline4 = new ScrollTimeline({
+ source: scroller4,
+ scrollOffsets: [CSS.px(0), CSS.px(100)]
+ });
+
+ element.getAnimations()[0].timeline = timeline4;
+ assert_equals(getComputedStyle(element).width, '180px');
+
+ // Changing the animation-timeline property should have no effect.
+ element.style = 'animation-timeline:timeline2';
+ assert_equals(getComputedStyle(element).width, '180px');
+ }, 'animation-timeline ignored after setting timeline with JS (ScrollTimeline from JS)');
+
+ test_animation_timeline(async () => {
+ await waitForNextFrame();
+ assert_equals(getComputedStyle(element).width, '120px');
+ let animation = element.getAnimations()[0];
+ let timeline1 = animation.timeline;
+
+ element.style = 'animation-timeline:timeline2';
+ assert_equals(getComputedStyle(element).width, '140px');
+
+ animation.timeline = timeline1;
+ assert_equals(getComputedStyle(element).width, '120px');
+
+ // Should have no effect.
+ element.style = 'animation-timeline:timeline3';
+ assert_equals(getComputedStyle(element).width, '120px');
+ }, 'animation-timeline ignored after setting timeline with JS (ScrollTimeline from CSS)');
+
+ test_animation_timeline(async () => {
+ await waitForNextFrame();
+ assert_equals(getComputedStyle(element).width, '120px');
+ element.getAnimations()[0].timeline = document.timeline;
+
+ // (The animation continues from where the previous timeline left it).
+ assert_equals(getComputedStyle(element).width, '120px');
+
+ // Changing the animation-timeline property should have no effect.
+ element.style = 'animation-timeline:timeline2';
+ assert_equals(getComputedStyle(element).width, '120px');
+ }, 'animation-timeline ignored after setting timeline with JS (document timeline)');
+
+ test_animation_timeline(async () => {
+ await waitForNextFrame();
+ assert_equals(getComputedStyle(element).width, '120px');
+ element.getAnimations()[0].timeline = null;
+ assert_equals(getComputedStyle(element).width, '0px');
+
+ // Changing the animation-timeline property should have no effect.
+ element.style = 'animation-timeline:timeline2';
+ assert_equals(getComputedStyle(element).width, '0px');
+ }, 'animation-timeline ignored after setting timeline with JS (null)');
+
+</script>