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 <script> | 5 <script> |
6 | 6 |
7 test(function() { | 7 test(function() { |
8 var calcLength = new CSSCalcValue({px: 10, percent: 3.2}); | 8 var calcLength = new CSSCalcValue({px: 10, percent: 3.2}); |
9 assert_throws(null, function() { new CSSPerspective(calcLength) }); | 9 assert_throws(null, function() { new CSSPerspective(calcLength) }); |
10 }, "Constructor should throw an error for CSSCalcValues with a percentage type")
; | 10 }, "Constructor should throw an error for CSSCalcValues with a percentage type")
; |
11 | 11 |
12 test(function() { | 12 test(function() { |
13 var simpleLength = new CSSUnitValue(10, 'percent'); | 13 var simpleLength = new CSSUnitValue(10, 'percent'); |
14 assert_throws(null, function() { new CSSPerspective(simpleLength) }); | 14 assert_throws(new TypeError(), function() { new CSSPerspective(simpleLength) }
); |
15 }, "Constructor should throw an error for CSSUnitValues with a percentage type")
; | 15 }, "Constructor should throw an error for CSSUnitValues with a percentage type")
; |
16 | 16 |
17 test(function() { | 17 test(function() { |
18 var simpleLength = new CSSUnitValue(10, 'px'); | 18 var simpleLength = new CSSUnitValue(10, 'px'); |
19 var calcLength = new CSSCalcValue({px: 10, em: 3.2}); | 19 var calcLength = new CSSCalcValue({px: 10, em: 3.2}); |
20 var perspectiveTransformSimple = new CSSPerspective(simpleLength); | 20 var perspectiveTransformSimple = new CSSPerspective(simpleLength); |
21 var perspectiveTransformCalc = new CSSPerspective(calcLength); | 21 var perspectiveTransformCalc = new CSSPerspective(calcLength); |
22 | 22 |
23 assert_equals(perspectiveTransformSimple.toString(), 'perspective(10px)'); | 23 assert_equals(perspectiveTransformSimple.toString(), 'perspective(10px)'); |
24 assert_equals(perspectiveTransformCalc.toString(), 'perspective(calc(3.2em + 1
0px))'); | 24 assert_equals(perspectiveTransformCalc.toString(), 'perspective(calc(3.2em + 1
0px))'); |
25 }, "toString should return a string of form perspective(<CSSLengthValue.cssStrin
g()>)"); | 25 }, "toString should return a string of form perspective(<CSSLengthValue.cssStrin
g()>)"); |
26 | 26 |
27 </script> | 27 </script> |
28 | 28 |
29 <body> | 29 <body> |
30 </body> | 30 </body> |
OLD | NEW |