scss-lint 0.33.0 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/config/default.yml +19 -1
  3. data/data/properties.txt +4 -0
  4. data/lib/scss_lint.rb +1 -0
  5. data/lib/scss_lint/cli.rb +4 -42
  6. data/lib/scss_lint/config.rb +1 -45
  7. data/lib/scss_lint/control_comment_processor.rb +47 -15
  8. data/lib/scss_lint/file_finder.rb +57 -0
  9. data/lib/scss_lint/linter/bang_format.rb +1 -1
  10. data/lib/scss_lint/linter/border_zero.rb +25 -9
  11. data/lib/scss_lint/linter/color_keyword.rb +3 -13
  12. data/lib/scss_lint/linter/color_variable.rb +36 -0
  13. data/lib/scss_lint/linter/declaration_order.rb +2 -2
  14. data/lib/scss_lint/linter/important_rule.rb +12 -0
  15. data/lib/scss_lint/linter/indentation.rb +7 -1
  16. data/lib/scss_lint/linter/property_count.rb +44 -0
  17. data/lib/scss_lint/linter/property_sort_order.rb +73 -19
  18. data/lib/scss_lint/linter/string_quotes.rb +9 -0
  19. data/lib/scss_lint/linter/variable_for_property.rb +20 -0
  20. data/lib/scss_lint/linter/vendor_prefixes.rb +3 -3
  21. data/lib/scss_lint/runner.rb +5 -7
  22. data/lib/scss_lint/utils.rb +34 -0
  23. data/lib/scss_lint/version.rb +1 -1
  24. data/spec/scss_lint/cli_spec.rb +1 -1
  25. data/spec/scss_lint/config_spec.rb +4 -203
  26. data/spec/scss_lint/engine_spec.rb +4 -4
  27. data/spec/scss_lint/file_finder_spec.rb +110 -0
  28. data/spec/scss_lint/linter/bang_format_spec.rb +28 -18
  29. data/spec/scss_lint/linter/border_zero_spec.rb +50 -16
  30. data/spec/scss_lint/linter/color_keyword_spec.rb +16 -16
  31. data/spec/scss_lint/linter/color_variable_spec.rb +102 -0
  32. data/spec/scss_lint/linter/comment_spec.rb +9 -9
  33. data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +10 -10
  34. data/spec/scss_lint/linter/debug_statement_spec.rb +4 -4
  35. data/spec/scss_lint/linter/declaration_order_spec.rb +80 -80
  36. data/spec/scss_lint/linter/duplicate_property_spec.rb +30 -30
  37. data/spec/scss_lint/linter/else_placement_spec.rb +16 -16
  38. data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +38 -38
  39. data/spec/scss_lint/linter/empty_rule_spec.rb +4 -4
  40. data/spec/scss_lint/linter/final_newline_spec.rb +6 -6
  41. data/spec/scss_lint/linter/hex_length_spec.rb +16 -16
  42. data/spec/scss_lint/linter/hex_notation_spec.rb +16 -16
  43. data/spec/scss_lint/linter/hex_validation_spec.rb +6 -6
  44. data/spec/scss_lint/linter/id_selector_spec.rb +10 -10
  45. data/spec/scss_lint/linter/import_path_spec.rb +45 -45
  46. data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
  47. data/spec/scss_lint/linter/indentation_spec.rb +103 -43
  48. data/spec/scss_lint/linter/leading_zero_spec.rb +45 -45
  49. data/spec/scss_lint/linter/mergeable_selector_spec.rb +32 -32
  50. data/spec/scss_lint/linter/name_format_spec.rb +75 -41
  51. data/spec/scss_lint/linter/nesting_depth_spec.rb +14 -14
  52. data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +12 -12
  53. data/spec/scss_lint/linter/property_count_spec.rb +104 -0
  54. data/spec/scss_lint/linter/property_sort_order_spec.rb +138 -48
  55. data/spec/scss_lint/linter/property_spelling_spec.rb +14 -14
  56. data/spec/scss_lint/linter/qualifying_element_spec.rb +26 -26
  57. data/spec/scss_lint/linter/selector_depth_spec.rb +26 -26
  58. data/spec/scss_lint/linter/selector_format_spec.rb +114 -114
  59. data/spec/scss_lint/linter/shorthand_spec.rb +32 -32
  60. data/spec/scss_lint/linter/single_line_per_property_spec.rb +10 -10
  61. data/spec/scss_lint/linter/single_line_per_selector_spec.rb +24 -24
  62. data/spec/scss_lint/linter/space_after_comma_spec.rb +60 -60
  63. data/spec/scss_lint/linter/space_after_property_colon_spec.rb +44 -44
  64. data/spec/scss_lint/linter/space_after_property_name_spec.rb +6 -6
  65. data/spec/scss_lint/linter/space_before_brace_spec.rb +119 -119
  66. data/spec/scss_lint/linter/space_between_parens_spec.rb +48 -48
  67. data/spec/scss_lint/linter/string_quotes_spec.rb +74 -62
  68. data/spec/scss_lint/linter/trailing_semicolon_spec.rb +53 -54
  69. data/spec/scss_lint/linter/trailing_zero_spec.rb +34 -34
  70. data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +10 -10
  71. data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +18 -18
  72. data/spec/scss_lint/linter/url_format_spec.rb +4 -4
  73. data/spec/scss_lint/linter/url_quotes_spec.rb +14 -14
  74. data/spec/scss_lint/linter/variable_for_property_spec.rb +115 -0
  75. data/spec/scss_lint/linter/vendor_prefixes_spec.rb +66 -56
  76. data/spec/scss_lint/linter/zero_unit_spec.rb +22 -22
  77. data/spec/scss_lint/linter_spec.rb +72 -28
  78. data/spec/scss_lint/runner_spec.rb +0 -1
  79. data/spec/scss_lint/selector_visitor_spec.rb +23 -23
  80. data/spec/spec_helper.rb +2 -2
  81. metadata +27 -12
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::NestingDepth do
4
4
  context 'and selectors are nested up to depth 3' do
