scss-lint 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/default.yml +19 -1
- data/data/properties.txt +4 -0
- data/lib/scss_lint.rb +1 -0
- data/lib/scss_lint/cli.rb +4 -42
- data/lib/scss_lint/config.rb +1 -45
- data/lib/scss_lint/control_comment_processor.rb +47 -15
- data/lib/scss_lint/file_finder.rb +57 -0
- data/lib/scss_lint/linter/bang_format.rb +1 -1
- data/lib/scss_lint/linter/border_zero.rb +25 -9
- data/lib/scss_lint/linter/color_keyword.rb +3 -13
- data/lib/scss_lint/linter/color_variable.rb +36 -0
- data/lib/scss_lint/linter/declaration_order.rb +2 -2
- data/lib/scss_lint/linter/important_rule.rb +12 -0
- data/lib/scss_lint/linter/indentation.rb +7 -1
- data/lib/scss_lint/linter/property_count.rb +44 -0
- data/lib/scss_lint/linter/property_sort_order.rb +73 -19
- data/lib/scss_lint/linter/string_quotes.rb +9 -0
- data/lib/scss_lint/linter/variable_for_property.rb +20 -0
- data/lib/scss_lint/linter/vendor_prefixes.rb +3 -3
- data/lib/scss_lint/runner.rb +5 -7
- data/lib/scss_lint/utils.rb +34 -0
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/cli_spec.rb +1 -1
- data/spec/scss_lint/config_spec.rb +4 -203
- data/spec/scss_lint/engine_spec.rb +4 -4
- data/spec/scss_lint/file_finder_spec.rb +110 -0
- data/spec/scss_lint/linter/bang_format_spec.rb +28 -18
- data/spec/scss_lint/linter/border_zero_spec.rb +50 -16
- data/spec/scss_lint/linter/color_keyword_spec.rb +16 -16
- data/spec/scss_lint/linter/color_variable_spec.rb +102 -0
- data/spec/scss_lint/linter/comment_spec.rb +9 -9
- data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +10 -10
- data/spec/scss_lint/linter/debug_statement_spec.rb +4 -4
- data/spec/scss_lint/linter/declaration_order_spec.rb +80 -80
- data/spec/scss_lint/linter/duplicate_property_spec.rb +30 -30
- data/spec/scss_lint/linter/else_placement_spec.rb +16 -16
- data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +38 -38
- data/spec/scss_lint/linter/empty_rule_spec.rb +4 -4
- data/spec/scss_lint/linter/final_newline_spec.rb +6 -6
- data/spec/scss_lint/linter/hex_length_spec.rb +16 -16
- data/spec/scss_lint/linter/hex_notation_spec.rb +16 -16
- data/spec/scss_lint/linter/hex_validation_spec.rb +6 -6
- data/spec/scss_lint/linter/id_selector_spec.rb +10 -10
- data/spec/scss_lint/linter/import_path_spec.rb +45 -45
- data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
- data/spec/scss_lint/linter/indentation_spec.rb +103 -43
- data/spec/scss_lint/linter/leading_zero_spec.rb +45 -45
- data/spec/scss_lint/linter/mergeable_selector_spec.rb +32 -32
- data/spec/scss_lint/linter/name_format_spec.rb +75 -41
- data/spec/scss_lint/linter/nesting_depth_spec.rb +14 -14
- data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +12 -12
- data/spec/scss_lint/linter/property_count_spec.rb +104 -0
- data/spec/scss_lint/linter/property_sort_order_spec.rb +138 -48
- data/spec/scss_lint/linter/property_spelling_spec.rb +14 -14
- data/spec/scss_lint/linter/qualifying_element_spec.rb +26 -26
- data/spec/scss_lint/linter/selector_depth_spec.rb +26 -26
- data/spec/scss_lint/linter/selector_format_spec.rb +114 -114
- data/spec/scss_lint/linter/shorthand_spec.rb +32 -32
- data/spec/scss_lint/linter/single_line_per_property_spec.rb +10 -10
- data/spec/scss_lint/linter/single_line_per_selector_spec.rb +24 -24
- data/spec/scss_lint/linter/space_after_comma_spec.rb +60 -60
- data/spec/scss_lint/linter/space_after_property_colon_spec.rb +44 -44
- data/spec/scss_lint/linter/space_after_property_name_spec.rb +6 -6
- data/spec/scss_lint/linter/space_before_brace_spec.rb +119 -119
- data/spec/scss_lint/linter/space_between_parens_spec.rb +48 -48
- data/spec/scss_lint/linter/string_quotes_spec.rb +74 -62
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +53 -54
- data/spec/scss_lint/linter/trailing_zero_spec.rb +34 -34
- data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +10 -10
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +18 -18
- data/spec/scss_lint/linter/url_format_spec.rb +4 -4
- data/spec/scss_lint/linter/url_quotes_spec.rb +14 -14
- data/spec/scss_lint/linter/variable_for_property_spec.rb +115 -0
- data/spec/scss_lint/linter/vendor_prefixes_spec.rb +66 -56
- data/spec/scss_lint/linter/zero_unit_spec.rb +22 -22
- data/spec/scss_lint/linter_spec.rb +72 -28
- data/spec/scss_lint/runner_spec.rb +0 -1
- data/spec/scss_lint/selector_visitor_spec.rb +23 -23
- data/spec/spec_helper.rb +2 -2
- metadata +27 -12
@@ -2,111 +2,111 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::ZeroUnit do
|
4
4
|
context 'when no properties exist' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
}
|
8
|
-
|
8
|
+
SCSS
|
9
9
|
|
10
10
|
it { should_not report_lint }
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'when properties with unit-less zeros exist' do
|
14
|
-
let(:
|
14
|
+
let(:scss) { <<-SCSS }
|
15
15
|
p {
|
16
16
|
margin: 0;
|
17
17
|
}
|
18
|
-
|
18
|
+
SCSS
|
19
19
|
|
20
20
|
it { should_not report_lint }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when properties with non-zero values exist' do
|
24
|
-
let(:
|
24
|
+
let(:scss) { <<-SCSS }
|
25
25
|
p {
|
26
26
|
margin: 5px;
|
27
27
|
line-height: 1.5em;
|
28
28
|
}
|
29
|
-
|
29
|
+
SCSS
|
30
30
|
|
31
31
|
it { should_not report_lint }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'when properties with zero values contain units' do
|
35
|
-
let(:
|
35
|
+
let(:scss) { <<-SCSS }
|
36
36
|
p {
|
37
37
|
margin: 0px;
|
38
38
|
}
|
39
|
-
|
39
|
+
SCSS
|
40
40
|
|
41
41
|
it { should report_lint line: 2 }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when properties with multiple zero values containing units exist' do
|
45
|
-
let(:
|
45
|
+
let(:scss) { <<-SCSS }
|
46
46
|
p {
|
47
47
|
margin: 5em 0em 2em 0px;
|
48
48
|
}
|
49
|
-
|
49
|
+
SCSS
|
50
50
|
|
51
51
|
it { should report_lint line: 2, count: 2 }
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'when function call contains a zero value with units' do
|
55
|
-
let(:
|
55
|
+
let(:scss) { <<-SCSS }
|
56
56
|
p {
|
57
57
|
margin: some-function(0em);
|
58
58
|
}
|
59
|
-
|
59
|
+
SCSS
|
60
60
|
|
61
61
|
it { should report_lint line: 2 }
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'when mixin include contains a zero value with units' do
|
65
|
-
let(:
|
65
|
+
let(:scss) { <<-SCSS }
|
66
66
|
p {
|
67
67
|
@include some-mixin(0em);
|
68
68
|
}
|
69
|
-
|
69
|
+
SCSS
|
70
70
|
|
71
71
|
it { should report_lint line: 2 }
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'when string contains a zero value with units' do
|
75
|
-
let(:
|
75
|
+
let(:scss) { <<-SCSS }
|
76
76
|
p {
|
77
77
|
content: func("0em");
|
78
78
|
}
|
79
|
-
|
79
|
+
SCSS
|
80
80
|
|
81
81
|
it { should_not report_lint }
|
82
82
|
end
|
83
83
|
|
84
84
|
context 'when property value has a ".0" fractional component' do
|
85
|
-
let(:
|
85
|
+
let(:scss) { <<-SCSS }
|
86
86
|
p {
|
87
87
|
margin: 4.0em;
|
88
88
|
}
|
89
|
-
|
89
|
+
SCSS
|
90
90
|
|
91
91
|
it { should_not report_lint }
|
92
92
|
end
|
93
93
|
|
94
94
|
context 'when property value has a color hex with a leading 0' do
|
95
|
-
let(:
|
95
|
+
let(:scss) { <<-SCSS }
|
96
96
|
p {
|
97
97
|
color: #0af;
|
98
98
|
}
|
99
|
-
|
99
|
+
SCSS
|
100
100
|
|
101
101
|
it { should_not report_lint }
|
102
102
|
end
|
103
103
|
|
104
104
|
context 'when property with zero value is a dimension' do
|
105
|
-
let(:
|
105
|
+
let(:scss) { <<-SCSS }
|
106
106
|
p {
|
107
107
|
transition-delay: 0s;
|
108
108
|
}
|
109
|
-
|
109
|
+
SCSS
|
110
110
|
|
111
111
|
it { should_not report_lint }
|
112
112
|
end
|
@@ -12,6 +12,11 @@ describe SCSSLint::Linter do
|
|
12
12
|
add_lint(node, 'everything offends me')
|
13
13
|
end
|
14
14
|
|
15
|
+
def visit_class(klass)
|
16
|
+
return unless klass.to_s == '.badClass'
|
17
|
+
add_lint(klass, 'a bad class was used')
|
18
|
+
end
|
19
|
+
|
15
20
|
# Bypasses the visit order so a control comment might not be reached before a lint is
|
16
21
|
# added
|
17
22
|
def visit_rule(node)
|
@@ -28,7 +33,7 @@ describe SCSSLint::Linter do
|
|
28
33
|
end
|
29
34
|
|
30
35
|
context 'when a disable is not present' do
|
31
|
-
let(:
|
36
|
+
let(:scss) { <<-SCSS }
|
32
37
|
p {
|
33
38
|
border: fail1;
|
34
39
|
|
@@ -36,13 +41,13 @@ describe SCSSLint::Linter do
|
|
36
41
|
border: fail1;
|
37
42
|
}
|
38
43
|
}
|
39
|
-
|
44
|
+
SCSS
|
40
45
|
|
41
46
|
it { should report_lint }
|
42
47
|
end
|
43
48
|
|
44
49
|
context 'when a disable is present at the top level' do
|
45
|
-
let(:
|
50
|
+
let(:scss) { <<-SCSS }
|
46
51
|
// scss-lint:disable Fake
|
47
52
|
p {
|
48
53
|
border: fail1;
|
@@ -51,13 +56,13 @@ describe SCSSLint::Linter do
|
|
51
56
|
border: fail1;
|
52
57
|
}
|
53
58
|
}
|
54
|
-
|
59
|
+
SCSS
|
55
60
|
|
56
61
|
it { should_not report_lint }
|
57
62
|
end
|
58
63
|
|
59
64
|
context 'when a disable is present at the top level for another linter' do
|
60
|
-
let(:
|
65
|
+
let(:scss) { <<-SCSS }
|
61
66
|
// scss-lint:disable Bogus
|
62
67
|
p {
|
63
68
|
border: fail1;
|
@@ -65,13 +70,13 @@ describe SCSSLint::Linter do
|
|
65
70
|
p {
|
66
71
|
border: bogus;
|
67
72
|
}
|
68
|
-
|
73
|
+
SCSS
|
69
74
|
|
70
75
|
it { should report_lint lint: 3 }
|
71
76
|
end
|
72
77
|
|
73
78
|
context 'when a linter is disabled then enabled again' do
|
74
|
-
let(:
|
79
|
+
let(:scss) { <<-SCSS }
|
75
80
|
// scss-lint:disable Fake
|
76
81
|
p {
|
77
82
|
border: fail1;
|
@@ -80,14 +85,14 @@ describe SCSSLint::Linter do
|
|
80
85
|
p {
|
81
86
|
border: fail1;
|
82
87
|
}
|
83
|
-
|
88
|
+
SCSS
|
84
89
|
|
85
90
|
it { should_not report_lint line: 3 }
|
86
91
|
it { should report_lint line: 7 }
|
87
92
|
end
|
88
93
|
|
89
94
|
context 'when a linter is disabled within a rule' do
|
90
|
-
let(:
|
95
|
+
let(:scss) { <<-SCSS }
|
91
96
|
p {
|
92
97
|
// scss-lint:disable Fake
|
93
98
|
border: fail1;
|
@@ -100,7 +105,7 @@ describe SCSSLint::Linter do
|
|
100
105
|
p {
|
101
106
|
border: fail1;
|
102
107
|
}
|
103
|
-
|
108
|
+
SCSS
|
104
109
|
|
105
110
|
it { should_not report_lint line: 3 }
|
106
111
|
it { should_not report_lint line: 6 }
|
@@ -108,7 +113,7 @@ describe SCSSLint::Linter do
|
|
108
113
|
end
|
109
114
|
|
110
115
|
context 'when more than one linter is disabled' do
|
111
|
-
let(:
|
116
|
+
let(:scss) { <<-SCSS }
|
112
117
|
// scss-lint:disable Bogus, Fake
|
113
118
|
p {
|
114
119
|
border: fail1;
|
@@ -117,13 +122,13 @@ describe SCSSLint::Linter do
|
|
117
122
|
p {
|
118
123
|
border: bogus;
|
119
124
|
}
|
120
|
-
|
125
|
+
SCSS
|
121
126
|
|
122
127
|
it { should_not report_lint }
|
123
128
|
end
|
124
129
|
|
125
130
|
context 'when more than one linter is disabled without spaces between the linter names' do
|
126
|
-
let(:
|
131
|
+
let(:scss) { <<-SCSS }
|
127
132
|
// scss-lint:disable Fake,Bogus
|
128
133
|
p {
|
129
134
|
border: fail1;
|
@@ -132,13 +137,13 @@ describe SCSSLint::Linter do
|
|
132
137
|
p {
|
133
138
|
border: Bogus;
|
134
139
|
}
|
135
|
-
|
140
|
+
SCSS
|
136
141
|
|
137
142
|
it { should_not report_lint }
|
138
143
|
end
|
139
144
|
|
140
145
|
context 'when more than one linter is disabled without commas between the linter names' do
|
141
|
-
let(:
|
146
|
+
let(:scss) { <<-SCSS }
|
142
147
|
// scss-lint:disable Fake Bogus
|
143
148
|
p {
|
144
149
|
border: fail1;
|
@@ -147,13 +152,13 @@ describe SCSSLint::Linter do
|
|
147
152
|
p {
|
148
153
|
border: bogus;
|
149
154
|
}
|
150
|
-
|
155
|
+
SCSS
|
151
156
|
|
152
157
|
it { should_not report_lint }
|
153
158
|
end
|
154
159
|
|
155
160
|
context 'when two linters are disabled and only one is reenabled' do
|
156
|
-
let(:
|
161
|
+
let(:scss) { <<-SCSS }
|
157
162
|
// scss-lint:disable Fake, Bogus
|
158
163
|
p {
|
159
164
|
border: fail1;
|
@@ -164,14 +169,14 @@ describe SCSSLint::Linter do
|
|
164
169
|
margin: fail1;
|
165
170
|
border: bogus;
|
166
171
|
}
|
167
|
-
|
172
|
+
SCSS
|
168
173
|
|
169
174
|
it { should_not report_lint line: 3 }
|
170
175
|
it { should report_lint line: 8 }
|
171
176
|
end
|
172
177
|
|
173
178
|
context 'when all linters are disabled' do
|
174
|
-
let(:
|
179
|
+
let(:scss) { <<-SCSS }
|
175
180
|
// scss-lint:disable all
|
176
181
|
p {
|
177
182
|
border: fail1;
|
@@ -181,13 +186,13 @@ describe SCSSLint::Linter do
|
|
181
186
|
margin: fail1;
|
182
187
|
border: bogus;
|
183
188
|
}
|
184
|
-
|
189
|
+
SCSS
|
185
190
|
|
186
191
|
it { should_not report_lint }
|
187
192
|
end
|
188
193
|
|
189
194
|
context 'when all linters are disabled and then one is re-enabled' do
|
190
|
-
let(:
|
195
|
+
let(:scss) { <<-SCSS }
|
191
196
|
// scss-lint:disable all
|
192
197
|
p {
|
193
198
|
border: fail1;
|
@@ -198,25 +203,25 @@ describe SCSSLint::Linter do
|
|
198
203
|
margin: fail1;
|
199
204
|
border: bogus;
|
200
205
|
}
|
201
|
-
|
206
|
+
SCSS
|
202
207
|
|
203
208
|
it { should_not report_lint line: 3 }
|
204
209
|
it { should report_lint line: 8 }
|
205
210
|
end
|
206
211
|
|
207
212
|
context 'when a linter is bypassing the visit tree order' do
|
208
|
-
let(:
|
213
|
+
let(:scss) { <<-SCSS }
|
209
214
|
p {
|
210
215
|
// scss-lint:disable Fake
|
211
216
|
border: fail2;
|
212
217
|
}
|
213
|
-
|
218
|
+
SCSS
|
214
219
|
|
215
220
|
it { should_not report_lint }
|
216
221
|
end
|
217
222
|
|
218
223
|
context 'when the command comment is next to other comments' do
|
219
|
-
let(:
|
224
|
+
let(:scss) { <<-SCSS }
|
220
225
|
p {
|
221
226
|
// scss-lint:disable Fake
|
222
227
|
// more comments
|
@@ -228,21 +233,60 @@ describe SCSSLint::Linter do
|
|
228
233
|
// scss-lint:disable Fake
|
229
234
|
border: fail2;
|
230
235
|
}
|
231
|
-
|
236
|
+
SCSS
|
232
237
|
|
233
238
|
it { should_not report_lint }
|
234
239
|
end
|
235
240
|
|
236
241
|
context 'when the command comment is at the end of a statement' do
|
237
|
-
let(:
|
242
|
+
let(:scss) { <<-SCSS }
|
238
243
|
p {
|
239
244
|
border: fail1; // scss-lint:disable Fake
|
240
245
|
border: fail1;
|
241
246
|
}
|
242
|
-
|
247
|
+
SCSS
|
243
248
|
|
244
249
|
it { should_not report_lint line: 2 }
|
245
250
|
it { should report_lint line: 3 }
|
246
251
|
end
|
252
|
+
|
253
|
+
context 'when global disable comes before an @include' do
|
254
|
+
let(:scss) { <<-SCSS }
|
255
|
+
// scss-lint:disable Fake
|
256
|
+
p {
|
257
|
+
border: fail1;
|
258
|
+
}
|
259
|
+
|
260
|
+
@include mixin(param) {
|
261
|
+
border: fail1;
|
262
|
+
}
|
263
|
+
SCSS
|
264
|
+
|
265
|
+
it { should_not report_lint }
|
266
|
+
end
|
267
|
+
|
268
|
+
context 'when // control comment appears in the middle of a comma sequence' do
|
269
|
+
let(:scss) { <<-SCSS }
|
270
|
+
.badClass, // scss-lint:disable Fake
|
271
|
+
.good-selector {
|
272
|
+
border: fail1;
|
273
|
+
}
|
274
|
+
SCSS
|
275
|
+
|
276
|
+
it { should_not report_lint line: 1 }
|
277
|
+
it { should report_lint line: 3 }
|
278
|
+
end
|
279
|
+
|
280
|
+
context 'when /* control comment appears in the middle of a comma sequence' do
|
281
|
+
let(:scss) { <<-SCSS }
|
282
|
+
.badClass, /* scss-lint:disable Fake */
|
283
|
+
.good-selector {
|
284
|
+
border: fail1;
|
285
|
+
}
|
286
|
+
SCSS
|
287
|
+
|
288
|
+
it { should_not report_lint line: 1 }
|
289
|
+
it { should report_lint line: 3 }
|
290
|
+
end
|
247
291
|
end
|
248
292
|
end
|
@@ -17,7 +17,6 @@ describe SCSSLint::Runner do
|
|
17
17
|
SCSSLint::LinterRegistry.stub(:linters)
|
18
18
|
.and_return([SCSSLint::Linter::FakeLinter1,
|
19
19
|
SCSSLint::Linter::FakeLinter2])
|
20
|
-
SCSSLint::Config.stub(:for_file)
|
21
20
|
end
|
22
21
|
|
23
22
|
class SCSSLint::Linter::FakeLinter1 < SCSSLint::Linter; end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::SelectorVisitor do
|
4
4
|
describe '#visit' do
|
5
|
-
let(:engine) { SCSSLint::Engine.new(
|
5
|
+
let(:engine) { SCSSLint::Engine.new(scss) }
|
6
6
|
before { RuleVisitor.new(visitor).run(engine) }
|
7
7
|
|
8
8
|
# Visits every rule in the given parse tree and passes the parsed selector
|
@@ -42,11 +42,11 @@ describe SCSSLint::SelectorVisitor do
|
|
42
42
|
|
43
43
|
let(:visitor) { TestAttributeVisitor.new }
|
44
44
|
|
45
|
-
let(:
|
45
|
+
let(:scss) { <<-SCSS }
|
46
46
|
[rel="nofollow"] {}
|
47
47
|
a[href="http"] {}
|
48
48
|
.class [data-count] {}
|
49
|
-
|
49
|
+
SCSS
|
50
50
|
|
51
51
|
it 'visits all attribute nodes' do
|
52
52
|
visitor.node_order.should == %w[rel href data-count]
|
@@ -62,11 +62,11 @@ describe SCSSLint::SelectorVisitor do
|
|
62
62
|
|
63
63
|
let(:visitor) { TestClassVisitor.new }
|
64
64
|
|
65
|
-
let(:
|
65
|
+
let(:scss) { <<-SCSS }
|
66
66
|
a.link {}
|
67
67
|
.menu .menu-item {}
|
68
68
|
.button[data-source], .overlay {}
|
69
|
-
|
69
|
+
SCSS
|
70
70
|
|
71
71
|
it 'visits all class nodes' do
|
72
72
|
visitor.node_order.should == %w[link menu menu-item button overlay]
|
@@ -82,11 +82,11 @@ describe SCSSLint::SelectorVisitor do
|
|
82
82
|
|
83
83
|
let(:visitor) { TestElementVisitor.new }
|
84
84
|
|
85
|
-
let(:
|
85
|
+
let(:scss) { <<-SCSS }
|
86
86
|
a, b {}
|
87
87
|
.class {}
|
88
88
|
i + p {}
|
89
|
-
|
89
|
+
SCSS
|
90
90
|
|
91
91
|
it 'visits all element nodes' do
|
92
92
|
visitor.node_order.should == %w[a b i p]
|
@@ -102,10 +102,10 @@ describe SCSSLint::SelectorVisitor do
|
|
102
102
|
|
103
103
|
let(:visitor) { TestIdVisitor.new }
|
104
104
|
|
105
|
-
let(:
|
105
|
+
let(:scss) { <<-SCSS }
|
106
106
|
#something, #thing {}
|
107
107
|
#object + #entity {}
|
108
|
-
|
108
|
+
SCSS
|
109
109
|
|
110
110
|
it 'visits all id nodes' do
|
111
111
|
visitor.node_order.should == %w[something thing object entity]
|
@@ -121,13 +121,13 @@ describe SCSSLint::SelectorVisitor do
|
|
121
121
|
|
122
122
|
let(:visitor) { TestParentVisitor.new }
|
123
123
|
|
124
|
-
let(:
|
124
|
+
let(:scss) { <<-SCSS }
|
125
125
|
p {
|
126
126
|
&.class {}
|
127
127
|
.container & {}
|
128
128
|
.nothing {}
|
129
129
|
}
|
130
|
-
|
130
|
+
SCSS
|
131
131
|
|
132
132
|
it 'visits all parent nodes' do
|
133
133
|
visitor.node_order.should == [2, 3]
|
@@ -143,10 +143,10 @@ describe SCSSLint::SelectorVisitor do
|
|
143
143
|
|
144
144
|
let(:visitor) { TestPlaceholderVisitor.new }
|
145
145
|
|
146
|
-
let(:
|
146
|
+
let(:scss) { <<-SCSS }
|
147
147
|
%placeholder, %other-placeholder {}
|
148
148
|
.button, %button {}
|
149
|
-
|
149
|
+
SCSS
|
150
150
|
|
151
151
|
it 'visits all placeholder nodes' do
|
152
152
|
visitor.node_order.should == %w[placeholder other-placeholder button]
|
@@ -162,12 +162,12 @@ describe SCSSLint::SelectorVisitor do
|
|
162
162
|
|
163
163
|
let(:visitor) { TestPseudoVisitor.new }
|
164
164
|
|
165
|
-
let(:
|
165
|
+
let(:scss) { <<-SCSS }
|
166
166
|
li:first-child, li:last-child {}
|
167
167
|
p {
|
168
168
|
&:first-letter {}
|
169
169
|
}
|
170
|
-
|
170
|
+
SCSS
|
171
171
|
|
172
172
|
it 'visits all pseudo-selector nodes' do
|
173
173
|
visitor.node_order.should == %w[first-child last-child first-letter]
|
@@ -183,12 +183,12 @@ describe SCSSLint::SelectorVisitor do
|
|
183
183
|
|
184
184
|
let(:visitor) { TestUniversalVisitor.new }
|
185
185
|
|
186
|
-
let(:
|
186
|
+
let(:scss) { <<-SCSS }
|
187
187
|
p > * {}
|
188
188
|
* {}
|
189
189
|
li {}
|
190
190
|
*:first-child {}
|
191
|
-
|
191
|
+
SCSS
|
192
192
|
|
193
193
|
it 'visits all universal-selector nodes' do
|
194
194
|
visitor.node_order.should == [1, 2, 4]
|
@@ -204,13 +204,13 @@ describe SCSSLint::SelectorVisitor do
|
|
204
204
|
|
205
205
|
let(:visitor) { TestSimpleSequenceVisitor.new }
|
206
206
|
|
207
|
-
let(:
|
207
|
+
let(:scss) { <<-SCSS }
|
208
208
|
a, b, p[lang] {}
|
209
209
|
a.link + b.word {}
|
210
210
|
li {}
|
211
211
|
ul > li {}
|
212
212
|
p span {}
|
213
|
-
|
213
|
+
SCSS
|
214
214
|
|
215
215
|
it 'visits all simple sequences' do
|
216
216
|
visitor.node_order.count.should == 10
|
@@ -226,13 +226,13 @@ describe SCSSLint::SelectorVisitor do
|
|
226
226
|
|
227
227
|
let(:visitor) { TestSequenceVisitor.new }
|
228
228
|
|
229
|
-
let(:
|
229
|
+
let(:scss) { <<-SCSS }
|
230
230
|
a, b, p[lang] {}
|
231
231
|
a.link + b.word {}
|
232
232
|
li {}
|
233
233
|
ul > li {}
|
234
234
|
p span {}
|
235
|
-
|
235
|
+
SCSS
|
236
236
|
|
237
237
|
it 'visits all sequences' do
|
238
238
|
visitor.node_order.count.should == 7
|
@@ -248,13 +248,13 @@ describe SCSSLint::SelectorVisitor do
|
|
248
248
|
|
249
249
|
let(:visitor) { TestCommaSequenceVisitor.new }
|
250
250
|
|
251
|
-
let(:
|
251
|
+
let(:scss) { <<-SCSS }
|
252
252
|
a, b, p[lang] {}
|
253
253
|
a.link + b.word {}
|
254
254
|
li {}
|
255
255
|
ul > li {}
|
256
256
|
p span {}
|
257
|
-
|
257
|
+
SCSS
|
258
258
|
|
259
259
|
it 'visits all comma (i.e. selector) sequences' do
|
260
260
|
visitor.node_order.count.should == 5
|