|
18 | 18 | inherits: false;
|
19 | 19 | }
|
20 | 20 | @property --valid-whitespace {
|
21 |
| - syntax: " <color>+ "; |
| 21 | + syntax: " <color># "; |
22 | 22 | inherits: false;
|
23 | 23 | initial-value: red, blue;
|
24 | 24 | }
|
|
38 | 38 | syntax: "<color> | none";
|
39 | 39 | initial-value: red;
|
40 | 40 | }
|
41 |
| - @property --no-initial-value { |
| 41 | + @property --no-initial-color-value { |
42 | 42 | syntax: "<color> | none";
|
43 | 43 | inherits: false;
|
44 | 44 | }
|
| 45 | + @property --no-initial-universal-value { |
| 46 | + syntax: "*"; |
| 47 | + inherits: false; |
| 48 | + } |
45 | 49 | @property --syntax-only {
|
46 | 50 | syntax: "<color> | none";
|
47 | 51 | }
|
|
52 | 56 | initial-value: red;
|
53 | 57 | }
|
54 | 58 | /* U+0009 CHARACTER TABULATION */
|
55 |
| - @property --tab\9 tab { } |
| 59 | + @property --tab\9 tab { |
| 60 | + syntax: "*"; |
| 61 | + inherits: true; |
| 62 | + } |
56 | 63 | </style>
|
57 | 64 | <script>
|
58 | 65 |
|
|
66 | 73 | return null;
|
67 | 74 | }
|
68 | 75 |
|
| 76 | +function test_invalid(name) { |
| 77 | + test(() => { |
| 78 | + let rule = find_at_property_rule(name); |
| 79 | + assert_true(!rule); |
| 80 | + }, `Rule for ${name} is invalid`); |
| 81 | +} |
| 82 | + |
69 | 83 | function test_css_text(name, expected) {
|
70 | 84 | test(() => {
|
71 | 85 | let rule = find_at_property_rule(name);
|
|
106 | 120 | }, `Rule for ${name} returns expected value for CSSPropertyRule.initialValue`);
|
107 | 121 | }
|
108 | 122 |
|
| 123 | +// Invalid @property rules. |
| 124 | +test_invalid('--no-descriptors'); |
| 125 | +test_invalid('--no-syntax'); |
| 126 | +test_invalid('--no-inherits'); |
| 127 | +test_invalid('--no-initial-color-value'); |
| 128 | +test_invalid('--syntax-only', '@property --syntax-only { syntax: "<color> | none"; }'); |
| 129 | +test_invalid('--inherits-only', '@property --inherits-only { inherits: true; }'); |
| 130 | +test_invalid('--initial-value-only', '@property --initial-value-only { initial-value: red; }'); |
| 131 | + |
109 | 132 | // CSSPropertyRule.cssText
|
110 | 133 |
|
111 | 134 | test_css_text('--valid', '@property --valid { syntax: "<color> | none"; inherits: false; initial-value: red; }');
|
112 | 135 | test_css_text('--valid-reverse', '@property --valid-reverse { syntax: "<length>"; inherits: true; initial-value: 0px; }');
|
113 | 136 | test_css_text('--valid-universal', '@property --valid-universal { syntax: "*"; inherits: false; }');
|
114 |
| -test_css_text('--valid-whitespace', '@property --valid-whitespace { syntax: " <color>+ "; inherits: false; initial-value: red, blue; }'); |
| 137 | +test_css_text('--valid-whitespace', '@property --valid-whitespace { syntax: " <color># "; inherits: false; initial-value: red, blue; }'); |
115 | 138 | test_css_text('--vALId', '@property --vALId { syntax: "<color> | none"; inherits: false; initial-value: red; }');
|
116 | 139 |
|
117 |
| -test_css_text('--no-descriptors', '@property --no-descriptors { }'); |
118 |
| -test_css_text('--no-syntax', '@property --no-syntax { inherits: false; initial-value: red; }'); |
119 |
| -test_css_text('--no-inherits', '@property --no-inherits { syntax: "<color> | none"; initial-value: red; }'); |
120 |
| -test_css_text('--no-initial-value', '@property --no-initial-value { syntax: "<color> | none"; inherits: false; }'); |
121 |
| -test_css_text('--syntax-only', '@property --syntax-only { syntax: "<color> | none"; }'); |
122 |
| -test_css_text('--inherits-only', '@property --inherits-only { inherits: true; }'); |
123 |
| -test_css_text('--initial-value-only', '@property --initial-value-only { initial-value: red; }'); |
124 |
| -test_css_text('--tab\ttab', '@property --tab\\9 tab { }'); |
| 140 | +test_css_text('--no-initial-universal-value', '@property --no-initial-universal-value { syntax: "*"; inherits: false; }'); |
| 141 | + |
| 142 | +test_css_text('--tab\ttab', '@property --tab\\9 tab { syntax: "*"; inherits: true; }'); |
125 | 143 |
|
126 | 144 | // CSSRule.type
|
127 | 145 |
|
|
138 | 156 | test_name('--valid-whitespace');
|
139 | 157 | test_name('--vALId');
|
140 | 158 |
|
141 |
| -test_name('--no-descriptors'); |
142 |
| -test_name('--no-syntax'); |
143 |
| -test_name('--no-inherits'); |
144 |
| -test_name('--no-initial-value'); |
145 |
| -test_name('--syntax-only'); |
146 |
| -test_name('--inherits-only'); |
147 |
| -test_name('--initial-value-only'); |
| 159 | +test_name('--no-initial-universal-value'); |
148 | 160 |
|
149 | 161 | // CSSPropertyRule.syntax
|
150 | 162 |
|
151 | 163 | test_syntax('--valid', '<color> | none');
|
152 | 164 | test_syntax('--valid-reverse', '<length>');
|
153 | 165 | test_syntax('--valid-universal', '*');
|
154 |
| -test_syntax('--valid-whitespace', ' <color>+ '); |
| 166 | +test_syntax('--valid-whitespace', ' <color># '); |
155 | 167 | test_syntax('--vALId', '<color> | none');
|
156 | 168 |
|
157 |
| -test_syntax('--no-descriptors', ''); |
158 |
| -test_syntax('--no-syntax', ''); |
159 |
| -test_syntax('--no-inherits', '<color> | none'); |
160 |
| -test_syntax('--no-initial-value', '<color> | none'); |
161 |
| -test_syntax('--syntax-only', '<color> | none'); |
162 |
| -test_syntax('--inherits-only', ''); |
163 |
| -test_syntax('--initial-value-only', ''); |
| 169 | +test_syntax('--no-initial-universal-value', '*'); |
164 | 170 |
|
165 | 171 | // CSSPropertyRule.inherits
|
166 | 172 |
|
|
170 | 176 | test_inherits('--valid-whitespace', false);
|
171 | 177 | test_inherits('--vALId', false);
|
172 | 178 |
|
173 |
| -test_inherits('--no-descriptors', false); |
174 |
| -test_inherits('--no-syntax', false); |
175 |
| -test_inherits('--no-inherits', false); |
176 |
| -test_inherits('--no-initial-value', false); |
177 |
| -test_inherits('--syntax-only', false); |
178 |
| -test_inherits('--inherits-only', true); |
179 |
| -test_inherits('--initial-value-only', false); |
| 179 | +test_inherits('--no-initial-universal-value', false); |
180 | 180 |
|
181 | 181 | // CSSPropertyRule.initialValue
|
182 | 182 |
|
|
186 | 186 | test_initial_value('--valid-whitespace', 'red, blue');
|
187 | 187 | test_initial_value('--vALId', 'red');
|
188 | 188 |
|
189 |
| -test_initial_value('--no-descriptors', null); |
190 |
| -test_initial_value('--no-syntax', 'red'); |
191 |
| -test_initial_value('--no-inherits', 'red'); |
192 |
| -test_initial_value('--no-initial-value', null); |
193 |
| -test_initial_value('--syntax-only', null); |
194 |
| -test_initial_value('--inherits-only', null); |
195 |
| -test_initial_value('--initial-value-only', 'red'); |
| 189 | +test_initial_value('--no-initial-universal-value', null); |
196 | 190 |
|
197 | 191 | </script>
|
0 commit comments