Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/LayoutTests/typedcssom/cssPerspective.html

Issue 2939273003: [CSS Typed OM] Make the attributes of CSSPerspective mutable. (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(() => { 7 test(() => {
8 let percentValue = new CSSUnitValue(10, 'percent'); 8 let percentValue = new CSSUnitValue(10, 'percent');
9 let angleValue = new CSSUnitValue(20, 'deg'); 9 let angleValue = new CSSUnitValue(20, 'deg');
10 assert_throws(new TypeError(), () => { new CSSPerspective(percentValue) }); 10 assert_throws(new TypeError(), () => { new CSSPerspective(percentValue) });
11 assert_throws(new TypeError(), () => { new CSSPerspective(angleValue) }); 11 assert_throws(new TypeError(), () => { new CSSPerspective(angleValue) });
12 }, "Constructor should throw an error for invalid CSSUnitValues"); 12 }, "Constructor should throw an error for invalid CSSUnitValues");
13 13
14 test(function() { 14 test(() => {
15 var simpleLength = new CSSUnitValue(10, 'percent'); 15 let perspective = new CSSPerspective(new CSSUnitValue(1, 'px'));
16 assert_throws(new TypeError(), function() { new CSSPerspective(simpleLength) } ); 16 assert_equals(perspective.length.value, 1);
17 }, "Constructor should throw an error for CSSUnitValues with a percentage type") ; 17 assert_equals(perspective.length.unit, 'px');
18 18
19 test(function() { 19 perspective.length = new CSSUnitValue(2, 'in');
20 var perspectiveTransformSimple = new CSSPerspective( 20 assert_equals(perspective.length.value, 2);
21 new CSSUnitValue(10, 'px')); 21 assert_equals(perspective.length.unit, 'in');
22 assert_equals(perspectiveTransformSimple.toString(), 'perspective(10px)'); 22 }, "Setting length with valid values.");
23 }, "toString should return perspective(<CSSUnitValue.cssString()>)"); 23
24 test(() => {
25 let perspective = new CSSPerspective(new CSSUnitValue(1, 'px'));
26 let percentUnit = new CSSUnitValue(2, 'percent');
27 assert_throws(new TypeError(), () => { perspective.length = percentUnit; })
28 }, "Setting length with invalid values.");
29
30 test(() => {
31 let perspective = new CSSPerspective(new CSSUnitValue(10, 'px'));
32
33 assert_equals(perspective.toString(), 'perspective(10px)');
34 }, "toString should return perspective(<CSSNumericValue.cssString()>)");
24 35
25 </script> 36 </script>
26 37
27 <body>
28 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698