summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/animations/interpolation/width-interpolation.html
blob: 294b43b7fd7fd5dbd905fceb8d7605d4a6bc1a20 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
  width: 100px;
  overflow: visible;
}
.target {
  background-color: black;
  width: 10px;
  height: 10px;
}
.expected {
  background-color: green;
}
</style>
<body>
<template id="target-template">
  <div class="container">
    <div class="target"></div>
  </div>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
  property: 'width',
  from: '',
  to: '40px',
}, [
  {at: -0.3, is: '1px'},
  {at: 0, is: '10px'},
  {at: 0.3, is: '19px'},
  {at: 0.6, is: '28px'},
  {at: 1, is: '40px'},
  {at: 1.5, is: '55px'},
]);

assertNoInterpolation({
  property: 'width',
  from: 'initial',
  to: '40px',
});

assertInterpolation({
  property: 'width',
  from: 'inherit',
  to: '40px',
}, [
  {at: -0.3, is: '118px'},
  {at: 0, is: '100px'},
  {at: 0.3, is: '82px'},
  {at: 0.6, is: '64px'},
  {at: 1, is: '40px'},
  {at: 1.5, is: '10px'},
]);

assertNoInterpolation({
  property: 'width',
  from: 'unset',
  to: '40px',
});

assertInterpolation({
  property: 'width',
  from: '0px',
  to: '100px',
}, [
  {at: -0.3, is: '0px'}, // CSS width can't be negative.
  {at: 0, is: '0px'},
  {at: 0.3, is: '30px'},
  {at: 0.6, is: '60px'},
  {at: 1, is: '100px'},
  {at: 1.5, is: '150px'}
]);

assertInterpolation({
  property: 'width',
  from: '10px',
  to: '100%'
}, [
  {at: -0.3, is: '0px'}, // CSS width can't be negative.
  {at: 0, is: '10px'},
  {at: 0.3, is: '37px'},
  {at: 0.6, is: '64px'},
  {at: 1, is: '100px'},
  {at: 1.5, is: '145px'}
]);
</script>
</body>