5
- let(:css) { <<-CSS }
5
+ let(:scss) { <<-SCSS }
6
6
  .one {
7
7
  .two {
8
8
  .three {
@@ -10,13 +10,13 @@ describe SCSSLint::Linter::NestingDepth do
10
10
  }
11
11
  }
12
12
  }
13
- CSS
13
+ SCSS
14
14
 
15
15
  it { should_not report_lint }
16
16
  end
17
17
 
18
18
  context 'and selectors are nested greater than depth 3' do
19
- let(:css) { <<-CSS }
19
+ let(:scss) { <<-SCSS }
20
20
  .one {
21
21
  .two {
22
22
  .three {
@@ -29,7 +29,7 @@ describe SCSSLint::Linter::NestingDepth do
29
29
  }
30
30
  }
31
31
  }
32
- CSS
32
+ SCSS
33
33
 
34
34
  it { should report_lint line: 4 }
35
35
  it { should report_lint line: 7 }
@@ -39,17 +39,17 @@ describe SCSSLint::Linter::NestingDepth do
39
39
  let(:linter_config) { { 'max_depth' => 1 } }
40
40
 
41
41
  context 'when nesting has a depth of one' do
42
- let(:css) { <<-CSS }
42
+ let(:scss) { <<-SCSS }
43
43
  .one {
44
44
  font-style: italic;
45
45
  }
46
- CSS
46
+ SCSS
47
47
 
48
48
  it { should_not report_lint }
49
49
  end
50
50
 
51
51
  context 'when nesting has a depth of two' do
