| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <style> |
| #box { |
| position: absolute; |
| height: 100px; |
| width: 100px; |
| left: 0px; |
| background-color: blue; |
| transition-duration: 1s; |
| transition-delay: -0.75s; |
| transition-timing-function: linear; |
| transition-property: left; |
| } |
| </style> |
| </head> |
| <body> |
| <div id="box"></div> |
| <script> |
| 'use strict'; |
| |
| async_test(t => { |
| t.step_func(() => { |
| box.offsetTop; // Force style recalc |
| box.style.left = '400px'; |
| assert_equals(getComputedStyle(box).left, '300px', 'The transition progresses 75% immediately due to negative transition-delay'); |
| box.style.transitionDuration = '7.5s'; |
| assert_equals(getComputedStyle(box).left, '300px', 'Changing the duration does not affect the current transition'); |
| })(); |
| box.addEventListener('transitionend', t.step_func_done(() => { |
| assert_equals(getComputedStyle(box).left, '400px', 'The final value has been reached when transitionend fires'); |
| box.style.left = '1400px'; |
| assert_equals(getComputedStyle(box).left, '500px', 'With the new duration taking effect, the transition progresses 10% immediately'); |
| })); |
| }, 'Transition duration change should not affect transition in progress'); |
| </script> |
| </body> |
| </html> |