| 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 font-size: 10px; | 5 font-size: 30px; |
| 6 } | 6 } |
| 7 .target { | 7 .target { |
| 8 display: inline-block; | 8 display: inline-block; |
| 9 font: 100px sans-serif; | 9 font: 10px sans-serif; |
| 10 } | 10 } |
| 11 .expected { | 11 .expected { |
| 12 color: green; | 12 color: green; |
| 13 margin-right: 30px; | 13 margin-right: 30px; |
| 14 } | 14 } |
| 15 </style> | 15 </style> |
| 16 <body> | 16 <body> |
| 17 <template id="target-template"> | 17 <template id="target-template"> |
| 18 <span class="container"> | 18 <span> |
| 19 <div class="target">TT</div> | 19 <div class="target">Test Text</div> |
| 20 </span> | 20 </span> |
| 21 </template> | 21 </template> |
| 22 <script src="resources/interpolation-test.js"></script> | 22 <script src="resources/interpolation-test.js"></script> |
| 23 <script> | 23 <script> |
| 24 assertInterpolation({ | 24 assertInterpolation({ |
| 25 property: 'font-size', | 25 property: 'font-size', |
| 26 from: '', |
| 27 to: '20px', |
| 28 }, [ |
| 29 {at: -2, is: '0px'}, |
| 30 {at: -0.3, is: '7px'}, |
| 31 {at: 0, is: '10px'}, |
| 32 {at: 0.3, is: '13px'}, |
| 33 {at: 0.6, is: '16px'}, |
| 34 {at: 1, is: '20px'}, |
| 35 {at: 1.5, is: '25px'}, |
| 36 ]); |
| 37 |
| 38 assertInterpolation({ |
| 39 property: 'font-size', |
| 40 from: 'initial', |
| 41 to: '20px', |
| 42 }, [ |
| 43 {at: -2, is: '8px'}, |
| 44 {at: -0.3, is: '14.8px'}, |
| 45 {at: 0, is: '16px'}, |
| 46 {at: 0.3, is: '17.2px'}, |
| 47 {at: 0.6, is: '18.4px'}, |
| 48 {at: 1, is: '20px'}, |
| 49 {at: 1.5, is: '22px'}, |
| 50 ]); |
| 51 |
| 52 assertInterpolation({ |
| 53 property: 'font-size', |
| 54 from: 'inherit', |
| 55 to: '20px', |
| 56 }, [ |
| 57 {at: -2, is: '50px'}, |
| 58 {at: -0.3, is: '33px'}, |
| 59 {at: 0, is: '30px'}, |
| 60 {at: 0.3, is: '27px'}, |
| 61 {at: 0.6, is: '24px'}, |
| 62 {at: 1, is: '20px'}, |
| 63 {at: 1.5, is: '15px'}, |
| 64 ]); |
| 65 |
| 66 assertInterpolation({ |
| 67 property: 'font-size', |
| 68 from: 'unset', |
| 69 to: '20px', |
| 70 }, [ |
| 71 {at: -2, is: '50px'}, |
| 72 {at: -0.3, is: '33px'}, |
| 73 {at: 0, is: '30px'}, |
| 74 {at: 0.3, is: '27px'}, |
| 75 {at: 0.6, is: '24px'}, |
| 76 {at: 1, is: '20px'}, |
| 77 {at: 1.5, is: '15px'}, |
| 78 ]); |
| 79 |
| 80 assertInterpolation({ |
| 81 property: 'font-size', |
| 26 from: '4px', | 82 from: '4px', |
| 27 to: '14px' | 83 to: '14px' |
| 28 }, [ | 84 }, [ |
| 29 {at: -2, is: '0px'}, // CSS font-size can't be negative. | 85 {at: -2, is: '0px'}, // CSS font-size can't be negative. |
| 30 {at: -0.3, is: '1px'}, | 86 {at: -0.3, is: '1px'}, |
| 31 {at: 0, is: '4px'}, | 87 {at: 0, is: '4px'}, |
| 32 {at: 0.3, is: '7px'}, | 88 {at: 0.3, is: '7px'}, |
| 33 {at: 0.6, is: '10px'}, | 89 {at: 0.6, is: '10px'}, |
| 34 {at: 1, is: '14px'}, | 90 {at: 1, is: '14px'}, |
| 35 {at: 1.5, is: '19px'}, | 91 {at: 1.5, is: '19px'}, |
| 36 ]); | 92 ]); |
| 37 assertInterpolation({ | |
| 38 property: 'font-size', | |
| 39 from: 'inherit', | |
| 40 to: '20px' | |
| 41 }, [ | |
| 42 {at: -2, is: '0px'}, // CSS font-size can't be negative. | |
| 43 {at: -0.3, is: '7px'}, | |
| 44 {at: 0, is: '10px'}, | |
| 45 {at: 0.3, is: '13px'}, | |
| 46 {at: 0.6, is: '16px'}, | |
| 47 {at: 1, is: '20px'}, | |
| 48 {at: 1.5, is: '25px'}, | |
| 49 ]); | |
| 50 </script> | 93 </script> |
| 51 </body> | 94 </body> |
| OLD | NEW |