summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/css/support/testcommon.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/scroll-animations/css/support/testcommon.js')
-rw-r--r--testing/web-platform/tests/scroll-animations/css/support/testcommon.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/support/testcommon.js b/testing/web-platform/tests/scroll-animations/css/support/testcommon.js
new file mode 100644
index 0000000000..91540774d0
--- /dev/null
+++ b/testing/web-platform/tests/scroll-animations/css/support/testcommon.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/**
+ * Returns a Promise that is resolved after a CSS scroll timeline is created (as
+ * the result of a style change) and a snapshot has been taken, so that the
+ * animation style is correctly reflected by getComputedStyle().
+ * Technically, this only takes a full frame update. We implement this as two
+ * requestAnimationFrame callbacks because the result will be available at the
+ * beginning of the second frame.
+ */
+async function waitForCSSScrollTimelineStyle() {
+ await waitForNextFrame();
+ await waitForNextFrame();
+}
+
+function assert_implements_animation_timeline() {
+ assert_implements(CSS.supports('animation-timeline:--foo'),
+ 'animation-timeline not supported');
+}