| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <div id='container'> | 5 <div id='container'> |
| 6 <div id='element'></div> | 6 <div id='element'></div> |
| 7 </div> | 7 </div> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 var element = document.getElementById('element'); | 10 var element = document.getElementById('element'); |
| 11 var container = document.getElementById('container'); | 11 var container = document.getElementById('container'); |
| 12 | 12 |
| 13 test(function() { | 13 test(function() { |
| 14 element.style.fontSize = '10px'; | 14 element.style.fontSize = '10px'; |
| 15 container.style.width = '1000px'; | 15 container.style.width = '1000px'; |
| 16 var player = element.animate([{left: 'calc(100px + 80%)'}, {left: '10em'}],
10); | 16 var player = element.animate([{left: 'calc(100px + 80%)'}, {left: '10em'}],
10); |
| 17 player.pause(); | 17 player.pause(); |
| 18 player.currentTime = 5; | 18 player.currentTime = 5; |
| 19 assert_equals(getComputedStyle(element).left, '500px'); | 19 assert_equals(getComputedStyle(element).left, 'calc(100px + 40%)'); |
| 20 element.style.fontSize = '20px'; | 20 element.style.fontSize = '20px'; |
| 21 assert_equals(getComputedStyle(element).left, '550px'); | 21 assert_equals(getComputedStyle(element).left, 'calc(150px + 40%)'); |
| 22 container.style.width = '500px'; | 22 container.style.width = '500px'; |
| 23 assert_equals(getComputedStyle(element).left, '350px'); | 23 assert_equals(getComputedStyle(element).left, 'calc(150px + 40%)'); |
| 24 }, 'Lengths responsive to style changes'); | 24 }, 'Lengths responsive to style changes'); |
| 25 | 25 |
| 26 test(function() { | 26 test(function() { |
| 27 container.style.width = '1000px'; | 27 container.style.width = '1000px'; |
| 28 var player = element.animate([{paddingTop: '30%'}, {paddingTop: '50%'}], 10)
; | 28 var player = element.animate([{paddingTop: '30%'}, {paddingTop: '50%'}], 10)
; |
| 29 player.pause(); | 29 player.pause(); |
| 30 player.currentTime = 5; | 30 player.currentTime = 5; |
| 31 container.style.width = '700px'; | 31 container.style.width = '700px'; |
| 32 assert_equals(getComputedStyle(element).paddingTop, '280px'); | 32 assert_equals(getComputedStyle(element).paddingTop, '280px'); |
| 33 }, 'Percentages responsive to width style changes'); | 33 }, 'Percentages responsive to width style changes'); |
| 34 | 34 |
| 35 test(function() { | 35 test(function() { |
| 36 element.style.fontSize = '1px'; | 36 element.style.fontSize = '1px'; |
| 37 var player = element.animate([{lineHeight: '9'}, {lineHeight: '13'}], 10); | 37 var player = element.animate([{lineHeight: '9'}, {lineHeight: '13'}], 10); |
| 38 player.pause(); | 38 player.pause(); |
| 39 player.currentTime = 2.5; | 39 player.currentTime = 2.5; |
| 40 element.style.fontSize = '7px'; | 40 element.style.fontSize = '7px'; |
| 41 assert_equals(getComputedStyle(element).lineHeight, '70px'); | 41 assert_equals(getComputedStyle(element).lineHeight, '70px'); |
| 42 }, 'Numbers responsive to style changes'); | 42 }, 'Numbers responsive to style changes'); |
| 43 | 43 |
| 44 </script> | 44 </script> |
| OLD | NEW |