Skip to content

Commit d0599ce

Browse files
committed
Add specs for attribute selectors with modifiers
See sass/dart-sass#656
1 parent 8b93fd1 commit d0599ce

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

spec/css/selector.hrx

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,49 @@
1212
x: y;
1313
}
1414

15+
<===>
16+
================================================================================
17+
<===> attribute/modifier/unknown/options.yml
18+
---
19+
:todo:
20+
- libsass # sass/libsass#2886
21+
22+
<===> attribute/modifier/unknown/input.scss
23+
// At time of writing, only the modifiers "i" and "s" are allowed by the CSS
24+
// spec. However, for forwards-compatibility with future CSS additions, any
25+
// single character should be allowed.
26+
[a=b c] {d: e}
27+
28+
<===> attribute/modifier/unknown/output.css
29+
[a=b c] {
30+
d: e;
31+
}
32+
33+
<===>
34+
================================================================================
35+
<===> attribute/modifier/caps/input.scss
36+
[a=b I] {c: d}
37+
38+
<===> attribute/modifier/caps/output.css
39+
[a=b I] {
40+
c: d;
41+
}
42+
43+
<===>
44+
================================================================================
45+
<===> attribute/modifier/after_string/input.scss
46+
[a="b"i] {c: d}
47+
48+
<===> attribute/modifier/after_string/output.css
49+
[a=b i] {
50+
c: d;
51+
}
52+
53+
<===> attribute/modifier/after_string/output-libsass.css
54+
[a="b" i] {
55+
c: d;
56+
}
57+
1558
<===>
1659
================================================================================
1760
<===> reference_combinator/options.yml
@@ -57,3 +100,107 @@ Error: expected selector.
57100
::slotted(.f, ::slotted(.g)) {
58101
x: y;
59102
}
103+
104+
<===>
105+
================================================================================
106+
<===> error/attribute/modifier/no_operator/input.scss
107+
[a b] {c: d}
108+
109+
<===> error/attribute/modifier/no_operator/error
110+
Error: Expected "]".
111+
,
112+
1 | [a b]{c: d}
113+
| ^
114+
'
115+
input.scss 1:4 root stylesheet
116+
117+
<===> error/attribute/modifier/no_operator/error-libsass
118+
Error: invalid operator in attribute selector for a
119+
on line 1:2 of input.scss
120+
>> [a b] {c: d}
121+
122+
-^
123+
124+
<===>
125+
================================================================================
126+
<===> error/attribute/modifier/too_long/input.scss
127+
// Attribute modifiers must be single characters.
128+
[a=b cd] {e: f}
129+
130+
<===> error/attribute/modifier/too_long/error
131+
Error: expected "]".
132+
,
133+
2 | [a=b cd]{e: f}
134+
| ^
135+
'
136+
input.scss 2:7 root stylesheet
137+
138+
<===> error/attribute/modifier/too_long/error-libsass
139+
Error: unterminated attribute selector for a
140+
on line 2:4 of input.scss
141+
>> [a=b cd] {e: f}
142+
143+
---^
144+
145+
<===>
146+
================================================================================
147+
<===> error/attribute/modifier/underscore/input.scss
148+
// Attribute modifiers must be ASCII alphabetical characters.
149+
[a=b _] {c: d}
150+
151+
<===> error/attribute/modifier/underscore/error
152+
Error: expected "]".
153+
,
154+
2 | [a=b _]{c: d}
155+
| ^
156+
'
157+
input.scss 2:6 root stylesheet
158+
159+
<===> error/attribute/modifier/underscore/error-libsass
160+
Error: unterminated attribute selector for a
161+
on line 2:4 of input.scss
162+
>> [a=b _] {c: d}
163+
164+
---^
165+
166+
<===>
167+
================================================================================
168+
<===> error/attribute/modifier/digit/input.scss
169+
// Attribute modifiers must be ASCII alphabetical characters.
170+
[a=b 1] {c: d}
171+
172+
<===> error/attribute/modifier/digit/error
173+
Error: expected "]".
174+
,
175+
2 | [a=b 1]{c: d}
176+
| ^
177+
'
178+
input.scss 2:6 root stylesheet
179+
180+
<===> error/attribute/modifier/digit/error-libsass
181+
Error: unterminated attribute selector for a
182+
on line 2:4 of input.scss
183+
>> [a=b 1] {c: d}
184+
185+
---^
186+
187+
<===>
188+
================================================================================
189+
<===> error/attribute/modifier/unicode/input.scss
190+
// Attribute modifiers must be ASCII alphabetical characters.
191+
[a=b ï] {c: d}
192+
193+
<===> error/attribute/modifier/unicode/error
194+
Error: expected "]".
195+
,
196+
2 | [a=b ï]{c: d}
197+
| ^
198+
'
199+
input.scss 2:6 root stylesheet
200+
201+
<===> error/attribute/modifier/unicode/error-libsass
202+
Error: unterminated attribute selector for a
203+
on line 2:4 of input.scss
204+
>> [a=b ï] {c: d}
205+
206+
---^

0 commit comments

Comments
 (0)