summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-animations
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/tests/css/css-animations
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-animations')
-rw-r--r--testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen.html44
-rw-r--r--testing/web-platform/tests/css/css-animations/empty-pseudo-class-with-animation.html47
3 files changed, 114 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen-ref.html b/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen-ref.html
new file mode 100644
index 0000000000..76fd70f3e0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<title>Validates rendering of a transformed element when the element is initially off screen</title>
+<style type="text/css" media="screen">
+ body {
+ margin: 0;
+ }
+
+ #box {
+ position: absolute;
+ left: 0px;
+ top: 100px;
+ height: 100px;
+ width: 100px;
+ margin: 0;
+ background-color: green;
+ transform: translate(100px, 0px);
+ }
+</style>
+<body>
+ <div id="box"></div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen.html b/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen.html
new file mode 100644
index 0000000000..bfdf432a61
--- /dev/null
+++ b/testing/web-platform/tests/css/css-animations/animation-offscreen-to-onscreen.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Validates rendering of a transformed element when the element is initially off screen</title>
+<link rel="help" href="https://www.w3.org/TR/css-animations-1">
+<link rel="help" href="https://www.w3.org/TR/web-animations-1/#the-current-ready-promise">
+<link rel="match" href="animation-offscreen-to-onscreen-ref.html">
+<style type="text/css" media="screen">
+ body {
+ margin: 0;
+ }
+
+ @keyframes anim {
+ from { transform: translate(100px, 0px); }
+ to { transform: translate(100px, 0px); }
+ }
+
+ #box {
+ position: absolute;
+ left: 0px;
+ top: 100px;
+ height: 100px;
+ width: 100px;
+ margin: 0;
+ background-color: green;
+ transform: translate(-2000px, 0px);
+ animation-duration: 10s;
+ animation-direction: normal;
+ animation-timing-function: linear;
+ animation-name: anim;
+ }
+</style>
+<body>
+ <div id="box"></div>
+</body>
+<script src="/common/reftest-wait.js"></script>
+<script src="support/testcommon.js"></script>
+<script type="text/javascript">
+ window.onload = async () => {
+ await document.getAnimations()[0].ready;
+ await waitForNextFrame();
+ takeScreenshot();
+ }
+</script>
+</html>
diff --git a/testing/web-platform/tests/css/css-animations/empty-pseudo-class-with-animation.html b/testing/web-platform/tests/css/css-animations/empty-pseudo-class-with-animation.html
new file mode 100644
index 0000000000..d8dba1ab5b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-animations/empty-pseudo-class-with-animation.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<link rel="author" href="mailto:graouts@apple.com">
+<link rel="help" href="https://drafts.csswg.org/css-animations/">
+<link rel="help" href="https://drafts.csswg.org/selectors/#the-empty-pseudo">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/css-animations/support/testcommon.js"></script>
+
+<div class="container"></div>
+
+<style>
+
+.container {
+ width: 100px;
+ height: 100px;
+ background-color: rgb(0, 255, 0);
+}
+
+.container:empty {
+ background-color: rgb(255, 0, 0);
+ animation: anim 1s;
+}
+
+@keyframes anim { }
+
+</style>
+
+<script>
+
+promise_test(async () => {
+ const container = document.querySelector(".container");
+ const computedStyle = getComputedStyle(container);
+
+ // Check that the :empty rule applies initially.
+ assert_equals(computedStyle.backgroundColor, 'rgb(255, 0, 0)',
+ 'The initial background-color matches the value set by the :empty rule.');
+
+ // Await a couple of frames to let any animation-related style updates happen.
+ await waitForAnimationFrames(2);
+
+ // Append a child which should no longer let the :empty rule apply.
+ container.appendChild(document.createElement("span"));
+ assert_equals(computedStyle.backgroundColor, 'rgb(0, 255, 0)',
+ 'The background-color after inserting a child into the container no longer matches the value set by the :empty rule.');
+}, 'Setting an "animation" style property on an element does not interfere with the :empty pseudo-class.');
+
+</script>