diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /testing/web-platform/tests/web-animations/responsive/width.html | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/web-animations/responsive/width.html')
-rw-r--r-- | testing/web-platform/tests/web-animations/responsive/width.html | 88 |
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> |