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 <script> | 4 <script> |
5 test_count = 0; | 5 test_count = 0; |
6 | 6 |
7 function assert_valid(syntax, initialValue) { | 7 function assert_valid(syntax, initialValue) { |
8 // No actual assertions, this just shouldn't throw | 8 // No actual assertions, this just shouldn't throw |
9 test(function() { | 9 test(function() { |
10 var name = '--syntax-test-' + (test_count++); | 10 var name = '--syntax-test-' + (test_count++); |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 assert_valid("*", "a"); | 23 assert_valid("*", "a"); |
24 assert_valid(" * ", "b"); | 24 assert_valid(" * ", "b"); |
25 assert_valid("<length>", "2px"); | 25 assert_valid("<length>", "2px"); |
26 assert_valid(" <number>", "5"); | 26 assert_valid(" <number>", "5"); |
27 assert_valid("<percentage> ", "10%"); | 27 assert_valid("<percentage> ", "10%"); |
28 assert_valid("<color>+", "red"); | 28 assert_valid("<color>+", "red"); |
29 assert_valid(" <length>+ | <percentage>", "2px 8px"); | 29 assert_valid(" <length>+ | <percentage>", "2px 8px"); |
30 assert_valid("<length>|<percentage>|<length-percentage>", "2px"); // Valid but s
illy | 30 assert_valid("<length>|<percentage>|<length-percentage>", "2px"); // Valid but s
illy |
31 assert_valid("<color> | <image> | <url> | <integer> | <angle>", "red"); | 31 assert_valid("<color> | <image> | <url> | <integer> | <angle>", "red"); |
32 assert_valid("<time> | <resolution> | <transform-function> | <custom-ident>", "r
ed"); | 32 assert_valid("<time> | <resolution> | <transform-list> | <custom-ident>", "red")
; |
33 | 33 |
34 assert_valid("*", ":> hello"); | 34 assert_valid("*", ":> hello"); |
35 assert_valid("*", "([ brackets ]) { yay (??)}"); | 35 assert_valid("*", "([ brackets ]) { yay (??)}"); |
36 assert_valid("*", "yep 'this is valid too'"); | 36 assert_valid("*", "yep 'this is valid too'"); |
37 assert_valid("*", "unmatched opening bracket is valid :("); | 37 assert_valid("*", "unmatched opening bracket is valid :("); |
38 assert_valid("*", '"'); | 38 assert_valid("*", '"'); |
39 | 39 |
40 assert_valid("<length>", "0"); | 40 assert_valid("<length>", "0"); |
41 assert_valid("<length>", "10px /*:)*/"); | 41 assert_valid("<length>", "10px /*:)*/"); |
42 assert_valid("<length>", " calc(-2px)"); | 42 assert_valid("<length>", " calc(-2px)"); |
(...skipping 12 matching lines...) Expand all Loading... |
55 assert_valid("<integer>", "19"); | 55 assert_valid("<integer>", "19"); |
56 | 56 |
57 assert_valid("<angle>", "10deg"); | 57 assert_valid("<angle>", "10deg"); |
58 assert_valid("<angle>", "20.5rad"); | 58 assert_valid("<angle>", "20.5rad"); |
59 assert_valid("<angle>", "calc(50grad + 3.14159rad)"); | 59 assert_valid("<angle>", "calc(50grad + 3.14159rad)"); |
60 assert_valid("<time>", "2s"); | 60 assert_valid("<time>", "2s"); |
61 assert_valid("<time>", "calc(2s - 9ms)"); | 61 assert_valid("<time>", "calc(2s - 9ms)"); |
62 assert_valid("<resolution>", "10dpi"); | 62 assert_valid("<resolution>", "10dpi"); |
63 assert_valid("<resolution>", "3dPpX"); | 63 assert_valid("<resolution>", "3dPpX"); |
64 assert_valid("<resolution>", "-5.3dpcm"); | 64 assert_valid("<resolution>", "-5.3dpcm"); |
65 assert_valid("<transform-function>", "scale(2)"); | 65 assert_valid("<transform-list>", "scale(2)"); |
66 assert_valid("<transform-function>+", "translateX(2px) rotate(20deg)"); | 66 assert_valid("<transform-list>", "translateX(2px) rotate(20deg)"); |
67 | 67 |
68 assert_valid("<color>", "rgb(12, 34, 56)"); | 68 assert_valid("<color>", "rgb(12, 34, 56)"); |
69 assert_valid("<color>", "lightgoldenrodyellow"); | 69 assert_valid("<color>", "lightgoldenrodyellow"); |
70 assert_valid("<image>", "url(a)"); | 70 assert_valid("<image>", "url(a)"); |
71 assert_valid("<image>", "linear-gradient(yellow, blue)"); | 71 assert_valid("<image>", "linear-gradient(yellow, blue)"); |
72 assert_valid("<url>", "url(a)"); | 72 assert_valid("<url>", "url(a)"); |
73 | 73 |
74 assert_valid("banana", "banana"); | 74 assert_valid("banana", "banana"); |
75 assert_valid("bAnAnA", "bAnAnA"); | 75 assert_valid("bAnAnA", "bAnAnA"); |
76 assert_valid("ba-na-nya", "ba-na-nya"); | 76 assert_valid("ba-na-nya", "ba-na-nya"); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 assert_invalid("<length-percentage>", "calc(2px + 10% + 7ex)"); | 143 assert_invalid("<length-percentage>", "calc(2px + 10% + 7ex)"); |
144 assert_invalid("<percentage>", "0"); | 144 assert_invalid("<percentage>", "0"); |
145 assert_invalid("<integer>", "1.0"); | 145 assert_invalid("<integer>", "1.0"); |
146 assert_invalid("<integer>", "1e0"); | 146 assert_invalid("<integer>", "1e0"); |
147 assert_invalid("<number>|foo", "foo var(--foo, bla)"); | 147 assert_invalid("<number>|foo", "foo var(--foo, bla)"); |
148 | 148 |
149 assert_invalid("<angle>", "0"); | 149 assert_invalid("<angle>", "0"); |
150 assert_invalid("<angle>", "10%"); | 150 assert_invalid("<angle>", "10%"); |
151 assert_invalid("<time>", "2px"); | 151 assert_invalid("<time>", "2px"); |
152 assert_invalid("<resolution>", "10"); | 152 assert_invalid("<resolution>", "10"); |
153 assert_invalid("<transform-function>", "scale()"); | 153 assert_invalid("<transform-list>", "scale()"); |
| 154 assert_invalid("<transform-list>+", "translateX(2px) rotate(20deg)"); |
154 assert_invalid("<color>", "fancy-looking"); | 155 assert_invalid("<color>", "fancy-looking"); |
155 assert_invalid("<image>", "banana.png"); | 156 assert_invalid("<image>", "banana.png"); |
156 assert_invalid("<url>", "banana.png"); | 157 assert_invalid("<url>", "banana.png"); |
157 </script> | 158 </script> |
OLD | NEW |