scss-lint 0.25.1 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +10 -1
- data/data/property-sort-orders/concentric.txt +99 -0
- data/lib/scss_lint.rb +1 -0
- data/lib/scss_lint/cli.rb +9 -3
- data/lib/scss_lint/exceptions.rb +4 -0
- data/lib/scss_lint/linter.rb +10 -1
- data/lib/scss_lint/linter/capitalization_in_selector.rb +14 -6
- data/lib/scss_lint/linter/compass/property_with_mixin.rb +9 -2
- data/lib/scss_lint/linter/indentation.rb +28 -6
- data/lib/scss_lint/linter/property_sort_order.rb +61 -9
- data/lib/scss_lint/linter/single_line_per_property.rb +53 -0
- data/lib/scss_lint/linter/single_line_per_selector.rb +6 -1
- data/lib/scss_lint/linter/space_after_comma.rb +27 -19
- data/lib/scss_lint/linter/space_before_brace.rb +5 -4
- data/lib/scss_lint/linter/trailing_semicolon.rb +53 -0
- data/lib/scss_lint/linter/unnecessary_parent_reference.rb +36 -0
- data/lib/scss_lint/reporter/default_reporter.rb +7 -2
- data/lib/scss_lint/reporter/xml_reporter.rb +2 -1
- data/lib/scss_lint/runner.rb +7 -3
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/cli_spec.rb +314 -0
- data/spec/scss_lint/config_spec.rb +439 -0
- data/spec/scss_lint/engine_spec.rb +24 -0
- data/spec/scss_lint/linter/border_zero_spec.rb +84 -0
- data/spec/scss_lint/linter/capitalization_in_selector_spec.rb +71 -0
- data/spec/scss_lint/linter/color_keyword_spec.rb +83 -0
- data/spec/scss_lint/linter/comment_spec.rb +55 -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 +94 -0
- data/spec/scss_lint/linter/duplicate_property_spec.rb +176 -0
- data/spec/scss_lint/linter/else_placement_spec.rb +106 -0
- data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +263 -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 +36 -0
- data/spec/scss_lint/linter/id_with_extraneous_selector_spec.rb +139 -0
- data/spec/scss_lint/linter/indentation_spec.rb +242 -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 +206 -0
- data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +63 -0
- data/spec/scss_lint/linter/property_sort_order_spec.rb +246 -0
- data/spec/scss_lint/linter/property_spelling_spec.rb +57 -0
- data/spec/scss_lint/linter/selector_depth_spec.rb +159 -0
- data/spec/scss_lint/linter/shorthand_spec.rb +172 -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 +121 -0
- data/spec/scss_lint/linter/space_after_comma_spec.rb +315 -0
- data/spec/scss_lint/linter/space_after_property_colon_spec.rb +238 -0
- data/spec/scss_lint/linter/space_after_property_name_spec.rb +23 -0
- data/spec/scss_lint/linter/space_before_brace_spec.rb +447 -0
- data/spec/scss_lint/linter/space_between_parens_spec.rb +263 -0
- data/spec/scss_lint/linter/string_quotes_spec.rb +303 -0
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +188 -0
- data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +67 -0
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +67 -0
- data/spec/scss_lint/linter/url_format_spec.rb +55 -0
- data/spec/scss_lint/linter/url_quotes_spec.rb +63 -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/location_spec.rb +42 -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/xml_reporter_spec.rb +103 -0
- data/spec/scss_lint/reporter_spec.rb +11 -0
- data/spec/scss_lint/runner_spec.rb +132 -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 +126 -8
- data/lib/scss_lint/linter/trailing_semicolon_after_property_value.rb +0 -40
@@ -0,0 +1,188 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::TrailingSemicolon do
|
4
|
+
context 'when a property does not end with a semicolon' do
|
5
|
+
let(:css) { <<-CSS }
|
6
|
+
p {
|
7
|
+
margin: 0
|
8
|
+
}
|
9
|
+
CSS
|
10
|
+
|
11
|
+
it { should report_lint line: 2 }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when a property ends with a semicolon' do
|
15
|
+
let(:css) { <<-CSS }
|
16
|
+
p {
|
17
|
+
margin: 0;
|
18
|
+
}
|
19
|
+
CSS
|
20
|
+
|
21
|
+
it { should_not report_lint }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when a property ends with a space followed by a semicolon' do
|
25
|
+
let(:css) { <<-CSS }
|
26
|
+
p {
|
27
|
+
margin: 0 ;
|
28
|
+
}
|
29
|
+
CSS
|
30
|
+
|
31
|
+
it { should report_lint line: 2 }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when a property ends with a semicolon and is followed by a comment' do
|
35
|
+
let(:css) { <<-CSS }
|
36
|
+
p {
|
37
|
+
margin: 0; // This is a comment
|
38
|
+
padding: 0; /* This is another comment */
|
39
|
+
}
|
40
|
+
CSS
|
41
|
+
|
42
|
+
it { should_not report_lint }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when a property contains nested properties' do
|
46
|
+
context 'and there is a value on the namespace' do
|
47
|
+
let(:css) { <<-CSS }
|
48
|
+
p {
|
49
|
+
font: 2px/3px {
|
50
|
+
style: italic;
|
51
|
+
weight: bold;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
CSS
|
55
|
+
|
56
|
+
it { should_not report_lint }
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'and there is no value on the namespace' do
|
60
|
+
let(:css) { <<-CSS }
|
61
|
+
p {
|
62
|
+
font: {
|
63
|
+
style: italic;
|
64
|
+
weight: bold;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
CSS
|
68
|
+
|
69
|
+
it { should_not report_lint }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when a nested property does not end with a semicolon' do
|
74
|
+
let(:css) { <<-CSS }
|
75
|
+
p {
|
76
|
+
font: {
|
77
|
+
weight: bold
|
78
|
+
}
|
79
|
+
}
|
80
|
+
CSS
|
81
|
+
|
82
|
+
it { should report_lint line: 3 }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when a multi-line property ends with a semicolon' do
|
86
|
+
let(:css) { <<-CSS }
|
87
|
+
p {
|
88
|
+
background:
|
89
|
+
top repeat-x url('top-image.jpg'),
|
90
|
+
right repeat-y url('right-image.jpg'),
|
91
|
+
bottom repeat-x url('bottom-image.jpg'),
|
92
|
+
left repeat-y url('left-image.jpg');
|
93
|
+
}
|
94
|
+
CSS
|
95
|
+
|
96
|
+
it { should_not report_lint }
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when a multi-line property does not end with a semicolon' do
|
100
|
+
let(:css) { <<-CSS }
|
101
|
+
p {
|
102
|
+
background:
|
103
|
+
top repeat-x url('top-image.jpg'),
|
104
|
+
right repeat-y url('right-image.jpg'),
|
105
|
+
bottom repeat-x url('bottom-image.jpg'),
|
106
|
+
left repeat-y url('left-image.jpg')
|
107
|
+
}
|
108
|
+
CSS
|
109
|
+
|
110
|
+
it { should report_lint line: 2 }
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'when a oneline rule does not end with a semicolon' do
|
114
|
+
let(:css) { <<-CSS }
|
115
|
+
.foo { border: 0 }
|
116
|
+
CSS
|
117
|
+
|
118
|
+
it { should report_lint line: 1 }
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'when a oneline rule has a space before a semicolon' do
|
122
|
+
let(:css) { <<-CSS }
|
123
|
+
.foo { border: 0 ; }
|
124
|
+
CSS
|
125
|
+
|
126
|
+
it { should report_lint line: 1 }
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'when @extend does not end with a semicolon' do
|
130
|
+
let(:css) { <<-CSS }
|
131
|
+
.foo {
|
132
|
+
@extend %bar
|
133
|
+
}
|
134
|
+
CSS
|
135
|
+
|
136
|
+
it { should report_lint line: 2 }
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'when @extend ends with a semicolon' do
|
140
|
+
let(:css) { <<-CSS }
|
141
|
+
.foo {
|
142
|
+
@extend %bar;
|
143
|
+
}
|
144
|
+
CSS
|
145
|
+
|
146
|
+
it { should_not report_lint }
|
147
|
+
end
|
148
|
+
|
149
|
+
context 'when @include does not end with a semicolon' do
|
150
|
+
let(:css) { <<-CSS }
|
151
|
+
.foo {
|
152
|
+
@include bar
|
153
|
+
}
|
154
|
+
CSS
|
155
|
+
|
156
|
+
it { should report_lint line: 2 }
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'when @extend ends with a semicolon' do
|
160
|
+
let(:css) { <<-CSS }
|
161
|
+
.foo {
|
162
|
+
@include bar;
|
163
|
+
}
|
164
|
+
CSS
|
165
|
+
|
166
|
+
it { should_not report_lint }
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'when variable declaration does not end with a semicolon' do
|
170
|
+
let(:css) { <<-CSS }
|
171
|
+
.foo {
|
172
|
+
$bar: 1
|
173
|
+
}
|
174
|
+
CSS
|
175
|
+
|
176
|
+
it { should report_lint line: 2 }
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'when @extend ends with a semicolon' do
|
180
|
+
let(:css) { <<-CSS }
|
181
|
+
.foo {
|
182
|
+
$bar: 1;
|
183
|
+
}
|
184
|
+
CSS
|
185
|
+
|
186
|
+
it { should_not report_lint }
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::UnnecessaryMantissa do
|
4
|
+
context 'when value is zero' do
|
5
|
+
let(:css) { <<-CSS }
|
6
|
+
p {
|
7
|
+
margin: 0;
|
8
|
+
padding: func(0);
|
9
|
+
top: 0em;
|
10
|
+
}
|
11
|
+
CSS
|
12
|
+
|
13
|
+
it { should_not report_lint }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when value contains no mantissa' do
|
17
|
+
let(:css) { <<-CSS }
|
18
|
+
p {
|
19
|
+
margin: 1;
|
20
|
+
padding: func(1);
|
21
|
+
top: 1em;
|
22
|
+
}
|
23
|
+
CSS
|
24
|
+
|
25
|
+
it { should_not report_lint }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when value contains a mantissa with a zero' do
|
29
|
+
let(:css) { <<-CSS }
|
30
|
+
p {
|
31
|
+
margin: 1.0;
|
32
|
+
padding: func(1.0);
|
33
|
+
top: 1.0em;
|
34
|
+
}
|
35
|
+
CSS
|
36
|
+
|
37
|
+
it { should report_lint line: 2 }
|
38
|
+
it { should report_lint line: 3 }
|
39
|
+
it { should report_lint line: 4 }
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'when value contains a mantissa with multiple zeroes' do
|
43
|
+
let(:css) { <<-CSS }
|
44
|
+
p {
|
45
|
+
margin: 1.000;
|
46
|
+
padding: func(1.000);
|
47
|
+
top: 1.000em;
|
48
|
+
}
|
49
|
+
CSS
|
50
|
+
|
51
|
+
it { should report_lint line: 2 }
|
52
|
+
it { should report_lint line: 3 }
|
53
|
+
it { should report_lint line: 4 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when value contains a mantissa with multiple zeroes followed by a number' do
|
57
|
+
let(:css) { <<-CSS }
|
58
|
+
p {
|
59
|
+
margin: 1.0001;
|
60
|
+
padding: func(1.0001);
|
61
|
+
top: 1.0001em;
|
62
|
+
}
|
63
|
+
CSS
|
64
|
+
|
65
|
+
it { should_not report_lint }
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::UnnecessaryParentReference do
|
4
|
+
context 'when an amperand precedes a direct descendant operator' do
|
5
|
+
let(:css) { <<-CSS }
|
6
|
+
p {
|
7
|
+
& > a {}
|
8
|
+
}
|
9
|
+
CSS
|
10
|
+
|
11
|
+
it { should report_lint line: 2 }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when an amperand precedes a general child' do
|
15
|
+
let(:css) { <<-CSS }
|
16
|
+
p {
|
17
|
+
& a {}
|
18
|
+
}
|
19
|
+
CSS
|
20
|
+
|
21
|
+
it { should report_lint line: 2 }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when an amperand is chained with class' do
|
25
|
+
let(:css) { <<-CSS }
|
26
|
+
p {
|
27
|
+
&.foo {}
|
28
|
+
}
|
29
|
+
CSS
|
30
|
+
|
31
|
+
it { should_not report_lint }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when an amperand follows a direct descendant operator' do
|
35
|
+
let(:css) { <<-CSS }
|
36
|
+
p {
|
37
|
+
.foo > & {}
|
38
|
+
}
|
39
|
+
CSS
|
40
|
+
|
41
|
+
it { should_not report_lint }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when an amperand is used in a comma sequence to DRY up code' do
|
45
|
+
let(:css) { <<-CSS }
|
46
|
+
p {
|
47
|
+
&,
|
48
|
+
.foo,
|
49
|
+
.bar {
|
50
|
+
margin: 0;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
CSS
|
54
|
+
|
55
|
+
it { should_not report_lint }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when an ampersand is used by itself' do
|
59
|
+
let(:css) { <<-CSS }
|
60
|
+
p {
|
61
|
+
& {}
|
62
|
+
}
|
63
|
+
CSS
|
64
|
+
|
65
|
+
it { should report_lint line: 2 }
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::UrlFormat do
|
4
|
+
shared_examples_for 'UrlFormat linter' do
|
5
|
+
context 'when URL contains protocol' do
|
6
|
+
let(:url) { 'https://something.com/image.png' }
|
7
|
+
|
8
|
+
it { should report_lint }
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'when URL contains domain with protocol-less double slashes' do
|
12
|
+
let(:url) { '//something.com/image.png' }
|
13
|
+
|
14
|
+
it { should report_lint }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when URL contains absolute path' do
|
18
|
+
let(:url) { '/absolute/path/to/image.png' }
|
19
|
+
|
20
|
+
it { should_not report_lint }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when URL contains relative path' do
|
24
|
+
let(:url) { 'relative/path/to/image.png' }
|
25
|
+
|
26
|
+
it { should_not report_lint }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when URL is a data URI' do
|
30
|
+
let(:url) { 'data:image/png;base64,iVBORI=' }
|
31
|
+
|
32
|
+
it { should_not report_lint }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when URL is enclosed in quotes' do
|
37
|
+
let(:css) { <<-CSS }
|
38
|
+
.block {
|
39
|
+
background: url('#{url}');
|
40
|
+
}
|
41
|
+
CSS
|
42
|
+
|
43
|
+
it_should_behave_like 'UrlFormat linter'
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when URL is not enclosed in quotes' do
|
47
|
+
let(:css) { <<-CSS }
|
48
|
+
.block {
|
49
|
+
background: url(#{url});
|
50
|
+
}
|
51
|
+
CSS
|
52
|
+
|
53
|
+
it_should_behave_like 'UrlFormat linter'
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::UrlQuotes do
|
4
|
+
context 'when property has a literal URL' do
|
5
|
+
let(:css) { <<-CSS }
|
6
|
+
p {
|
7
|
+
background: url(example.png);
|
8
|
+
}
|
9
|
+
CSS
|
10
|
+
|
11
|
+
it { should report_lint line: 2 }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when property has a URL enclosed in single quotes' do
|
15
|
+
let(:css) { <<-CSS }
|
16
|
+
p {
|
17
|
+
background: url('example.png');
|
18
|
+
}
|
19
|
+
CSS
|
20
|
+
|
21
|
+
it { should_not report_lint }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when property has a URL enclosed in double quotes' do
|
25
|
+
let(:css) { <<-CSS }
|
26
|
+
p {
|
27
|
+
background: url("example.png");
|
28
|
+
}
|
29
|
+
CSS
|
30
|
+
|
31
|
+
it { should_not report_lint }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when property has a literal URL in a list' do
|
35
|
+
let(:css) { <<-CSS }
|
36
|
+
p {
|
37
|
+
background: transparent url(example.png);
|
38
|
+
}
|
39
|
+
CSS
|
40
|
+
|
41
|
+
it { should report_lint line: 2 }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when property has a single-quoted URL in a list' do
|
45
|
+
let(:css) { <<-CSS }
|
46
|
+
p {
|
47
|
+
background: transparent url('example.png');
|
48
|
+
}
|
49
|
+
CSS
|
50
|
+
|
51
|
+
it { should_not report_lint }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when property has a double-quoted URL in a list' do
|
55
|
+
let(:css) { <<-CSS }
|
56
|
+
p {
|
57
|
+
background: transparent url("example.png");
|
58
|
+
}
|
59
|
+
CSS
|
60
|
+
|
61
|
+
it { should_not report_lint }
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::ZeroUnit do
|
4
|
+
context 'when no properties exist' do
|
5
|
+
let(:css) { <<-CSS }
|
6
|
+
p {
|
7
|
+
}
|
8
|
+
CSS
|
9
|
+
|
10
|
+
it { should_not report_lint }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when properties with unit-less zeros exist' do
|
14
|
+
let(:css) { <<-CSS }
|
15
|
+
p {
|
16
|
+
margin: 0;
|
17
|
+
}
|
18
|
+
CSS
|
19
|
+
|
20
|
+
it { should_not report_lint }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when properties with non-zero values exist' do
|
24
|
+
let(:css) { <<-CSS }
|
25
|
+
p {
|
26
|
+
margin: 5px;
|
27
|
+
line-height: 1.5em;
|
28
|
+
}
|
29
|
+
CSS
|
30
|
+
|
31
|
+
it { should_not report_lint }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when properties with zero values contain units' do
|
35
|
+
let(:css) { <<-CSS }
|
36
|
+
p {
|
37
|
+
margin: 0px;
|
38
|
+
}
|
39
|
+
CSS
|
40
|
+
|
41
|
+
it { should report_lint line: 2 }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when properties with multiple zero values containing units exist' do
|
45
|
+
let(:css) { <<-CSS }
|
46
|
+
p {
|
47
|
+
margin: 5em 0em 2em 0px;
|
48
|
+
}
|
49
|
+
CSS
|
50
|
+
|
51
|
+
it { should report_lint line: 2, count: 2 }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when function call contains a zero value with units' do
|
55
|
+
let(:css) { <<-CSS }
|
56
|
+
p {
|
57
|
+
margin: some-function(0em);
|
58
|
+
}
|
59
|
+
CSS
|
60
|
+
|
61
|
+
it { should report_lint line: 2 }
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'when mixin include contains a zero value with units' do
|
65
|
+
let(:css) { <<-CSS }
|
66
|
+
p {
|
67
|
+
@include some-mixin(0em);
|
68
|
+
}
|
69
|
+
CSS
|
70
|
+
|
71
|
+
it { should report_lint line: 2 }
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'when string contains a zero value with units' do
|
75
|
+
let(:css) { <<-CSS }
|
76
|
+
p {
|
77
|
+
content: func("0em");
|
78
|
+
}
|
79
|
+
CSS
|
80
|
+
|
81
|
+
it { should_not report_lint }
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'when property value has a ".0" fractional component' do
|
85
|
+
let(:css) { <<-CSS }
|
86
|
+
p {
|
87
|
+
margin: 4.0em;
|
88
|
+
}
|
89
|
+
CSS
|
90
|
+
|
91
|
+
it { should_not report_lint }
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'when property value has a color hex with a leading 0' do
|
95
|
+
let(:css) { <<-CSS }
|
96
|
+
p {
|
97
|
+
color: #0af;
|
98
|
+
}
|
99
|
+
CSS
|
100
|
+
|
101
|
+
it { should_not report_lint }
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'when property with zero value is a dimension' do
|
105
|
+
let(:css) { <<-CSS }
|
106
|
+
p {
|
107
|
+
transition-delay: 0s;
|
108
|
+
}
|
109
|
+
CSS
|
110
|
+
|
111
|
+
it { should_not report_lint }
|
112
|
+
end
|
113
|
+
end
|