1
0
Fork 0
firefox/testing/web-platform/tests/css/css-transitions/transition-remove-and-change-immediate.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

51 lines
1.4 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>CSS Transitions Test: Removing transition and changing width applies change immediately</title>
<meta name="assert" content="When a transition is removed and a width is changed after a previous transition completes, the change is immediate.">
<link rel="help" href="https://drafts.csswg.org/css-transitions/#starting">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.js"></script>
</head>
<body>
<div id="log"></div>
<script>
promise_test(async t => {
const div = addDiv(t, {
style: 'transition: width 0.02s; width: 0px;'
});
// Flush initial state
getComputedStyle(div).width;
div.style.width = '100px';
// Wait for transition to complete
await waitForTransitionEnd(div);
// Verify the width after first transition
const afterFirst = getComputedStyle(div).width;
assert_equals(afterFirst, '100px', 'width should be 100px after first transition');
// Set width back to 0 and remove transition
div.style.width = '0px';
div.style.transition = '';
// Force layout update to ensure style computation
const afterSecond = getComputedStyle(div).width;
// Check width is immediately updated
assert_equals(
afterSecond,
'0px',
'width should reset to 0 immediately'
);
}, 'Removing transition and changing width applies change immediately');
</script>
</body>
</html>