52
- let(:css) { <<-CSS }
52
+ let(:scss) { <<-SCSS }
53
53
  .one {
54
54
  .two {
55
55
  font-style: italic;
@@ -58,13 +58,13 @@ describe SCSSLint::Linter::NestingDepth do
58
58
  .one {
59
59
  font-style: italic;
60
60
  }
61
- CSS
61
+ SCSS
62
62
 
63
63
  it { should report_lint line: 2 }
64
64
  end
65
65
 
66
66
  context 'when nesting has a depth of three' do
67
- let(:css) { <<-CSS }
67
+ let(:scss) { <<-SCSS }
68
68
  .one {
69
69
  .two {
70
70
  .three {
@@ -75,7 +75,7 @@ describe SCSSLint::Linter::NestingDepth do
75
75
  font-style: italic;
76
76
  }
77
77
  }
78
- CSS
78
+ SCSS
79
79
 
80
80
  it { should report_lint line: 2 }
81
81
  it { should report_lint line: 7 }
@@ -83,20 +83,20 @@ describe SCSSLint::Linter::NestingDepth do
83
83
  end
84
84
 
85
85
  context 'when nesting properties' do
86
- let(:css) { <<-CSS }
86
+ let(:scss) { <<-SCSS }
87
87
  .one {
88
88
  font: {
89
89
  family: monospace;
90
90
  style: italic;
91
91
  }
92
92
  }
93
- CSS
93
+ SCSS
94
94
 
95
95
  it { should_not report_lint }
96
96
  end
97
97
 
98
98
  context 'when sequence contains a @keyframe' do
99
- let(:css) { <<-CSS }
99
+ let(:scss) { <<-SCSS }
100
100
  @keyframe my-keyframe {
101
101
  0% {
102
102
  background: #000;
@@ -106,7 +106,7 @@ describe SCSSLint::Linter::NestingDepth do
106
106
  background: #fff;
107
107
  }
108
108
  }
109
- CSS
109
+ SCSS
110
110
 
111
111
  it { should_not report_lint }
112
112
  end
@@ -2,61 +2,61 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::PlaceholderInExtend do
4
4
  context 'when extending with a class' do
5
- let(:css) { <<-CSS }
5
+ let(:scss) { <<-SCSS }
6
6
  p {
7
7
  @extend .error;
8
8
  }
9
- CSS
9
+ SCSS
10
10
 
11
11
  it { should report_lint line: 2 }
12
12
  end
13
13
 
14
14
  context 'when extending with a type' do
15
- let(:css) { <<-CSS }
15
+ let(:scss) { <<-SCSS }
16
16
  p {
17
17
  @extend span;
18
18
  }
19
- CSS
19
+ SCSS
20
20
 
21
21
  it { should report_lint line: 2 }
22
22
  end
23
23
 
24
24
  context 'when extending with an id' do
25
- let(:css) { <<-CSS }
25
+ let(:scss) { <<-SCSS }
26
26
  p {
27
27
  @extend #some-identifer;
28
28
  }
29
- CSS
29
+ SCSS
30
30
 
31
31
  it { should report_lint line: 2 }
32
32
  end
33
33
 
34
34
  context 'when extending with a placeholder' do
35
- let(:css) { <<-CSS }
35
+ let(:scss) { <<-SCSS }
36
36
  p {
37
37
  @extend %placeholder;
38
38
  }
39
- CSS
39
+ SCSS
40
40
 
41
41
  it { should_not report_lint }
42
42
  end
43
43
 
44
44
  context 'when extending with a selector whose prefix is not a placeholder' do
45
- let(:css) { <<-CSS }
45
+ let(:scss) { <<-SCSS }
46
46
  p {
47
47
  @extend .blah-\#{$dynamically_generated_name};
48
48
  }
49
- CSS
49
+ SCSS
50
50
 
51
51
  it { should report_lint line: 2 }
52
52
  end
53
53
 
54
54
  context 'when extending with a selector whose prefix is dynamic' do
55
- let(:css) { <<-CSS }
55
+ let(:scss) { <<-SCSS }
56
56
  p {
57
57
  @extend \#{$dynamically_generated_placeholder_name};
58
58
  }
59
- CSS
59
+ SCSS
60
60
 
61
61
  it { should_not report_lint }
62
62
  end
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ describe SCSSLint::Linter::PropertyCount do
4
+ let(:linter_config) { { 'max_properties' => 3 } }
5
+
6
+ context 'when the number of properties in each individual rule set is under the limit' do
7
+ let(:scss) { <<-SCSS }
8
+ p {
9
+ margin: 0;
10
+ padding: 0;
11
+ float: left;
12
+
13
+ a {
14
+ color: #f00;
15
+ text-decoration: none;
16
+ text-transform: uppercase;
17
+ }
18
+ }
19
+
20
+ i {
21
+ color: #000;
22
+ text-decoration: underline;
23
+ text-transform: lowercase;
24
+ }
25
+ SCSS
26
+
27
+ it { should_not report_lint }
28
+ end
29
+
30
+ context 'when the number of properties in an individual rule set is over the limit' do
31
+ let(:scss) { <<-SCSS }
32
+ p {
33
+ margin: 0;
34
+ padding: 0;
35
+ float: left;
36
+
37
+ a {
38
+ color: #f00;
39
+ font: 15px arial, sans-serif;
40
+ text-decoration: none;
41
+ text-transform: uppercase;
42
+ }
43
+ }
44
+
45
+ i {
46
+ color: #000;
47
+ text-decoration: underline;
48
+ text-transform: lowercase;
49
+ }
50
+ SCSS
51
+
52
+ it { should_not report_lint line: 1 }
53
+ it { should report_lint line: 6 }
54
+ end
55
+
56
+ context 'when nested rule sets are included in the count' do
57
+ let(:linter_config) { super().merge('include_nested' => true) }
58
+
59
+ context 'when the number of total nested properties under the limit' do
60
+ let(:scss) { <<-SCSS }
61
+ p {
62
+ margin: 0;
63
+
64
+ a {
65
+ color: #f00;
66
+ text-transform: uppercase;
67
+ }
68
+ }
69
+
70
+ i {
71
+ color: #000;
72
+ text-decoration: underline;
73
+ text-transform: lowercase;
74
+ }
75
+ SCSS
76
+
77
+ it { should_not report_lint }
78
+ end
79
+
80
+ context 'when the number of total nested properties is over the limit' do
81
+ let(:scss) { <<-SCSS }
82
+ p {
83
+ margin: 0;
84
+ padding: 0;
85
+
86
+ a {
87
+ color: #f00;
88
+ text-decoration: none;
89
+ text-transform: uppercase;
90
+ }
91
+ }
92
+
93
+ i {
94
+ color: #000;
95
+ text-decoration: underline;
96
+ text-transform: lowercase;
97
+ }
98
+ SCSS
99
+
100
+ it { should report_lint line: 1 }
101
+ it { should_not report_lint line: 12 }
102
+ end
103
+ end
104
+ end
@@ -2,29 +2,29 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::PropertySortOrder do
4
4
  context 'when rule is empty' do
5
- let(:css) { <<-CSS }
5
+ let(:scss) { <<-SCSS }
6
6
  p {
7
7
  }
8
- CSS
8
+ SCSS
9
9
 
10
10
  it { should_not report_lint }
11
11
  end
12
12
 
13
13
  context 'when rule contains properties in sorted order' do
14
- let(:css) { <<-CSS }
14
+ let(:scss) { <<-SCSS }
15
15
  p {
16
16
  background: #000;
17
17
  display: none;
18
18
  margin: 5px;
19
19
  padding: 10px;
20
20
  }
21
- CSS
21
+ SCSS
22
22
 
23
23
  it { should_not report_lint }
24
24
  end
25
25
 
26
26
  context 'when rule contains mixins followed by properties in sorted order' do
27
- let(:css) { <<-CSS }
27
+ let(:scss) { <<-SCSS }
28
28
  p {
29
29
  @include border-radius(5px);
30
30
  background: #000;
@@ -32,13 +32,13 @@ describe SCSSLint::Linter::PropertySortOrder do
32
32
  margin: 5px;
33
33
  padding: 10px;
34
34
  }
35
- CSS
35
+ SCSS
36
36
 
37
37
  it { should_not report_lint }
38
38
  end
39
39
 
40
40
  context 'when rule contains nested rules after sorted properties' do
41
- let(:css) { <<-CSS }
41
+ let(:scss) { <<-SCSS }
42
42
  p {
43
43
  background: #000;
44
44
  display: none;
@@ -48,25 +48,25 @@ describe SCSSLint::Linter::PropertySortOrder do
48
48
  color: #555;
49
49
  }
50
50
  }
51
- CSS
51
+ SCSS
52
52
 
53
53
  it { should_not report_lint }
54
54
  end
55
55
 
56
56
  context 'when rule contains properties in random order' do
57
- let(:css) { <<-CSS }
57
+ let(:scss) { <<-SCSS }
58
58
  p {
59
59
  padding: 5px;
60
60
  display: block;
61
61
  margin: 10px;
62
62
  }
63
- CSS
63
+ SCSS
64
64
 
65
65
  it { should report_lint line: 2 }
66
66
  end
67
67
 
68
68
  context 'when there are multiple rules with out of order properties' do
69
- let(:css) { <<-CSS }
69
+ let(:scss) { <<-SCSS }
70
70
  p {
71
71
  display: block;
72
72
  background: #fff;
@@ -75,14 +75,14 @@ describe SCSSLint::Linter::PropertySortOrder do
75
75
  margin: 5px;
76
76
  color: #444;
77
77
  }
78
- CSS
78
+ SCSS
79
79
 
80
80
  it { should report_lint line: 2 }
81
81
  it { should report_lint line: 6 }
82
82
  end
83
83
 
84
84
  context 'when there are nested rules with out of order properties' do
85
- let(:css) { <<-CSS }
85
+ let(:scss) { <<-SCSS }
86
86
  p {
87
87
  display: block;
88
88
  background: #fff;
@@ -91,138 +91,138 @@ describe SCSSLint::Linter::PropertySortOrder do
91
91
  color: #444;
92
92
  }
93
93
  }
94
- CSS
94
+ SCSS
95
95
 
96
96
  it { should report_lint line: 2 }
97
97
  it { should report_lint line: 5 }
98
98
  end
99
99
 
100
100
  context 'when out-of-order property is the second last in the list of sorted properties' do
101
- let(:css) { <<-CSS }
101
+ let(:scss) { <<-SCSS }
102
102
  p {
103
103
  border: 0;
104
104
  border-radius: 3px;
105
105
  float: left;
106
106
  display: block;
107
107
  }
108
- CSS
108
+ SCSS
109
109
 
110
110
  it { should report_lint line: 4 }
111
111
  end
112
112
 
113
113
  context 'when vendor-prefixed properties are ordered after the non-prefixed property' do
114
- let(:css) { <<-CSS }
114
+ let(:scss) { <<-SCSS }
115
115
  p {
116
116
  border-radius: 3px;
117
117
  -moz-border-radius: 3px;
118
118
  -o-border-radius: 3px;
119
119
  -webkit-border-radius: 3px;
120
120
  }
121
- CSS
121
+ SCSS
122
122
 
123
123
  it { should report_lint line: 2 }
124
124
  end
125
125
 
126
126
  context 'when vendor-prefixed properties are ordered before the non-prefixed property' do
127
- let(:css) { <<-CSS }
127
+ let(:scss) { <<-SCSS }
128
128
  p {
129
129
  -moz-border-radius: 3px;
130
130
  -o-border-radius: 3px;
131
131
  -webkit-border-radius: 3px;
132
132
  border-radius: 3px;
133
133
  }
134
- CSS
134
+ SCSS
135
135
 
136
136
  it { should_not report_lint }
137
137
  end
138
138
 
139
139
  context 'when using -moz-osx vendor-prefixed property' do
140
- let(:css) { <<-CSS }
140
+ let(:scss) { <<-SCSS }
141
141
  p {
142
142
  -moz-osx-font-smoothing: grayscale;
143
143
  -webkit-font-smoothing: antialiased;
144
144
  }
145
- CSS
145
+ SCSS
146
146
 
147
147
  it { should_not report_lint }
148
148
  end
149
149
 
150
150
  context 'when vendor properties are ordered out-of-order before the non-prefixed property' do
151
- let(:css) { <<-CSS }
151
+ let(:scss) { <<-SCSS }
152
152
  p {
153
153
  -moz-border-radius: 3px;
154
154
  -webkit-border-radius: 3px;
155
155
  -o-border-radius: 3px;
156
156
  border-radius: 3px;
157
157
  }
158
- CSS
158
+ SCSS
159
159
 
160
160
  it { should report_lint line: 3 }
161
161
  end
162
162
 
163
163
  context 'when include block contains properties in sorted order' do
164
- let(:css) { <<-CSS }
164
+ let(:scss) { <<-SCSS }
165
165
  @include some-mixin {
166
166
  background: #000;
167
167
  display: none;
168
168
  margin: 5px;
169
169
  padding: 10px;
170
170
  }
171
- CSS
171
+ SCSS
172
172
 
173
173
  it { should_not report_lint }
174
174
  end
175
175
 
176
176
  context 'when include block contains properties not in sorted order' do
177
- let(:css) { <<-CSS }
177
+ let(:scss) { <<-SCSS }
178
178
  @include some-mixin {
179
179
  background: #000;
180
180
  margin: 5px;
181
181
  display: none;
182
182
  }
183
- CSS
183
+ SCSS
184
184
 
185
185
  it { should report_lint line: 3 }
186
186
  end
187
187
 
188
188
  context 'when @media block contains properties not in sorted order' do
189
- let(:css) { <<-CSS }
189
+ let(:scss) { <<-SCSS }
190
190
  @media screen and (min-width: 500px) {
191
191
  margin: 5px;
192
192
  display: none;
193
193
  }
194
- CSS
194
+ SCSS
195
195
 
196
196
  it { should report_lint line: 2 }
197
197
  end
198
198
 
199
199
  context 'when if block contains properties in sorted order' do
200
- let(:css) { <<-CSS }
200
+ let(:scss) { <<-SCSS }
201
201
  @if $var {
202
202
  background: #000;
203
203
  display: none;
204
204
  margin: 5px;
205
205
  padding: 10px;
206
206
  }
207
- CSS
207
+ SCSS
208
208
 
209
209
  it { should_not report_lint }
210
210
  end
211
211
 
212
212
  context 'when if block contains properties not in sorted order' do
213
- let(:css) { <<-CSS }
213
+ let(:scss) { <<-SCSS }
214
214
  @if $var {
215
215
  background: #000;
216
216
  margin: 5px;
217
217
  display: none;
218
218
  }
219
- CSS
219
+ SCSS
220
220
 
221
221
  it { should report_lint line: 3 }
222
222
  end
223
223
 
224
224
  context 'when if block contains properties in sorted order' do
225
- let(:css) { <<-CSS }
225
+ let(:scss) { <<-SCSS }
226
226
  @if $var {
227
227
  // Content
228
228
  } @else {
@@ -231,13 +231,13 @@ describe SCSSLint::Linter::PropertySortOrder do
231
231
  margin: 5px;
232
232
  padding: 10px;
233
233
  }
234
- CSS
234
+ SCSS
235
235
 
236
236
  it { should_not report_lint }
237
237
  end
238
238
 
239
239
  context 'when else block contains properties not in sorted order' do
240
- let(:css) { <<-CSS }
240
+ let(:scss) { <<-SCSS }
241
241
  @if $var {
242
242
  // Content
243
243
  } @else {
@@ -245,7 +245,7 @@ describe SCSSLint::Linter::PropertySortOrder do
245
245
  margin: 5px;
246
246
  display: none;
247
247
  }
248
- CSS
248
+ SCSS
249
249
 
250
250
  it { should report_lint line: 5 }
251
251
  end
@@ -254,31 +254,31 @@ describe SCSSLint::Linter::PropertySortOrder do
254
254
  let(:linter_config) { { 'order' => %w[position display padding margin width] } }
255
255
 
256
256
  context 'and the properties match the specified order' do
257
- let(:css) { <<-CSS }
257
+ let(:scss) { <<-SCSS }
258
258
  p {
259
259
  display: block;
260
260
  padding: 5px;
261
261
  margin: 10px;
262
262
  }
263
- CSS
263
+ SCSS
264
264
 
265
265
  it { should_not report_lint }
266
266
  end
267
267
 
268
268
  context 'and the properties do not match the specified order' do
269
- let(:css) { <<-CSS }
269
+ let(:scss) { <<-SCSS }
270
270
  p {
271
271
  padding: 5px;
272
272
  display: block;
273
273
  margin: 10px;
274
274
  }
275
- CSS
275
+ SCSS
276
276
 
277
277
  it { should report_lint line: 2 }
278
278
  end
279
279
 
280
280
  context 'and there are properties that are not specified in the explicit ordering' do
281
- let(:css) { <<-CSS }
281
+ let(:scss) { <<-SCSS }
282
282
  p {
283
283
  display: block;
284
284
  padding: 5px;
@@ -288,7 +288,7 @@ describe SCSSLint::Linter::PropertySortOrder do
288
288
  background: red; // Unspecified
289
289
  width: 100%;
290
290
  }
291
- CSS
291
+ SCSS
292
292
 
293
293
  context 'and the ignore_unspecified option is enabled' do
294
294
  let(:linter_config) { super().merge('ignore_unspecified' => true) }
@@ -308,29 +308,119 @@ describe SCSSLint::Linter::PropertySortOrder do
308
308
  let(:linter_config) { { 'order' => 'concentric' } }
309
309
 
310
310
  context 'and the properties match the order' do
311
- let(:css) { <<-CSS }
311
+ let(:scss) { <<-SCSS }
312
312
  p {
313
313
  display: block;
314
314
  position: absolute;
315
315
  float: left;
316
316
  clear: both;
317
317
  }
318
- CSS
318
+ SCSS
319
319
 
320
320
  it { should_not report_lint }
321
321
  end
322
322
 
323
323
  context 'and the properties do not match the order' do
324
- let(:css) { <<-CSS }
324
+ let(:scss) { <<-SCSS }
325
325
  p {
326
326
  clear: both;
327
327
  display: block;
328
328
  float: left;
329
329
  position: absolute;
330
330
  }
331
- CSS
331
+ SCSS
332
332
 
333
333
  it { should report_lint }
334
334
  end
335
335
  end
336
+
337
+ context 'when separation between groups of properties is enforced' do
338
+ let(:order) do
339
+ %w[display position top right bottom left] + [nil] +
340
+ %w[width height margin padding] + [nil] +
341
+ %w[float clear]
342
+ end
343
+
344
+ let(:linter_config) { { 'separate_groups' => true, 'order' => order } }
345
+
346
+ context 'and the groups are separated correctly' do
347
+ let(:scss) { <<-SCSS }
348
+ p {
349
+ display: none;
350
+ position: absolute;
351
+
352
+ margin: 0;
353
+ padding: 0;
354
+
355
+ float: left;
356
+ }
357
+ SCSS
358
+
359
+ it { should_not report_lint }
360
+ end
361
+
362
+ context 'and the groups are separated incorrectly' do
363
+ let(:scss) { <<-SCSS }
364
+ p {
365
+ display: none;
366
+ position: absolute;
367
+ margin: 0;
368
+
369
+ padding: 0;
370
+
371
+ float: left;
372
+ }
373
+ SCSS
374
+
375
+ it { should report_lint line: 4 }
376
+ end
377
+
378
+ context 'and the groups are separated by a comment' do
379
+ let(:scss) { <<-SCSS }
380
+ p {
381
+ display: none;
382
+ position: absolute;
383
+ //
384
+ margin: 0;
385
+ padding: 0;
386
+ //
387
+ float: left;
388
+ }
389
+ SCSS
390
+
391
+ it { should_not report_lint }
392
+ end
393
+
394
+ context 'when the sort order has multiple gaps separating two groups' do
395
+ let(:order) { %w[display position] + [nil, nil] + %w[margin padding] }
396
+
397
+ context 'and the groups are separated correctly' do
398
+ let(:scss) { <<-SCSS }
399
+ p {
400
+ display: none;
401
+ position: absolute;
402
+
403
+ margin: 0;
404
+ padding: 0;
405
+ }
406
+ SCSS
407
+
408
+ it { should_not report_lint }
409
+ end
410
+
411
+ context 'and the groups are separated incorrectly' do
412
+ let(:scss) { <<-SCSS }
413
+ p {
414
+ display: none;
415
+ position: absolute;
416
+ margin: 0;
417
+
418
+ padding: 0;
419
+ }
420
+ SCSS
421
+
422
+ it { should report_lint line: 4 }
423
+ end
424
+ end
425
+ end
336
426
  end