summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-animations/responsive/width.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/web-animations/responsive/width.html
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/web-animations/responsive/width.html88
1 files changed, 88 insertions, 0 deletions
diff --git a/testing/web-platform/tests/web-animations/responsive/width.html b/testing/web-platform/tests/web-animations/responsive/width.html
new file mode 100644
index 0000000000..9f5bf5a29d
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/responsive/width.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+
+body { width: 500px }
+
+#child { width: 20px }
+
+</style>
+
+<div id='container'>
+ <div id='element'>
+ <div id='child'>
+ </div>
+ </div>
+</div>
+
+<script>
+var element = document.getElementById('element');
+var container = document.getElementById('container');
+
+test(function() {
+ element.style.fontSize = '10px';
+ var player = element.animate([{width: '3em'}, {width: '5em'}], 10);
+ player.pause();
+ player.currentTime = 5;
+ element.style.fontSize = '20px';
+ assert_equals(getComputedStyle(element).width, '80px');
+}, 'width responsive to style changes');
+
+test(function() {
+ element.style.fontSize = '10px';
+ var player = element.animate([{width: '40px'}, {width: 'calc(40px - 2em)'}], 10);
+ player.pause();
+
+ player.currentTime = 5;
+ element.style.fontSize = '40px';
+ assert_equals(getComputedStyle(element).width, '20px');
+
+ player.currentTime = 7.5;
+ assert_equals(getComputedStyle(element).width, '10px');
+}, 'width clamped to 0px on keyframes');
+
+test(function() {
+ container.style.width = 'auto';
+ var player = element.animate([{width: 'inherit'}, {width: '20px'}], 4000);
+ player.pause();
+
+ player.currentTime = 1000;
+ assert_equals(getComputedStyle(element).width, '500px');
+
+ container.style.width = '100px';
+ assert_equals(getComputedStyle(element).width, '80px');
+
+ container.style.width = 'min-content';
+ assert_equals(getComputedStyle(element).width, '20px');
+
+ container.style.width = '100px';
+ assert_equals(getComputedStyle(element).width, '80px');
+
+ container.style.width = 'max-content';
+ assert_equals(getComputedStyle(element).width, '20px');
+
+ container.style.width = '100px';
+ assert_equals(getComputedStyle(element).width, '80px');
+
+ container.style.width = 'fit-content';
+ assert_equals(getComputedStyle(element).width, '20px');
+}, 'width responsive to inherited changes from keyword');
+
+test(function() {
+ container.style.fontSize = '10px';
+ container.style.width = '100px';
+ var player = element.animate([{width: 'inherit'}, {width: '200px'}], 4000);
+ player.pause();
+
+ player.currentTime = 1000;
+ assert_equals(getComputedStyle(element).width, '125px');
+
+ container.style.width = '120px';
+ assert_equals(getComputedStyle(element).width, '140px');
+
+ container.style.width = '100px';
+ assert_equals(getComputedStyle(element).width, '125px');
+}, 'width responsive to inherited changes from length');
+
+</script>