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,37 +2,37 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::UnnecessaryMantissa do
|
4
4
|
context 'when value is zero' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
margin: 0;
|
8
8
|
padding: func(0);
|
9
9
|
top: 0em;
|
10
10
|
}
|
11
|
-
|
11
|
+
SCSS
|
12
12
|
|
13
13
|
it { should_not report_lint }
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'when value contains no mantissa' do
|
17
|
-
let(:
|
17
|
+
let(:scss) { <<-SCSS }
|
18
18
|
p {
|
19
19
|
margin: 1;
|
20
20
|
padding: func(1);
|
21
21
|
top: 1em;
|
22
22
|
}
|
23
|
-
|
23
|
+
SCSS
|
24
24
|
|
25
25
|
it { should_not report_lint }
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'when value contains a mantissa with a zero' do
|
29
|
-
let(:
|
29
|
+
let(:scss) { <<-SCSS }
|
30
30
|
p {
|
31
31
|
margin: 1.0;
|
32
32
|
padding: func(1.0);
|
33
33
|
top: 1.0em;
|
34
34
|
}
|
35
|
-
|
35
|
+
SCSS
|
36
36
|
|
37
37
|
it { should report_lint line: 2 }
|
38
38
|
it { should report_lint line: 3 }
|
@@ -40,13 +40,13 @@ describe SCSSLint::Linter::UnnecessaryMantissa do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'when value contains a mantissa with multiple zeroes' do
|
43
|
-
let(:
|
43
|
+
let(:scss) { <<-SCSS }
|
44
44
|
p {
|
45
45
|
margin: 1.000;
|
46
46
|
padding: func(1.000);
|
47
47
|
top: 1.000em;
|
48
48
|
}
|
49
|
-
|
49
|
+
SCSS
|
50
50
|
|
51
51
|
it { should report_lint line: 2 }
|
52
52
|
it { should report_lint line: 3 }
|
@@ -54,13 +54,13 @@ describe SCSSLint::Linter::UnnecessaryMantissa do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when value contains a mantissa with multiple zeroes followed by a number' do
|
57
|
-
let(:
|
57
|
+
let(:scss) { <<-SCSS }
|
58
58
|
p {
|
59
59
|
margin: 1.0001;
|
60
60
|
padding: func(1.0001);
|
61
61
|
top: 1.0001em;
|
62
62
|
}
|
63
|
-
|
63
|
+
SCSS
|
64
64
|
|
65
65
|
it { should_not report_lint }
|
66
66
|
end
|
@@ -2,68 +2,68 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::UnnecessaryParentReference do
|
4
4
|
context 'when an amperand precedes a direct descendant operator' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
& > a {}
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should report_lint line: 2 }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when an amperand precedes a general child' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
p {
|
17
17
|
& a {}
|
18
18
|
}
|
19
|
-
|
19
|
+
SCSS
|
20
20
|
|
21
21
|
it { should report_lint line: 2 }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'when an amperand is chained with class' do
|
25
|
-
let(:
|
25
|
+
let(:scss) { <<-SCSS }
|
26
26
|
p {
|
27
27
|
&.foo {}
|
28
28
|
}
|
29
|
-
|
29
|
+
SCSS
|
30
30
|
|
31
31
|
it { should_not report_lint }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'when an amperand follows a direct descendant operator' do
|
35
|
-
let(:
|
35
|
+
let(:scss) { <<-SCSS }
|
36
36
|
p {
|
37
37
|
.foo > & {}
|
38
38
|
}
|
39
|
-
|
39
|
+
SCSS
|
40
40
|
|
41
41
|
it { should_not report_lint }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when an ampersand precedes a sibling operator' do
|
45
|
-
let(:
|
45
|
+
let(:scss) { <<-SCSS }
|
46
46
|
p {
|
47
47
|
& + & {}
|
48
48
|
& ~ & {}
|
49
49
|
}
|
50
|
-
|
50
|
+
SCSS
|
51
51
|
|
52
52
|
it { should_not report_lint }
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'when multiple ampersands exist with one concatenated' do
|
56
|
-
let(:
|
56
|
+
let(:scss) { <<-SCSS }
|
57
57
|
p {
|
58
58
|
& + &:hover {}
|
59
59
|
}
|
60
|
-
|
60
|
+
SCSS
|
61
61
|
|
62
62
|
it { should_not report_lint }
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'when an amperand is used in a comma sequence to DRY up code' do
|
66
|
-
let(:
|
66
|
+
let(:scss) { <<-SCSS }
|
67
67
|
p {
|
68
68
|
&,
|
69
69
|
.foo,
|
@@ -71,27 +71,27 @@ describe SCSSLint::Linter::UnnecessaryParentReference do
|
|
71
71
|
margin: 0;
|
72
72
|
}
|
73
73
|
}
|
74
|
-
|
74
|
+
SCSS
|
75
75
|
|
76
76
|
it { should_not report_lint }
|
77
77
|
end
|
78
78
|
|
79
79
|
context 'when an ampersand is used by itself' do
|
80
|
-
let(:
|
80
|
+
let(:scss) { <<-SCSS }
|
81
81
|
p {
|
82
82
|
& {}
|
83
83
|
}
|
84
|
-
|
84
|
+
SCSS
|
85
85
|
|
86
86
|
it { should report_lint line: 2 }
|
87
87
|
end
|
88
88
|
|
89
89
|
context 'when an ampersand is used in concatentation' do
|
90
|
-
let(:
|
90
|
+
let(:scss) { <<-SCSS }
|
91
91
|
.icon {
|
92
92
|
&-small {}
|
93
93
|
}
|
94
|
-
|
94
|
+
SCSS
|
95
95
|
|
96
96
|
it { should_not report_lint }
|
97
97
|
end
|
@@ -34,21 +34,21 @@ describe SCSSLint::Linter::UrlFormat do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'when URL is enclosed in quotes' do
|
37
|
-
let(:
|
37
|
+
let(:scss) { <<-SCSS }
|
38
38
|
.block {
|
39
39
|
background: url('#{url}');
|
40
40
|
}
|
41
|
-
|
41
|
+
SCSS
|
42
42
|
|
43
43
|
it_should_behave_like 'UrlFormat linter'
|
44
44
|
end
|
45
45
|
|
46
46
|
context 'when URL is not enclosed in quotes' do
|
47
|
-
let(:
|
47
|
+
let(:scss) { <<-SCSS }
|
48
48
|
.block {
|
49
49
|
background: url(#{url});
|
50
50
|
}
|
51
|
-
|
51
|
+
SCSS
|
52
52
|
|
53
53
|
it_should_behave_like 'UrlFormat linter'
|
54
54
|
end
|
@@ -2,71 +2,71 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::UrlQuotes do
|
4
4
|
context 'when property has a literal URL' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
background: url(example.png);
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should report_lint line: 2 }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when property has a URL enclosed in single quotes' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
p {
|
17
17
|
background: url('example.png');
|
18
18
|
}
|
19
|
-
|
19
|
+
SCSS
|
20
20
|
|
21
21
|
it { should_not report_lint }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'when property has a URL enclosed in double quotes' do
|
25
|
-
let(:
|
25
|
+
let(:scss) { <<-SCSS }
|
26
26
|
p {
|
27
27
|
background: url("example.png");
|
28
28
|
}
|
29
|
-
|
29
|
+
SCSS
|
30
30
|
|
31
31
|
it { should_not report_lint }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'when property has a literal URL in a list' do
|
35
|
-
let(:
|
35
|
+
let(:scss) { <<-SCSS }
|
36
36
|
p {
|
37
37
|
background: transparent url(example.png);
|
38
38
|
}
|
39
|
-
|
39
|
+
SCSS
|
40
40
|
|
41
41
|
it { should report_lint line: 2 }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when property has a single-quoted URL in a list' do
|
45
|
-
let(:
|
45
|
+
let(:scss) { <<-SCSS }
|
46
46
|
p {
|
47
47
|
background: transparent url('example.png');
|
48
48
|
}
|
49
|
-
|
49
|
+
SCSS
|
50
50
|
|
51
51
|
it { should_not report_lint }
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'when property has a double-quoted URL in a list' do
|
55
|
-
let(:
|
55
|
+
let(:scss) { <<-SCSS }
|
56
56
|
p {
|
57
57
|
background: transparent url("example.png");
|
58
58
|
}
|
59
|
-
|
59
|
+
SCSS
|
60
60
|
|
61
61
|
it { should_not report_lint }
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'when property has a data URI' do
|
65
|
-
let(:
|
65
|
+
let(:scss) { <<-SCSS }
|
66
66
|
.tracking-pixel {
|
67
67
|
background: url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==);
|
68
68
|
}
|
69
|
-
|
69
|
+
SCSS
|
70
70
|
|
71
71
|
it { should_not report_lint }
|
72
72
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SCSSLint::Linter::VariableForProperty do
|
4
|
+
context 'when properties are specified' do
|
5
|
+
let(:linter_config) { { 'properties' => %w[color font] } }
|
6
|
+
|
7
|
+
context 'when configured property value is a variable' do
|
8
|
+
let(:scss) { <<-SCSS }
|
9
|
+
p {
|
10
|
+
color: $black;
|
11
|
+
}
|
12
|
+
SCSS
|
13
|
+
|
14
|
+
it { should_not report_lint }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when configured property value is a hex string' do
|
18
|
+
let(:scss) { <<-SCSS }
|
19
|
+
p {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
SCSS
|
23
|
+
|
24
|
+
it { should report_lint line: 2 }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when configured property value is a color keyword' do
|
28
|
+
let(:scss) { <<-SCSS }
|
29
|
+
p {
|
30
|
+
color: red;
|
31
|
+
}
|
32
|
+
SCSS
|
33
|
+
|
34
|
+
it { should report_lint line: 2 }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when an unspecified property value is a variable' do
|
38
|
+
let(:scss) { <<-SCSS }
|
39
|
+
p {
|
40
|
+
background-color: $black;
|
41
|
+
}
|
42
|
+
SCSS
|
43
|
+
|
44
|
+
it { should_not report_lint }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when an unspecified property value is not a variable' do
|
48
|
+
let(:scss) { <<-SCSS }
|
49
|
+
p {
|
50
|
+
background-color: #000;
|
51
|
+
}
|
52
|
+
SCSS
|
53
|
+
|
54
|
+
it { should_not report_lint }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when multiple configured property values are variables' do
|
58
|
+
let(:scss) { <<-SCSS }
|
59
|
+
p {
|
60
|
+
color: $black;
|
61
|
+
font: $small;
|
62
|
+
}
|
63
|
+
SCSS
|
64
|
+
|
65
|
+
it { should_not report_lint }
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when multiple configured property values are not variables' do
|
69
|
+
let(:scss) { <<-SCSS }
|
70
|
+
p {
|
71
|
+
color: #000;
|
72
|
+
font: 8px;
|
73
|
+
}
|
74
|
+
SCSS
|
75
|
+
|
76
|
+
it { should report_lint line: 2 }
|
77
|
+
it { should report_lint line: 3 }
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when configured property values are mixed' do
|
81
|
+
let(:scss) { <<-SCSS }
|
82
|
+
p {
|
83
|
+
color: $black;
|
84
|
+
font: 8px;
|
85
|
+
}
|
86
|
+
SCSS
|
87
|
+
|
88
|
+
it { should report_lint line: 3 }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'when properties are not specified' do
|
93
|
+
let(:linter_config) { { 'properties' => [] } }
|
94
|
+
|
95
|
+
context 'when property value is a variable' do
|
96
|
+
let(:scss) { <<-SCSS }
|
97
|
+
p {
|
98
|
+
color: $black;
|
99
|
+
}
|
100
|
+
SCSS
|
101
|
+
|
102
|
+
it { should_not report_lint }
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when property value is not a variable' do
|
106
|
+
let(:scss) { <<-SCSS }
|
107
|
+
p {
|
108
|
+
color: #000;
|
109
|
+
}
|
110
|
+
SCSS
|
111
|
+
|
112
|
+
it { should_not report_lint }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -2,20 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::VendorPrefixes do
|
4
4
|
context 'when no vendor-prefix is used' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
div {
|
7
7
|
transition: none;
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should_not report_lint }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when a rule is empty' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
div {
|
17
17
|
}
|
18
|
-
|
18
|
+
SCSS
|
19
19
|
|
20
20
|
it { should_not report_lint }
|
21
21
|
end
|
@@ -23,31 +23,31 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
23
23
|
# Properties
|
24
24
|
|
25
25
|
context 'when a vendor-prefixed listed property is used' do
|
26
|
-
let(:
|
26
|
+
let(:scss) { <<-SCSS }
|
27
27
|
div {
|
28
28
|
-webkit-transition: none;
|
29
29
|
}
|
30
|
-
|
30
|
+
SCSS
|
31
31
|
|
32
32
|
it { should report_lint line: 2 }
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when an unprefixed listed property is used' do
|
36
|
-
let(:
|
36
|
+
let(:scss) { <<-SCSS }
|
37
37
|
div {
|
38
38
|
transition: none;
|
39
39
|
}
|
40
|
-
|
40
|
+
SCSS
|
41
41
|
|
42
42
|
it { should_not report_lint }
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'when a vendor-prefixed unlisted property is used' do
|
46
|
-
let(:
|
46
|
+
let(:scss) { <<-SCSS }
|
47
47
|
div {
|
48
48
|
-webkit-appearance: none;
|
49
49
|
}
|
50
|
-
|
50
|
+
SCSS
|
51
51
|
|
52
52
|
it { should_not report_lint }
|
53
53
|
end
|
@@ -55,21 +55,21 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
55
55
|
context 'when a vendor-prefixed custom-listed property is used' do
|
56
56
|
let(:linter_config) { { 'identifier_list' => ['transform'] } }
|
57
57
|
|
58
|
-
let(:
|
58
|
+
let(:scss) { <<-SCSS }
|
59
59
|
div {
|
60
60
|
-webkit-transform: none;
|
61
61
|
}
|
62
|
-
|
62
|
+
SCSS
|
63
63
|
|
64
64
|
it { should report_lint line: 2 }
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'when a proprietary unlisted vendor-prefixed property is used' do
|
68
|
-
let(:
|
68
|
+
let(:scss) { <<-SCSS }
|
69
69
|
div {
|
70
70
|
-moz-padding-end: 0;
|
71
71
|
}
|
72
|
-
|
72
|
+
SCSS
|
73
73
|
|
74
74
|
it { should_not report_lint }
|
75
75
|
end
|
@@ -77,11 +77,11 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
77
77
|
context 'when a proprietary listed vendor-prefixed property is used' do
|
78
78
|
let(:linter_config) { { 'identifier_list' => ['padding-end'] } }
|
79
79
|
|
80
|
-
let(:
|
80
|
+
let(:scss) { <<-SCSS }
|
81
81
|
div {
|
82
82
|
-moz-padding-end: 0;
|
83
83
|
}
|
84
|
-
|
84
|
+
SCSS
|
85
85
|
|
86
86
|
it { should report_lint line: 2 }
|
87
87
|
end
|
@@ -89,7 +89,7 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
89
89
|
# Selectors
|
90
90
|
|
91
91
|
context 'when a vendor-prefixed listed selector is used' do
|
92
|
-
let(:
|
92
|
+
let(:scss) { <<-SCSS }
|
93
93
|
::-moz-placeholder {
|
94
94
|
color: red;
|
95
95
|
}
|
@@ -99,7 +99,7 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
99
99
|
:-moz-fullscreen p {
|
100
100
|
font-size: 200%;
|
101
101
|
}
|
102
|
-
|
102
|
+
SCSS
|
103
103
|
|
104
104
|
it { should report_lint line: 1 }
|
105
105
|
it { should report_lint line: 4 }
|
@@ -107,14 +107,14 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
context 'when an unprefixed listed selector is used' do
|
110
|
-
let(:
|
110
|
+
let(:scss) { <<-SCSS }
|
111
111
|
::placeholder {
|
112
112
|
color: red;
|
113
113
|
}
|
114
114
|
:fullscreen p {
|
115
115
|
font-size: 200%;
|
116
116
|
}
|
117
|
-
|
117
|
+
SCSS
|
118
118
|
|
119
119
|
it { should_not report_lint }
|
120
120
|
end
|
@@ -122,11 +122,11 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
122
122
|
context 'when a vendor-prefixed unlisted selector is used' do
|
123
123
|
let(:linter_config) { { 'identifier_list' => ['transform'] } }
|
124
124
|
|
125
|
-
let(:
|
125
|
+
let(:scss) { <<-SCSS }
|
126
126
|
::-moz-placeholder {
|
127
127
|
color: red;
|
128
128
|
}
|
129
|
-
|
129
|
+
SCSS
|
130
130
|
|
131
131
|
it { should_not report_lint }
|
132
132
|
end
|
@@ -134,11 +134,11 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
134
134
|
context 'when a vendor-prefixed custom-listed selector is used' do
|
135
135
|
let(:linter_config) { { 'identifier_list' => ['placeholder'] } }
|
136
136
|
|
137
|
-
let(:
|
137
|
+
let(:scss) { <<-SCSS }
|
138
138
|
::-moz-placeholder {
|
139
139
|
color: red;
|
140
140
|
}
|
141
|
-
|
141
|
+
SCSS
|
142
142
|
|
143
143
|
it { should report_lint line: 1 }
|
144
144
|
end
|
@@ -146,21 +146,21 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
146
146
|
# Directives
|
147
147
|
|
148
148
|
context 'when a vendor-prefixed listed directive is used' do
|
149
|
-
let(:
|
149
|
+
let(:scss) { <<-SCSS }
|
150
150
|
@-webkit-keyframes anim {
|
151
151
|
0% { opacity: 0; }
|
152
152
|
}
|
153
|
-
|
153
|
+
SCSS
|
154
154
|
|
155
155
|
it { should report_lint line: 1 }
|
156
156
|
end
|
157
157
|
|
158
158
|
context 'when an unprefixed listed directive is used' do
|
159
|
-
let(:
|
159
|
+
let(:scss) { <<-SCSS }
|
160
160
|
@keyframes anim {
|
161
161
|
0% { opacity: 0; }
|
162
162
|
}
|
163
|
-
|
163
|
+
SCSS
|
164
164
|
|
165
165
|
it { should_not report_lint }
|
166
166
|
end
|
@@ -168,11 +168,11 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
168
168
|
context 'when an vendor-prefixed unlisted directive is used' do
|
169
169
|
let(:linter_config) { { 'identifier_list' => ['placeholder'] } }
|
170
170
|
|
171
|
-
let(:
|
171
|
+
let(:scss) { <<-SCSS }
|
172
172
|
@-webkit-keyframes anim {
|
173
173
|
0% { opacity: 0; }
|
174
174
|
}
|
175
|
-
|
175
|
+
SCSS
|
176
176
|
|
177
177
|
it { should_not report_lint }
|
178
178
|
end
|
@@ -180,11 +180,11 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
180
180
|
context 'when an vendor-prefixed custom-listed directive is used' do
|
181
181
|
let(:linter_config) { { 'identifier_list' => ['keyframes'] } }
|
182
182
|
|
183
|
-
let(:
|
183
|
+
let(:scss) { <<-SCSS }
|
184
184
|
@-webkit-keyframes anim {
|
185
185
|
0% { opacity: 0; }
|
186
186
|
}
|
187
|
-
|
187
|
+
SCSS
|
188
188
|
|
189
189
|
it { should report_lint line: 1 }
|
190
190
|
end
|
@@ -192,23 +192,23 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
192
192
|
# Values
|
193
193
|
|
194
194
|
context 'when a vendor-prefixed listed value is used' do
|
195
|
-
let(:
|
195
|
+
let(:scss) { <<-SCSS }
|
196
196
|
div {
|
197
197
|
background-image: -webkit-linear-gradient(#000, #fff);
|
198
198
|
position: -moz-sticky;
|
199
199
|
}
|
200
|
-
|
200
|
+
SCSS
|
201
201
|
|
202
202
|
it { should report_lint line: 2 }
|
203
203
|
it { should report_lint line: 3 }
|
204
204
|
end
|
205
205
|
|
206
206
|
context 'when an unprefixed listed value is used' do
|
207
|
-
let(:
|
207
|
+
let(:scss) { <<-SCSS }
|
208
208
|
div {
|
209
209
|
background-image: linear-gradient(#000, #fff);
|
210
210
|
}
|
211
|
-
|
211
|
+
SCSS
|
212
212
|
|
213
213
|
it { should_not report_lint }
|
214
214
|
end
|
@@ -216,12 +216,12 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
216
216
|
context 'when a vendor-unprefixed unlisted value is used' do
|
217
217
|
let(:linter_config) { { 'identifier_list' => ['keyframes'] } }
|
218
218
|
|
219
|
-
let(:
|
219
|
+
let(:scss) { <<-SCSS }
|
220
220
|
div {
|
221
221
|
background-image: -webkit-linear-gradient(#000, #fff);
|
222
222
|
position: -moz-sticky;
|
223
223
|
}
|
224
|
-
|
224
|
+
SCSS
|
225
225
|
|
226
226
|
it { should_not report_lint }
|
227
227
|
end
|
@@ -229,12 +229,12 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
229
229
|
context 'when a vendor-unprefixed custom-listed value is used' do
|
230
230
|
let(:linter_config) { { 'identifier_list' => ['linear-gradient'] } }
|
231
231
|
|
232
|
-
let(:
|
232
|
+
let(:scss) { <<-SCSS }
|
233
233
|
div {
|
234
234
|
background-image: -webkit-linear-gradient(#000, #fff);
|
235
235
|
position: -moz-sticky;
|
236
236
|
}
|
237
|
-
|
237
|
+
SCSS
|
238
238
|
|
239
239
|
it { should report_lint line: 2 }
|
240
240
|
end
|
@@ -245,33 +245,33 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
245
245
|
let(:linter_config) { { 'identifier_list' => 'bourbon' } }
|
246
246
|
|
247
247
|
context 'and a standard vendor-prefixed property is used' do
|
248
|
-
let(:
|
248
|
+
let(:scss) { <<-SCSS }
|
249
249
|
div {
|
250
250
|
background-image: -webkit-linear-gradient(#000, #fff);
|
251
251
|
}
|
252
|
-
|
252
|
+
SCSS
|
253
253
|
|
254
254
|
it { should report_lint line: 2 }
|
255
255
|
end
|
256
256
|
|
257
257
|
context 'and a list-specific vendor-prefixed property is used' do
|
258
|
-
let(:
|
258
|
+
let(:scss) { <<-SCSS }
|
259
259
|
div {
|
260
260
|
image-rendering: -moz-crisp-edges;
|
261
261
|
-webkit-appearance: none;
|
262
262
|
}
|
263
|
-
|
263
|
+
SCSS
|
264
264
|
|
265
265
|
it { should report_lint line: 2 }
|
266
266
|
it { should report_lint line: 3 }
|
267
267
|
end
|
268
268
|
|
269
269
|
context 'and a list-exempt vendor-prefixed property is used' do
|
270
|
-
let(:
|
270
|
+
let(:scss) { <<-SCSS }
|
271
271
|
div {
|
272
272
|
-webkit-mask-repeat: inherit;
|
273
273
|
}
|
274
|
-
|
274
|
+
SCSS
|
275
275
|
|
276
276
|
it { should_not report_lint }
|
277
277
|
end
|
@@ -282,14 +282,14 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
282
282
|
context 'when manually excluding identifiers' do
|
283
283
|
let(:linter_config) { { 'exclude' => %w[transform selection] } }
|
284
284
|
|
285
|
-
let(:
|
285
|
+
let(:scss) { <<-SCSS }
|
286
286
|
div {
|
287
287
|
-wekit-transform: translateZ(0);
|
288
288
|
}
|
289
289
|
::-moz-selection {
|
290
290
|
color: #000;
|
291
291
|
}
|
292
|
-
|
292
|
+
SCSS
|
293
293
|
|
294
294
|
it { should_not report_lint }
|
295
295
|
end
|
@@ -297,24 +297,24 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
297
297
|
context 'when manually including identifiers' do
|
298
298
|
let(:linter_config) { { 'include' => ['padding-end'] } }
|
299
299
|
|
300
|
-
let(:
|
300
|
+
let(:scss) { <<-SCSS }
|
301
301
|
div {
|
302
302
|
-moz-padding-end: 0;
|
303
303
|
}
|
304
|
-
|
304
|
+
SCSS
|
305
305
|
|
306
306
|
it { should report_lint line: 2 }
|
307
307
|
end
|
308
308
|
|
309
309
|
# More
|
310
310
|
context 'when dealing with many-hyphened vendor-prefixed identifiers' do
|
311
|
-
let(:
|
311
|
+
let(:scss) { <<-SCSS }
|
312
312
|
div {
|
313
313
|
-moz-animation-timing-function: ease-out;
|
314
314
|
-webkit-border-bottom-right-radius: 5px;
|
315
315
|
background: -o-repeating-radial-gradient(#000, #000 5px, #fff 5px, #fff 10px)
|
316
316
|
}
|
317
|
-
|
317
|
+
SCSS
|
318
318
|
|
319
319
|
it { should report_lint line: 2 }
|
320
320
|
it { should report_lint line: 3 }
|
@@ -322,19 +322,19 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
322
322
|
end
|
323
323
|
|
324
324
|
context 'when dealing with many-hyphened unprefixed identifiers' do
|
325
|
-
let(:
|
325
|
+
let(:scss) { <<-SCSS }
|
326
326
|
div {
|
327
327
|
animation-timing-function: ease-out;
|
328
328
|
border-bottom-right-radius: 5px;
|
329
329
|
background: repeating-radial-gradient(#000, #000 5px, #fff 5px, #fff 10px)
|
330
330
|
}
|
331
|
-
|
331
|
+
SCSS
|
332
332
|
|
333
333
|
it { should_not report_lint }
|
334
334
|
end
|
335
335
|
|
336
336
|
context 'when vendor-prefixed media queries are used' do
|
337
|
-
let(:
|
337
|
+
let(:scss) { <<-SCSS }
|
338
338
|
@media
|
339
339
|
only screen and (-webkit-min-device-pixel-ratio: 1.3),
|
340
340
|
only screen and (-o-min-device-pixel-ratio: 13/10),
|
@@ -343,7 +343,17 @@ describe SCSSLint::Linter::VendorPrefixes do
|
|
343
343
|
background: #fff;
|
344
344
|
}
|
345
345
|
}
|
346
|
-
|
346
|
+
SCSS
|
347
|
+
|
348
|
+
it { should_not report_lint }
|
349
|
+
end
|
350
|
+
|
351
|
+
context 'when property contains a list literal with an empty list' do
|
352
|
+
let(:scss) { <<-SCSS }
|
353
|
+
p {
|
354
|
+
content: 0 ();
|
355
|
+
}
|
356
|
+
SCSS
|
347
357
|
|
348
358
|
it { should_not report_lint }
|
349
359
|
end
|