summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_animations_variable_changes.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/style/test/test_animations_variable_changes.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_animations_variable_changes.html')
-rw-r--r--layout/style/test/test_animations_variable_changes.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/layout/style/test/test_animations_variable_changes.html b/layout/style/test/test_animations_variable_changes.html
new file mode 100644
index 0000000000..ac254e1136
--- /dev/null
+++ b/layout/style/test/test_animations_variable_changes.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Tests that animations respond to changes to variables</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<style>
+:root {
+ --width: 100px;
+}
+.wider {
+ --width: 200px;
+}
+@keyframes widen {
+ to { margin-left: var(--width) }
+}
+</style>
+<body>
+<div id="log"></div>
+<script>
+
+test(() => {
+ const div = document.createElement('div');
+ document.body.append(div);
+
+ div.style.animation = 'widen step-start 100s';
+ assert_equals(getComputedStyle(div).marginLeft, '100px',
+ 'Animation value before updating CSS variable');
+
+ div.classList.add('wider');
+
+ assert_equals(getComputedStyle(div).marginLeft, '200px',
+ 'Animation value after updating CSS variable');
+
+ div.remove();
+}, 'Animation reflects changes to custom properties');
+
+test(() => {
+ const parent = document.createElement('div');
+ const child = document.createElement('div');
+ parent.append(child);
+ document.body.append(parent);
+
+ child.style.animation = 'widen step-start 100s';
+ assert_equals(getComputedStyle(child).marginLeft, '100px',
+ 'Animation value before updating CSS variable');
+
+ parent.classList.add('wider');
+
+ assert_equals(getComputedStyle(child).marginLeft, '200px',
+ 'Animation value after updating CSS variable');
+
+ parent.remove();
+ child.remove();
+}, 'Animation reflect changes to custom properties on parent');
+
+</script>
+</body>