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::SpaceBetweenParens do
|
4
4
|
context 'when the opening parens is followed by a space' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
property: ( value);
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should report_lint line: 2 }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when the closing parens is preceded by a space' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
p {
|
17
17
|
property: (value );
|
18
18
|
}
|
19
|
-
|
19
|
+
SCSS
|
20
20
|
|
21
21
|
it { should report_lint line: 2 }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'when both parens are space padded' do
|
25
|
-
let(:
|
25
|
+
let(:scss) { <<-SCSS }
|
26
26
|
p {
|
27
27
|
property: ( value );
|
28
28
|
}
|
29
|
-
|
29
|
+
SCSS
|
30
30
|
|
31
31
|
it { should report_lint line: 2, count: 2 }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'when neither parens are space padded' do
|
35
|
-
let(:
|
35
|
+
let(:scss) { <<-SCSS }
|
36
36
|
p {
|
37
37
|
property: (value);
|
38
38
|
}
|
39
|
-
|
39
|
+
SCSS
|
40
40
|
|
41
41
|
it { should_not report_lint }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when parens are multi-line' do
|
45
|
-
let(:
|
45
|
+
let(:scss) { <<-SCSS }
|
46
46
|
p {
|
47
47
|
property: (
|
48
48
|
value
|
49
49
|
);
|
50
50
|
}
|
51
|
-
|
51
|
+
SCSS
|
52
52
|
|
53
53
|
it { should_not report_lint }
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when parens are multi-line with tabs' do
|
57
|
-
let(:
|
57
|
+
let(:scss) { <<-SCSS }
|
58
58
|
\t\t\tp {
|
59
59
|
\t\t\t\tproperty: (
|
60
60
|
\t\t\t\t\tvalue
|
61
61
|
\t\t\t\t);
|
62
62
|
\t\t\t}
|
63
|
-
|
63
|
+
SCSS
|
64
64
|
|
65
65
|
it { should_not report_lint }
|
66
66
|
end
|
67
67
|
|
68
68
|
context 'when outer parens are space padded' do
|
69
|
-
let(:
|
69
|
+
let(:scss) { <<-SCSS }
|
70
70
|
p {
|
71
71
|
property: fn( fn2(val1, val2) );
|
72
72
|
}
|
73
|
-
|
73
|
+
SCSS
|
74
74
|
|
75
75
|
it { should report_lint line: 2, count: 2 }
|
76
76
|
end
|
77
77
|
|
78
78
|
context 'when inner parens are space padded' do
|
79
|
-
let(:
|
79
|
+
let(:scss) { <<-SCSS }
|
80
80
|
p {
|
81
81
|
property: fn(fn2( val1, val2 ));
|
82
82
|
}
|
83
|
-
|
83
|
+
SCSS
|
84
84
|
|
85
85
|
it { should report_lint line: 2, count: 2 }
|
86
86
|
end
|
87
87
|
|
88
88
|
context 'when both parens are not space padded' do
|
89
|
-
let(:
|
89
|
+
let(:scss) { <<-SCSS }
|
90
90
|
p {
|
91
91
|
property: fn(fn2(val1, val2));
|
92
92
|
}
|
93
|
-
|
93
|
+
SCSS
|
94
94
|
|
95
95
|
it { should_not report_lint }
|
96
96
|
end
|
97
97
|
|
98
98
|
context 'when both parens are space padded' do
|
99
|
-
let(:
|
99
|
+
let(:scss) { <<-SCSS }
|
100
100
|
p {
|
101
101
|
property: fn( fn2( val1, val2 ) );
|
102
102
|
}
|
103
|
-
|
103
|
+
SCSS
|
104
104
|
|
105
105
|
it { should report_lint line: 2, count: 4 }
|
106
106
|
end
|
107
107
|
|
108
108
|
context 'when multi level parens are multi-line' do
|
109
|
-
let(:
|
109
|
+
let(:scss) { <<-SCSS }
|
110
110
|
p {
|
111
111
|
property: fn(
|
112
112
|
fn2(
|
@@ -114,27 +114,27 @@ describe SCSSLint::Linter::SpaceBetweenParens do
|
|
114
114
|
)
|
115
115
|
);
|
116
116
|
}
|
117
|
-
|
117
|
+
SCSS
|
118
118
|
|
119
119
|
it { should_not report_lint }
|
120
120
|
end
|
121
121
|
|
122
122
|
context 'when parens exist in a silent comment' do
|
123
|
-
let(:
|
123
|
+
let(:scss) { <<-SCSS }
|
124
124
|
p {
|
125
125
|
margin: 0; // Some comment ( with parens )
|
126
126
|
}
|
127
|
-
|
127
|
+
SCSS
|
128
128
|
|
129
129
|
it { should_not report_lint }
|
130
130
|
end
|
131
131
|
|
132
132
|
context 'when parens exist in an outputted comment' do
|
133
|
-
let(:
|
133
|
+
let(:scss) { <<-SCSS }
|
134
134
|
p {
|
135
135
|
margin: 0; /* Some comment ( with parens ) */
|
136
136
|
}
|
137
|
-
|
137
|
+
SCSS
|
138
138
|
|
139
139
|
it { should_not report_lint }
|
140
140
|
end
|
@@ -143,111 +143,111 @@ describe SCSSLint::Linter::SpaceBetweenParens do
|
|
143
143
|
let(:linter_config) { { 'spaces' => 1 } }
|
144
144
|
|
145
145
|
context 'when the opening parens is followed by a space' do
|
146
|
-
let(:
|
146
|
+
let(:scss) { <<-SCSS }
|
147
147
|
p {
|
148
148
|
property: ( value);
|
149
149
|
}
|
150
|
-
|
150
|
+
SCSS
|
151
151
|
|
152
152
|
it { should report_lint line: 2 }
|
153
153
|
end
|
154
154
|
|
155
155
|
context 'when the closing parens is preceded by a space' do
|
156
|
-
let(:
|
156
|
+
let(:scss) { <<-SCSS }
|
157
157
|
p {
|
158
158
|
property: (value );
|
159
159
|
}
|
160
|
-
|
160
|
+
SCSS
|
161
161
|
|
162
162
|
it { should report_lint line: 2 }
|
163
163
|
end
|
164
164
|
|
165
165
|
context 'when neither parens are space padded' do
|
166
|
-
let(:
|
166
|
+
let(:scss) { <<-SCSS }
|
167
167
|
p {
|
168
168
|
property: (value);
|
169
169
|
}
|
170
|
-
|
170
|
+
SCSS
|
171
171
|
|
172
172
|
it { should report_lint line: 2, count: 2 }
|
173
173
|
end
|
174
174
|
|
175
175
|
context 'when both parens are space padded' do
|
176
|
-
let(:
|
176
|
+
let(:scss) { <<-SCSS }
|
177
177
|
p {
|
178
178
|
property: ( value );
|
179
179
|
}
|
180
|
-
|
180
|
+
SCSS
|
181
181
|
|
182
182
|
it { should_not report_lint }
|
183
183
|
end
|
184
184
|
|
185
185
|
context 'when parens are multi-line' do
|
186
|
-
let(:
|
186
|
+
let(:scss) { <<-SCSS }
|
187
187
|
p {
|
188
188
|
property: (
|
189
189
|
value
|
190
190
|
);
|
191
191
|
}
|
192
|
-
|
192
|
+
SCSS
|
193
193
|
|
194
194
|
it { should_not report_lint }
|
195
195
|
end
|
196
196
|
|
197
197
|
context 'when parens are multi-line with tabs' do
|
198
|
-
let(:
|
198
|
+
let(:scss) { <<-SCSS }
|
199
199
|
\t\t\t\tp {
|
200
200
|
\t\t\t\t\tproperty: (
|
201
201
|
\t\t\t\t\t\tvalue
|
202
202
|
\t\t\t\t\t);
|
203
203
|
\t\t\t\t}
|
204
|
-
|
204
|
+
SCSS
|
205
205
|
|
206
206
|
it { should_not report_lint }
|
207
207
|
end
|
208
208
|
|
209
209
|
context 'when outer parens are space padded' do
|
210
|
-
let(:
|
210
|
+
let(:scss) { <<-SCSS }
|
211
211
|
p {
|
212
212
|
property: fn( fn2(val1, val2) );
|
213
213
|
}
|
214
|
-
|
214
|
+
SCSS
|
215
215
|
|
216
216
|
it { should report_lint line: 2, count: 2 }
|
217
217
|
end
|
218
218
|
|
219
219
|
context 'when inner parens are space padded' do
|
220
|
-
let(:
|
220
|
+
let(:scss) { <<-SCSS }
|
221
221
|
p {
|
222
222
|
property: fn(fn2( val1, val2 ));
|
223
223
|
}
|
224
|
-
|
224
|
+
SCSS
|
225
225
|
|
226
226
|
it { should report_lint line: 2, count: 2 }
|
227
227
|
end
|
228
228
|
|
229
229
|
context 'when both parens are not space padded' do
|
230
|
-
let(:
|
230
|
+
let(:scss) { <<-SCSS }
|
231
231
|
p {
|
232
232
|
property: fn(fn2(val1, val2));
|
233
233
|
}
|
234
|
-
|
234
|
+
SCSS
|
235
235
|
|
236
236
|
it { should report_lint line: 2, count: 4 }
|
237
237
|
end
|
238
238
|
|
239
239
|
context 'when both parens are space padded' do
|
240
|
-
let(:
|
240
|
+
let(:scss) { <<-SCSS }
|
241
241
|
p {
|
242
242
|
property: fn( fn2( val1, val2 ) );
|
243
243
|
}
|
244
|
-
|
244
|
+
SCSS
|
245
245
|
|
246
246
|
it { should_not report_lint }
|
247
247
|
end
|
248
248
|
|
249
249
|
context 'when multi level parens are multi-line' do
|
250
|
-
let(:
|
250
|
+
let(:scss) { <<-SCSS }
|
251
251
|
p {
|
252
252
|
property: fn(
|
253
253
|
fn2(
|
@@ -255,7 +255,7 @@ describe SCSSLint::Linter::SpaceBetweenParens do
|
|
255
255
|
)
|
256
256
|
);
|
257
257
|
}
|
258
|
-
|
258
|
+
SCSS
|
259
259
|
|
260
260
|
it { should_not report_lint }
|
261
261
|
end
|
@@ -2,320 +2,332 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::StringQuotes do
|
4
4
|
context 'when string is written with single quotes' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
content: 'hello';
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should_not report_lint }
|
12
12
|
|
13
13
|
context 'and contains escaped single quotes' do
|
14
|
-
let(:
|
14
|
+
let(:scss) { <<-SCSS }
|
15
15
|
p {
|
16
16
|
content: 'hello \\'world\\'';
|
17
17
|
}
|
18
|
-
|
18
|
+
SCSS
|
19
19
|
|
20
20
|
it { should report_lint line: 2 }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'and contains single quotes escaped as hex' do
|
24
|
-
let(:
|
24
|
+
let(:scss) { <<-SCSS }
|
25
25
|
p {
|
26
26
|
content: 'hello \\27world\\27';
|
27
27
|
}
|
28
|
-
|
28
|
+
SCSS
|
29
29
|
|
30
30
|
it { should_not report_lint }
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'and contains double quotes' do
|
34
|
-
let(:
|
34
|
+
let(:scss) { <<-SCSS }
|
35
35
|
p {
|
36
36
|
content: 'hello "world"';
|
37
37
|
}
|
38
|
-
|
38
|
+
SCSS
|
39
39
|
|
40
40
|
it { should_not report_lint }
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'and contains interpolation' do
|
44
|
-
let(:
|
44
|
+
let(:scss) { <<-SCSS }
|
45
45
|
p {
|
46
46
|
content: 'hello \#{$world}';
|
47
47
|
}
|
48
|
-
|
48
|
+
SCSS
|
49
49
|
|
50
50
|
it { should_not report_lint }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'when @import uses single quotes' do
|
55
|
-
let(:
|
55
|
+
let(:scss) { "@import 'file';" }
|
56
56
|
|
57
57
|
it { should_not report_lint }
|
58
58
|
|
59
59
|
context 'and has no trailing semicolon' do
|
60
|
-
let(:
|
60
|
+
let(:scss) { "@import 'file'\n" }
|
61
61
|
|
62
62
|
it { should_not report_lint }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'when @charset uses single quotes' do
|
67
|
-
let(:
|
67
|
+
let(:scss) { "@charset 'UTF-8';" }
|
68
68
|
|
69
69
|
it { should_not report_lint }
|
70
70
|
end
|
71
71
|
|
72
72
|
context 'when string is written with double quotes' do
|
73
|
-
let(:
|
73
|
+
let(:scss) { <<-SCSS }
|
74
74
|
p {
|
75
75
|
content: "hello";
|
76
76
|
}
|
77
|
-
|
77
|
+
SCSS
|
78
78
|
|
79
79
|
it { should report_lint line: 2 }
|
80
80
|
|
81
81
|
context 'and contains escaped double quotes' do
|
82
|
-
let(:
|
82
|
+
let(:scss) { <<-SCSS }
|
83
83
|
p {
|
84
84
|
content: "hello \\"world\\"";
|
85
85
|
}
|
86
|
-
|
86
|
+
SCSS
|
87
87
|
|
88
88
|
it { should report_lint line: 2 }
|
89
89
|
end
|
90
90
|
|
91
91
|
context 'and contains double quotes escaped as hex' do
|
92
|
-
let(:
|
92
|
+
let(:scss) { <<-SCSS }
|
93
93
|
p {
|
94
94
|
content: "hello \\22world\\22";
|
95
95
|
}
|
96
|
-
|
96
|
+
SCSS
|
97
97
|
|
98
98
|
it { should report_lint line: 2 }
|
99
99
|
end
|
100
100
|
|
101
101
|
context 'and contains single quotes' do
|
102
|
-
let(:
|
102
|
+
let(:scss) { <<-SCSS }
|
103
103
|
p {
|
104
104
|
content: "hello 'world'";
|
105
105
|
}
|
106
|
-
|
106
|
+
SCSS
|
107
107
|
|
108
108
|
it { should_not report_lint }
|
109
109
|
end
|
110
110
|
|
111
111
|
context 'and contains interpolation' do
|
112
|
-
let(:
|
112
|
+
let(:scss) { <<-SCSS }
|
113
113
|
p {
|
114
114
|
content: "hello \#{$world}"
|
115
115
|
}
|
116
|
-
|
116
|
+
SCSS
|
117
117
|
|
118
118
|
it { should_not report_lint }
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
context 'when @import uses double quotes' do
|
123
|
-
let(:
|
123
|
+
let(:scss) { '@import "file";' }
|
124
124
|
|
125
125
|
it { should report_lint }
|
126
126
|
|
127
127
|
context 'and has no trailing semicolon' do
|
128
|
-
let(:
|
128
|
+
let(:scss) { '@import "file"' }
|
129
129
|
|
130
130
|
it { should report_lint }
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
134
|
context 'when @charset uses double quotes' do
|
135
|
-
let(:
|
135
|
+
let(:scss) { '@charset "UTF-8";' }
|
136
136
|
|
137
137
|
it { should report_lint }
|
138
138
|
end
|
139
139
|
|
140
140
|
context 'when property has a literal identifier' do
|
141
|
-
let(:
|
141
|
+
let(:scss) { <<-SCSS }
|
142
142
|
p {
|
143
143
|
display: none;
|
144
144
|
}
|
145
|
-
|
145
|
+
SCSS
|
146
146
|
|
147
147
|
it { should_not report_lint }
|
148
148
|
end
|
149
149
|
|
150
150
|
context 'when property is a URL with single quotes' do
|
151
|
-
let(:
|
151
|
+
let(:scss) { <<-SCSS }
|
152
152
|
p {
|
153
153
|
background: url('image.png');
|
154
154
|
}
|
155
|
-
|
155
|
+
SCSS
|
156
156
|
|
157
157
|
it { should_not report_lint }
|
158
158
|
end
|
159
159
|
|
160
160
|
context 'when property is a URL with double quotes' do
|
161
|
-
let(:
|
161
|
+
let(:scss) { <<-SCSS }
|
162
162
|
p {
|
163
163
|
background: url("image.png");
|
164
164
|
}
|
165
|
-
|
165
|
+
SCSS
|
166
166
|
|
167
167
|
it { should report_lint line: 2 }
|
168
168
|
end
|
169
169
|
|
170
|
+
context 'when Sass script is written in a non-silent comment' do
|
171
|
+
let(:scss) { <<-SCSS }
|
172
|
+
/**
|
173
|
+
* .thing-\#{$key} {
|
174
|
+
* color: \#{value}
|
175
|
+
* }
|
176
|
+
*/
|
177
|
+
SCSS
|
178
|
+
|
179
|
+
it { should_not report_lint }
|
180
|
+
end
|
181
|
+
|
170
182
|
context 'when the configuration has been set to prefer double quotes' do
|
171
183
|
let(:linter_config) { { 'style' => 'double_quotes' } }
|
172
184
|
|
173
185
|
context 'and string is written with single quotes' do
|
174
|
-
let(:
|
186
|
+
let(:scss) { <<-SCSS }
|
175
187
|
p {
|
176
188
|
content: 'hello';
|
177
189
|
}
|
178
|
-
|
190
|
+
SCSS
|
179
191
|
|
180
192
|
it { should report_lint line: 2 }
|
181
193
|
|
182
194
|
context 'and contains escaped single quotes' do
|
183
|
-
let(:
|
195
|
+
let(:scss) { <<-SCSS }
|
184
196
|
p {
|
185
197
|
content: 'hello \\'world\\'';
|
186
198
|
}
|
187
|
-
|
199
|
+
SCSS
|
188
200
|
|
189
201
|
it { should report_lint line: 2 }
|
190
202
|
end
|
191
203
|
|
192
204
|
context 'and contains single quotes escaped as hex' do
|
193
|
-
let(:
|
205
|
+
let(:scss) { <<-SCSS }
|
194
206
|
p {
|
195
207
|
content: 'hello \\27world\\27';
|
196
208
|
}
|
197
|
-
|
209
|
+
SCSS
|
198
210
|
|
199
211
|
it { should report_lint line: 2 }
|
200
212
|
end
|
201
213
|
|
202
214
|
context 'and contains double quotes' do
|
203
|
-
let(:
|
215
|
+
let(:scss) { <<-SCSS }
|
204
216
|
p {
|
205
217
|
content: 'hello "world"';
|
206
218
|
}
|
207
|
-
|
219
|
+
SCSS
|
208
220
|
|
209
221
|
it { should_not report_lint }
|
210
222
|
end
|
211
223
|
|
212
224
|
context 'and contains interpolation' do
|
213
|
-
let(:
|
225
|
+
let(:scss) { <<-SCSS }
|
214
226
|
p {
|
215
227
|
content: 'hello \#{$world}';
|
216
228
|
}
|
217
|
-
|
229
|
+
SCSS
|
218
230
|
|
219
231
|
it { should_not report_lint }
|
220
232
|
end
|
221
233
|
|
222
234
|
context 'and contains interpolation inside a substring with single quotes' do
|
223
|
-
let(:
|
235
|
+
let(:scss) { <<-SCSS }
|
224
236
|
p {
|
225
237
|
content: "<svg width='\#{$something}'>";
|
226
238
|
}
|
227
|
-
|
239
|
+
SCSS
|
228
240
|
|
229
241
|
it { should_not report_lint }
|
230
242
|
end
|
231
243
|
|
232
244
|
context 'and contains a single-quoted string inside interpolation' do
|
233
|
-
let(:
|
245
|
+
let(:scss) { <<-SCSS }
|
234
246
|
p {
|
235
247
|
content: "<svg width='\#{func('hello')}'>";
|
236
248
|
}
|
237
|
-
|
249
|
+
SCSS
|
238
250
|
|
239
251
|
it { should report_lint }
|
240
252
|
end
|
241
253
|
end
|
242
254
|
|
243
255
|
context 'and string is written with double quotes' do
|
244
|
-
let(:
|
256
|
+
let(:scss) { <<-SCSS }
|
245
257
|
p {
|
246
258
|
content: "hello";
|
247
259
|
}
|
248
|
-
|
260
|
+
SCSS
|
249
261
|
|
250
262
|
it { should_not report_lint }
|
251
263
|
|
252
264
|
context 'and contains escaped double quotes' do
|
253
|
-
let(:
|
265
|
+
let(:scss) { <<-SCSS }
|
254
266
|
p {
|
255
267
|
content: "hello \\"world\\"";
|
256
268
|
}
|
257
|
-
|
269
|
+
SCSS
|
258
270
|
|
259
271
|
it { should report_lint line: 2 }
|
260
272
|
end
|
261
273
|
|
262
274
|
context 'and contains double quotes escaped as hex' do
|
263
|
-
let(:
|
275
|
+
let(:scss) { <<-SCSS }
|
264
276
|
p {
|
265
277
|
content: "hello \\22world\\22";
|
266
278
|
}
|
267
|
-
|
279
|
+
SCSS
|
268
280
|
|
269
281
|
it { should_not report_lint }
|
270
282
|
end
|
271
283
|
|
272
284
|
context 'and contains single quotes' do
|
273
|
-
let(:
|
285
|
+
let(:scss) { <<-SCSS }
|
274
286
|
p {
|
275
287
|
content: "hello 'world'";
|
276
288
|
}
|
277
|
-
|
289
|
+
SCSS
|
278
290
|
|
279
291
|
it { should_not report_lint }
|
280
292
|
end
|
281
293
|
|
282
294
|
context 'and contains interpolation' do
|
283
|
-
let(:
|
295
|
+
let(:scss) { <<-SCSS }
|
284
296
|
p {
|
285
297
|
content: "hello \#{$world}";
|
286
298
|
}
|
287
|
-
|
299
|
+
SCSS
|
288
300
|
|
289
301
|
it { should_not report_lint }
|
290
302
|
end
|
291
303
|
end
|
292
304
|
|
293
305
|
context 'when property has a literal identifier' do
|
294
|
-
let(:
|
306
|
+
let(:scss) { <<-SCSS }
|
295
307
|
p {
|
296
308
|
display: none;
|
297
309
|
}
|
298
|
-
|
310
|
+
SCSS
|
299
311
|
|
300
312
|
it { should_not report_lint }
|
301
313
|
end
|
302
314
|
|
303
315
|
context 'when property is a URL with single quotes' do
|
304
|
-
let(:
|
316
|
+
let(:scss) { <<-SCSS }
|
305
317
|
p {
|
306
318
|
background: url('image.png');
|
307
319
|
}
|
308
|
-
|
320
|
+
SCSS
|
309
321
|
|
310
322
|
it { should report_lint line: 2 }
|
311
323
|
end
|
312
324
|
|
313
325
|
context 'when property is a URL with double quotes' do
|
314
|
-
let(:
|
326
|
+
let(:scss) { <<-SCSS }
|
315
327
|
p {
|
316
328
|
background: url("image.png");
|
317
329
|
}
|
318
|
-
|
330
|
+
SCSS
|
319
331
|
|
320
332
|
it { should_not report_lint }
|
321
333
|
end
|