blob: cf03f2e1207988fbdb8df6e884422b43f9acc012 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>transition duration change</title>
<link rel="help" href="https://drafts.csswg.org/css-transitions-1/#starting">
<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 src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-transitions/support/helper.js"></script>
<script>
'use strict';
window.onload = () => {
promise_test(async t => {
// Make sure we have rendered the page before making the style change
// to ensure we get transitions.
await waitForAnimationFrames(2);
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');
const anim = document.getAnimations()[0];
anim.finish();
assert_equals(
getComputedStyle(box).left, '400px',
'The final value has been reached when finished');
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>
|