OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
3 <style> | 3 <style> |
4 .container { | 4 .parent { |
5 width: 100px; | 5 width: 100px; |
6 height: 100px; | 6 overflow: visible; |
7 border: black solid 1px; | |
8 display: inline-block; | |
9 margin-right: 5px; | |
10 background-color: white; | |
11 } | 7 } |
12 .target { | 8 .target { |
13 width: 100px; | |
14 height: 100px; | |
15 background-color: black; | 9 background-color: black; |
| 10 width: 10px; |
| 11 height: 10px; |
16 } | 12 } |
17 .expected { | 13 .expected { |
18 background-color: green; | 14 background-color: green; |
19 } | 15 } |
20 </style> | 16 </style> |
21 <body> | 17 <body> |
22 <template id="target-template"> | 18 <template id="target-template"> |
23 <div class="container"> | 19 <div class="container"> |
24 <div class="target"></div> | 20 <div class="target"></div> |
25 </div> | 21 </div> |
26 </template> | 22 </template> |
27 <script src="resources/interpolation-test.js"></script> | 23 <script src="resources/interpolation-test.js"></script> |
28 <script> | 24 <script> |
29 assertInterpolation({ | 25 assertInterpolation({ |
30 property: 'width', | 26 property: 'width', |
| 27 from: '', |
| 28 to: '40px', |
| 29 }, [ |
| 30 {at: -0.3, is: '1px'}, |
| 31 {at: 0, is: '10px'}, |
| 32 {at: 0.3, is: '19px'}, |
| 33 {at: 0.6, is: '28px'}, |
| 34 {at: 1, is: '40px'}, |
| 35 {at: 1.5, is: '55px'}, |
| 36 ]); |
| 37 |
| 38 assertNoInterpolation({ |
| 39 property: 'width', |
| 40 from: 'initial', |
| 41 to: '40px', |
| 42 }); |
| 43 |
| 44 assertInterpolation({ |
| 45 property: 'width', |
| 46 from: 'inherit', |
| 47 to: '40px', |
| 48 }, [ |
| 49 {at: -0.3, is: '118px'}, |
| 50 {at: 0, is: '100px'}, |
| 51 {at: 0.3, is: '82px'}, |
| 52 {at: 0.6, is: '64px'}, |
| 53 {at: 1, is: '40px'}, |
| 54 {at: 1.5, is: '10px'}, |
| 55 ]); |
| 56 |
| 57 assertNoInterpolation({ |
| 58 property: 'width', |
| 59 from: 'unset', |
| 60 to: '40px', |
| 61 }); |
| 62 |
| 63 assertInterpolation({ |
| 64 property: 'width', |
31 from: '0px', | 65 from: '0px', |
32 to: '100px' | 66 to: '100px' |
33 }, [ | 67 }, [ |
34 {at: -0.3, is: '0px'}, // CSS width can't be negative. | 68 {at: -0.3, is: '0px'}, // CSS width can't be negative. |
35 {at: 0, is: '0px'}, | 69 {at: 0, is: '0px'}, |
36 {at: 0.3, is: '30px'}, | 70 {at: 0.3, is: '30px'}, |
37 {at: 0.6, is: '60px'}, | 71 {at: 0.6, is: '60px'}, |
38 {at: 1, is: '100px'}, | 72 {at: 1, is: '100px'}, |
39 {at: 1.5, is: '150px'} | 73 {at: 1.5, is: '150px'} |
40 ]); | 74 ]); |
41 assertInterpolation({ | 75 assertInterpolation({ |
42 property: 'width', | 76 property: 'width', |
43 from: '10px', | 77 from: '10px', |
44 to: '100%' | 78 to: '100%' |
45 }, [ | 79 }, [ |
46 {at: -0.3, is: '0px'}, // CSS width can't be negative. | 80 {at: -0.3, is: '0px'}, // CSS width can't be negative. |
47 {at: 0, is: '10px'}, | 81 {at: 0, is: '10px'}, |
48 {at: 0.3, is: '37px'}, | 82 {at: 0.3, is: '37px'}, |
49 {at: 0.6, is: '64px'}, | 83 {at: 0.6, is: '64px'}, |
50 {at: 1, is: '100px'}, | 84 {at: 1, is: '100px'}, |
51 {at: 1.5, is: '145px'} | 85 {at: 1.5, is: '145px'} |
52 ]); | 86 ]); |
53 </script> | 87 </script> |
54 </body> | 88 </body> |
OLD | NEW |