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
|
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
top: 30px;
margin-bottom: 40px;
}
.target {
position: relative;
width: 10px;
height: 10px;
background-color: black;
display: inline-block;
top: 10px;
}
.expected {
background-color: green;
margin-right: 10px;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'top',
from: '',
to: '20px',
}, [
{at: -0.3, is: '7px'},
{at: 0, is: '10px'},
{at: 0.5, is: '15px'},
{at: 1, is: '20px'},
{at: 1.5, is: '25px'},
]);
assertNoInterpolation({
property: 'top',
from: 'initial',
to: '20px',
});
assertInterpolation({
property: 'top',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, is: '33px'},
{at: 0, is: '30px'},
{at: 0.5, is: '25px'},
{at: 1, is: '20px'},
{at: 1.5, is: '15px'},
]);
assertNoInterpolation({
property: 'top',
from: 'unset',
to: '20px',
});
assertInterpolation({
property: 'top',
from: '-10px',
to: '10px'
}, [
{at: -0.3, is: '-16px'},
{at: 0, is: '-10px'},
{at: 0.5, is: '0px'},
{at: 1, is: '10px'},
{at: 1.5, is: '20px'}
]);
</script>
</body>
|