scss-lint-bliss 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/scss-lint +6 -0
- data/config/default.yml +220 -0
- data/data/prefixed-identifiers/base.txt +107 -0
- data/data/prefixed-identifiers/bourbon.txt +71 -0
- data/data/properties.txt +477 -0
- data/data/property-sort-orders/concentric.txt +134 -0
- data/data/property-sort-orders/recess.txt +149 -0
- data/data/property-sort-orders/smacss.txt +137 -0
- data/lib/scss_lint.rb +31 -0
- data/lib/scss_lint/cli.rb +215 -0
- data/lib/scss_lint/config.rb +251 -0
- data/lib/scss_lint/constants.rb +8 -0
- data/lib/scss_lint/control_comment_processor.rb +126 -0
- data/lib/scss_lint/engine.rb +56 -0
- data/lib/scss_lint/exceptions.rb +21 -0
- data/lib/scss_lint/file_finder.rb +68 -0
- data/lib/scss_lint/lint.rb +24 -0
- data/lib/scss_lint/linter.rb +161 -0
- data/lib/scss_lint/linter/bang_format.rb +52 -0
- data/lib/scss_lint/linter/bliss.rb +8 -0
- data/lib/scss_lint/linter/bliss/module.rb +101 -0
- data/lib/scss_lint/linter/border_zero.rb +39 -0
- data/lib/scss_lint/linter/color_keyword.rb +32 -0
- data/lib/scss_lint/linter/color_variable.rb +49 -0
- data/lib/scss_lint/linter/comment.rb +21 -0
- data/lib/scss_lint/linter/compass.rb +7 -0
- data/lib/scss_lint/linter/compass/property_with_mixin.rb +47 -0
- data/lib/scss_lint/linter/debug_statement.rb +10 -0
- data/lib/scss_lint/linter/declaration_order.rb +71 -0
- data/lib/scss_lint/linter/duplicate_property.rb +58 -0
- data/lib/scss_lint/linter/else_placement.rb +48 -0
- data/lib/scss_lint/linter/empty_line_between_blocks.rb +85 -0
- data/lib/scss_lint/linter/empty_rule.rb +11 -0
- data/lib/scss_lint/linter/final_newline.rb +20 -0
- data/lib/scss_lint/linter/hex_length.rb +56 -0
- data/lib/scss_lint/linter/hex_notation.rb +38 -0
- data/lib/scss_lint/linter/hex_validation.rb +23 -0
- data/lib/scss_lint/linter/id_selector.rb +10 -0
- data/lib/scss_lint/linter/import_path.rb +62 -0
- data/lib/scss_lint/linter/important_rule.rb +12 -0
- data/lib/scss_lint/linter/indentation.rb +197 -0
- data/lib/scss_lint/linter/leading_zero.rb +49 -0
- data/lib/scss_lint/linter/mergeable_selector.rb +60 -0
- data/lib/scss_lint/linter/name_format.rb +117 -0
- data/lib/scss_lint/linter/nesting_depth.rb +24 -0
- data/lib/scss_lint/linter/placeholder_in_extend.rb +22 -0
- data/lib/scss_lint/linter/property_count.rb +44 -0
- data/lib/scss_lint/linter/property_sort_order.rb +189 -0
- data/lib/scss_lint/linter/property_spelling.rb +49 -0
- data/lib/scss_lint/linter/property_units.rb +59 -0
- data/lib/scss_lint/linter/qualifying_element.rb +42 -0
- data/lib/scss_lint/linter/selector_depth.rb +64 -0
- data/lib/scss_lint/linter/selector_format.rb +102 -0
- data/lib/scss_lint/linter/shorthand.rb +139 -0
- data/lib/scss_lint/linter/single_line_per_property.rb +59 -0
- data/lib/scss_lint/linter/single_line_per_selector.rb +35 -0
- data/lib/scss_lint/linter/space_after_comma.rb +110 -0
- data/lib/scss_lint/linter/space_after_property_colon.rb +84 -0
- data/lib/scss_lint/linter/space_after_property_name.rb +27 -0
- data/lib/scss_lint/linter/space_before_brace.rb +72 -0
- data/lib/scss_lint/linter/space_between_parens.rb +35 -0
- data/lib/scss_lint/linter/string_quotes.rb +94 -0
- data/lib/scss_lint/linter/trailing_semicolon.rb +67 -0
- data/lib/scss_lint/linter/trailing_zero.rb +41 -0
- data/lib/scss_lint/linter/unnecessary_mantissa.rb +42 -0
- data/lib/scss_lint/linter/unnecessary_parent_reference.rb +49 -0
- data/lib/scss_lint/linter/url_format.rb +56 -0
- data/lib/scss_lint/linter/url_quotes.rb +27 -0
- data/lib/scss_lint/linter/variable_for_property.rb +30 -0
- data/lib/scss_lint/linter/vendor_prefix.rb +64 -0
- data/lib/scss_lint/linter/zero_unit.rb +39 -0
- data/lib/scss_lint/linter_registry.rb +26 -0
- data/lib/scss_lint/location.rb +38 -0
- data/lib/scss_lint/options.rb +109 -0
- data/lib/scss_lint/rake_task.rb +106 -0
- data/lib/scss_lint/reporter.rb +18 -0
- data/lib/scss_lint/reporter/config_reporter.rb +26 -0
- data/lib/scss_lint/reporter/default_reporter.rb +27 -0
- data/lib/scss_lint/reporter/files_reporter.rb +8 -0
- data/lib/scss_lint/reporter/json_reporter.rb +30 -0
- data/lib/scss_lint/reporter/xml_reporter.rb +33 -0
- data/lib/scss_lint/runner.rb +51 -0
- data/lib/scss_lint/sass/script.rb +78 -0
- data/lib/scss_lint/sass/tree.rb +168 -0
- data/lib/scss_lint/selector_visitor.rb +34 -0
- data/lib/scss_lint/utils.rb +112 -0
- data/lib/scss_lint/version.rb +4 -0
- data/spec/scss_lint/cli_spec.rb +177 -0
- data/spec/scss_lint/config_spec.rb +253 -0
- data/spec/scss_lint/engine_spec.rb +24 -0
- data/spec/scss_lint/file_finder_spec.rb +134 -0
- data/spec/scss_lint/linter/bang_format_spec.rb +121 -0
- data/spec/scss_lint/linter/bliss/module_spec.rb +254 -0
- data/spec/scss_lint/linter/border_zero_spec.rb +118 -0
- data/spec/scss_lint/linter/color_keyword_spec.rb +83 -0
- data/spec/scss_lint/linter/color_variable_spec.rb +145 -0
- data/spec/scss_lint/linter/comment_spec.rb +79 -0
- data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +55 -0
- data/spec/scss_lint/linter/debug_statement_spec.rb +21 -0
- data/spec/scss_lint/linter/declaration_order_spec.rb +575 -0
- data/spec/scss_lint/linter/duplicate_property_spec.rb +189 -0
- data/spec/scss_lint/linter/else_placement_spec.rb +106 -0
- data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +276 -0
- data/spec/scss_lint/linter/empty_rule_spec.rb +27 -0
- data/spec/scss_lint/linter/final_newline_spec.rb +49 -0
- data/spec/scss_lint/linter/hex_length_spec.rb +104 -0
- data/spec/scss_lint/linter/hex_notation_spec.rb +104 -0
- data/spec/scss_lint/linter/hex_validation_spec.rb +40 -0
- data/spec/scss_lint/linter/id_selector_spec.rb +62 -0
- data/spec/scss_lint/linter/import_path_spec.rb +300 -0
- data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
- data/spec/scss_lint/linter/indentation_spec.rb +347 -0
- data/spec/scss_lint/linter/leading_zero_spec.rb +233 -0
- data/spec/scss_lint/linter/mergeable_selector_spec.rb +283 -0
- data/spec/scss_lint/linter/name_format_spec.rb +282 -0
- data/spec/scss_lint/linter/nesting_depth_spec.rb +114 -0
- data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +63 -0
- data/spec/scss_lint/linter/property_count_spec.rb +104 -0
- data/spec/scss_lint/linter/property_sort_order_spec.rb +426 -0
- data/spec/scss_lint/linter/property_spelling_spec.rb +84 -0
- data/spec/scss_lint/linter/property_units_spec.rb +229 -0
- data/spec/scss_lint/linter/qualifying_element_spec.rb +125 -0
- data/spec/scss_lint/linter/selector_depth_spec.rb +159 -0
- data/spec/scss_lint/linter/selector_format_spec.rb +632 -0
- data/spec/scss_lint/linter/shorthand_spec.rb +198 -0
- data/spec/scss_lint/linter/single_line_per_property_spec.rb +73 -0
- data/spec/scss_lint/linter/single_line_per_selector_spec.rb +130 -0
- data/spec/scss_lint/linter/space_after_comma_spec.rb +332 -0
- data/spec/scss_lint/linter/space_after_property_colon_spec.rb +264 -0
- data/spec/scss_lint/linter/space_after_property_name_spec.rb +37 -0
- data/spec/scss_lint/linter/space_before_brace_spec.rb +829 -0
- data/spec/scss_lint/linter/space_between_parens_spec.rb +263 -0
- data/spec/scss_lint/linter/string_quotes_spec.rb +335 -0
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +304 -0
- data/spec/scss_lint/linter/trailing_zero_spec.rb +176 -0
- data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +67 -0
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +98 -0
- data/spec/scss_lint/linter/url_format_spec.rb +55 -0
- data/spec/scss_lint/linter/url_quotes_spec.rb +73 -0
- data/spec/scss_lint/linter/variable_for_property_spec.rb +145 -0
- data/spec/scss_lint/linter/vendor_prefix_spec.rb +371 -0
- data/spec/scss_lint/linter/zero_unit_spec.rb +113 -0
- data/spec/scss_lint/linter_registry_spec.rb +50 -0
- data/spec/scss_lint/linter_spec.rb +292 -0
- data/spec/scss_lint/location_spec.rb +42 -0
- data/spec/scss_lint/options_spec.rb +34 -0
- data/spec/scss_lint/rake_task_spec.rb +43 -0
- data/spec/scss_lint/reporter/config_reporter_spec.rb +42 -0
- data/spec/scss_lint/reporter/default_reporter_spec.rb +73 -0
- data/spec/scss_lint/reporter/files_reporter_spec.rb +38 -0
- data/spec/scss_lint/reporter/json_reporter_spec.rb +96 -0
- data/spec/scss_lint/reporter/xml_reporter_spec.rb +103 -0
- data/spec/scss_lint/reporter_spec.rb +11 -0
- data/spec/scss_lint/runner_spec.rb +123 -0
- data/spec/scss_lint/selector_visitor_spec.rb +264 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/support/isolated_environment.rb +25 -0
- data/spec/support/matchers/report_lint.rb +48 -0
- metadata +342 -0
@@ -0,0 +1,254 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::Bliss::Module do
|
4
|
+
let(:linter_config) { {
|
5
|
+
'module_name' => 'Foo',
|
6
|
+
'ignored_utility_class_prefixes' => ['is']
|
7
|
+
} }
|
8
|
+
|
9
|
+
context 'when a module class is used from a different module' do
|
10
|
+
let(:scss) { <<-SCSS }
|
11
|
+
.Foo {
|
12
|
+
.Bar {
|
13
|
+
color: blue;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
SCSS
|
17
|
+
|
18
|
+
it { should report_lint line: 2 }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when a utility class is used' do
|
22
|
+
let(:scss) { <<-SCSS }
|
23
|
+
.Foo {
|
24
|
+
.bar {
|
25
|
+
color: blue;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
SCSS
|
29
|
+
|
30
|
+
it { should report_lint line: 2 }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when a utility class is added to ignored_utility_class_prefixes' do
|
34
|
+
let(:scss) { <<-SCSS }
|
35
|
+
.Foo {
|
36
|
+
.isOk &-bar {
|
37
|
+
color: blue;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
SCSS
|
41
|
+
|
42
|
+
it { should_not report_lint }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when an ignored_utility_class_prefixes utility class is used as the last descendant selector' do
|
46
|
+
let(:scss) { <<-SCSS }
|
47
|
+
.Foo {
|
48
|
+
&-bar .isNotOk {
|
49
|
+
color: blue;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
SCSS
|
53
|
+
|
54
|
+
it { should report_lint line:2 }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when allow_utility_classes_in_module is enabled and a utility class is used (not as last descendant selector)' do
|
58
|
+
let(:linter_config) { {
|
59
|
+
'module_name' => 'Foo',
|
60
|
+
'allow_utility_direct_styling' => true
|
61
|
+
} }
|
62
|
+
let(:scss) { <<-SCSS }
|
63
|
+
.Foo {
|
64
|
+
.utilOk &-bar {
|
65
|
+
color: blue;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
SCSS
|
69
|
+
|
70
|
+
it { should_not report_lint }
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when any utility class is used as the last descendant selector' do
|
74
|
+
let(:scss) { <<-SCSS }
|
75
|
+
.Foo {
|
76
|
+
&-bar .any-util {
|
77
|
+
color: blue;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
SCSS
|
81
|
+
|
82
|
+
it { should report_lint line:2 }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when allow_utility_direct_styling is enabled and any utility class is used as the last descendant selector' do
|
86
|
+
let(:linter_config) { {
|
87
|
+
'module_name' => 'Foo',
|
88
|
+
'allow_utility_direct_styling' => true
|
89
|
+
} }
|
90
|
+
let(:scss) { <<-SCSS }
|
91
|
+
.Foo {
|
92
|
+
&-bar .any-util {
|
93
|
+
color: blue;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
SCSS
|
97
|
+
|
98
|
+
it { should_not report_lint }
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when allow_element_selector_in_module is false and element selector is used' do
|
102
|
+
let(:linter_config) { {
|
103
|
+
'module_name' => 'Foo',
|
104
|
+
'allow_element_selector_in_module' => false
|
105
|
+
} }
|
106
|
+
let(:scss) { <<-SCSS }
|
107
|
+
.Foo {
|
108
|
+
span {
|
109
|
+
color: blue;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
SCSS
|
113
|
+
|
114
|
+
it { should report_lint line:2 }
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when allow_element_selector_in_module is true and element selector is used' do
|
118
|
+
let(:linter_config) { {
|
119
|
+
'module_name' => 'Foo',
|
120
|
+
'allow_element_selector_in_module' => true
|
121
|
+
} }
|
122
|
+
let(:scss) { <<-SCSS }
|
123
|
+
.Foo {
|
124
|
+
span {
|
125
|
+
color: blue;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
SCSS
|
129
|
+
|
130
|
+
it { should_not report_lint }
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'when allow_attribute_selector_in_module is false and attribute selector is used' do
|
134
|
+
let(:linter_config) { {
|
135
|
+
'module_name' => 'Foo',
|
136
|
+
'allow_attribute_selector_in_module' => false
|
137
|
+
} }
|
138
|
+
let(:scss) { <<-SCSS }
|
139
|
+
.Foo {
|
140
|
+
[foo="bar"] {
|
141
|
+
color: blue;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
SCSS
|
145
|
+
|
146
|
+
it { should report_lint line:2 }
|
147
|
+
end
|
148
|
+
|
149
|
+
context 'when allow_attribute_selector_in_module is true and attribute selector is used' do
|
150
|
+
let(:linter_config) { {
|
151
|
+
'module_name' => 'Foo',
|
152
|
+
'allow_attribute_selector_in_module' => true
|
153
|
+
} }
|
154
|
+
let(:scss) { <<-SCSS }
|
155
|
+
.Foo {
|
156
|
+
[foo="bar"] {
|
157
|
+
color: blue;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
SCSS
|
161
|
+
|
162
|
+
it { should_not report_lint }
|
163
|
+
end
|
164
|
+
|
165
|
+
context 'when allow_id_selector_in_module is false and id selector is used' do
|
166
|
+
let(:linter_config) { {
|
167
|
+
'module_name' => 'Foo',
|
168
|
+
'allow_id_selector_in_module' => false
|
169
|
+
} }
|
170
|
+
let(:scss) { <<-SCSS }
|
171
|
+
.Foo {
|
172
|
+
#bar {
|
173
|
+
color: blue;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
SCSS
|
177
|
+
|
178
|
+
it { should report_lint line:2 }
|
179
|
+
end
|
180
|
+
|
181
|
+
context 'when allow_id_selector_in_module is true and id selector is used' do
|
182
|
+
let(:linter_config) { {
|
183
|
+
'module_name' => 'Foo',
|
184
|
+
'allow_id_selector_in_module' => true
|
185
|
+
} }
|
186
|
+
let(:scss) { <<-SCSS }
|
187
|
+
.Foo {
|
188
|
+
#bar {
|
189
|
+
color: blue;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
SCSS
|
193
|
+
|
194
|
+
it { should_not report_lint }
|
195
|
+
end
|
196
|
+
|
197
|
+
context 'when allow_module_margin is false and margin is applied to module' do
|
198
|
+
let(:linter_config) { {
|
199
|
+
'module_name' => 'Foo',
|
200
|
+
'allow_module_margin' => false
|
201
|
+
} }
|
202
|
+
let(:scss) { <<-SCSS }
|
203
|
+
.Foo {
|
204
|
+
margin-top: 10px;
|
205
|
+
}
|
206
|
+
SCSS
|
207
|
+
|
208
|
+
it { should report_lint line:2 }
|
209
|
+
end
|
210
|
+
|
211
|
+
context 'when allow_module_margin is true and margin is applied to module' do
|
212
|
+
let(:linter_config) { {
|
213
|
+
'module_name' => 'Foo',
|
214
|
+
'allow_module_margin' => true
|
215
|
+
} }
|
216
|
+
let(:scss) { <<-SCSS }
|
217
|
+
.Foo {
|
218
|
+
margin-top: 10px;
|
219
|
+
}
|
220
|
+
SCSS
|
221
|
+
|
222
|
+
it { should_not report_lint }
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'when allow_module_width is false and width is applied to module' do
|
226
|
+
let(:linter_config) { {
|
227
|
+
'module_name' => 'Foo',
|
228
|
+
'allow_module_width' => false
|
229
|
+
} }
|
230
|
+
let(:scss) { <<-SCSS }
|
231
|
+
.Foo {
|
232
|
+
width: 40%;
|
233
|
+
}
|
234
|
+
SCSS
|
235
|
+
|
236
|
+
it { should report_lint line:2 }
|
237
|
+
end
|
238
|
+
|
239
|
+
context 'when allow_module_width is true and width is applied to module' do
|
240
|
+
let(:linter_config) { {
|
241
|
+
'module_name' => 'Foo',
|
242
|
+
'allow_module_width' => true
|
243
|
+
} }
|
244
|
+
let(:scss) { <<-SCSS }
|
245
|
+
.Foo {
|
246
|
+
width: 40%;
|
247
|
+
}
|
248
|
+
SCSS
|
249
|
+
|
250
|
+
it { should_not report_lint }
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::BorderZero do
|
4
|
+
context 'when a rule is empty' do
|
5
|
+
let(:scss) { <<-SCSS }
|
6
|
+
p {
|
7
|
+
}
|
8
|
+
SCSS
|
9
|
+
|
10
|
+
it { should_not report_lint }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when a property' do
|
14
|
+
context 'contains a normal border' do
|
15
|
+
let(:scss) { <<-SCSS }
|
16
|
+
p {
|
17
|
+
border: 1px solid #000;
|
18
|
+
}
|
19
|
+
SCSS
|
20
|
+
|
21
|
+
it { should_not report_lint }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'has a border of 0' do
|
25
|
+
let(:scss) { <<-SCSS }
|
26
|
+
p {
|
27
|
+
border: 0;
|
28
|
+
}
|
29
|
+
SCSS
|
30
|
+
|
31
|
+
it { should_not report_lint }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'has a border of none' do
|
35
|
+
let(:scss) { <<-SCSS }
|
36
|
+
p {
|
37
|
+
border: none;
|
38
|
+
}
|
39
|
+
SCSS
|
40
|
+
|
41
|
+
it { should report_lint line: 2 }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'has a border-top of none' do
|
45
|
+
let(:scss) { <<-SCSS }
|
46
|
+
p {
|
47
|
+
border-top: none;
|
48
|
+
}
|
49
|
+
SCSS
|
50
|
+
|
51
|
+
it { should report_lint line: 2 }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'has a border-right of none' do
|
55
|
+
let(:scss) { <<-SCSS }
|
56
|
+
p {
|
57
|
+
border-right: none;
|
58
|
+
}
|
59
|
+
SCSS
|
60
|
+
|
61
|
+
it { should report_lint line: 2 }
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'has a border-bottom of none' do
|
65
|
+
let(:scss) { <<-SCSS }
|
66
|
+
p {
|
67
|
+
border-bottom: none;
|
68
|
+
}
|
69
|
+
SCSS
|
70
|
+
|
71
|
+
it { should report_lint line: 2 }
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'has a border-left of none' do
|
75
|
+
let(:scss) { <<-SCSS }
|
76
|
+
p {
|
77
|
+
border-left: none;
|
78
|
+
}
|
79
|
+
SCSS
|
80
|
+
|
81
|
+
it { should report_lint line: 2 }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when a convention of `none` is preferred' do
|
86
|
+
let(:linter_config) { { 'convention' => 'none' } }
|
87
|
+
|
88
|
+
context 'and the border is `none`' do
|
89
|
+
let(:scss) { <<-SCSS }
|
90
|
+
p {
|
91
|
+
border: none;
|
92
|
+
}
|
93
|
+
SCSS
|
94
|
+
|
95
|
+
it { should_not report_lint }
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'and the border is `0`' do
|
99
|
+
let(:scss) { <<-SCSS }
|
100
|
+
p {
|
101
|
+
border: 0;
|
102
|
+
}
|
103
|
+
SCSS
|
104
|
+
|
105
|
+
it { should report_lint }
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'and the border is a non-zero value' do
|
109
|
+
let(:scss) { <<-SCSS }
|
110
|
+
p {
|
111
|
+
border: 5px;
|
112
|
+
}
|
113
|
+
SCSS
|
114
|
+
|
115
|
+
it { should_not report_lint }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::ColorKeyword do
|
4
|
+
context 'when a color is specified as a hex' do
|
5
|
+
let(:scss) { <<-SCSS }
|
6
|
+
p {
|
7
|
+
color: #fff;
|
8
|
+
}
|
9
|
+
SCSS
|
10
|
+
|
11
|
+
it { should_not report_lint }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when a color is specified as a keyword' do
|
15
|
+
let(:scss) { <<-SCSS }
|
16
|
+
p {
|
17
|
+
color: white;
|
18
|
+
}
|
19
|
+
SCSS
|
20
|
+
|
21
|
+
it { should report_lint line: 2 }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when a color keyword exists in a shorthand property' do
|
25
|
+
let(:scss) { <<-SCSS }
|
26
|
+
p {
|
27
|
+
border: 1px solid black;
|
28
|
+
}
|
29
|
+
SCSS
|
30
|
+
|
31
|
+
it { should report_lint line: 2 }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when a property contains a color keyword as a string' do
|
35
|
+
let(:scss) { <<-SCSS }
|
36
|
+
p {
|
37
|
+
content: 'white';
|
38
|
+
}
|
39
|
+
SCSS
|
40
|
+
|
41
|
+
it { should_not report_lint }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when a function call contains a color keyword' do
|
45
|
+
let(:scss) { <<-SCSS }
|
46
|
+
p {
|
47
|
+
color: function(red);
|
48
|
+
}
|
49
|
+
SCSS
|
50
|
+
|
51
|
+
it { should report_lint line: 2 }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when a mixin include contains a color keyword' do
|
55
|
+
let(:scss) { <<-SCSS }
|
56
|
+
p {
|
57
|
+
@include some-mixin(red);
|
58
|
+
}
|
59
|
+
SCSS
|
60
|
+
|
61
|
+
it { should report_lint line: 2 }
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'when the "transparent" color keyword is used' do
|
65
|
+
let(:scss) { <<-SCSS }
|
66
|
+
p {
|
67
|
+
@include mixin(transparent);
|
68
|
+
}
|
69
|
+
SCSS
|
70
|
+
|
71
|
+
it { should_not report_lint }
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'when color keyword appears in a string identifier' do
|
75
|
+
let(:scss) { <<-SCSS }
|
76
|
+
p {
|
77
|
+
content: content-with-blue-in-name;
|
78
|
+
}
|
79
|
+
SCSS
|
80
|
+
|
81
|
+
it { should_not report_lint }
|
82
|
+
end
|
83
|
+
end
|