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