sass 3.1.0 → 3.3.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 +7 -0
- data/CONTRIBUTING +1 -1
- data/MIT-LICENSE +2 -2
- data/README.md +29 -17
- data/Rakefile +43 -9
- data/VERSION +1 -1
- data/VERSION_DATE +1 -0
- data/VERSION_NAME +1 -1
- data/bin/sass +6 -1
- data/bin/sass-convert +6 -1
- data/bin/scss +6 -1
- data/ext/mkrf_conf.rb +27 -0
- data/lib/sass/cache_stores/base.rb +7 -3
- data/lib/sass/cache_stores/chain.rb +3 -2
- data/lib/sass/cache_stores/filesystem.rb +5 -7
- data/lib/sass/cache_stores/memory.rb +1 -1
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +2 -1
- data/lib/sass/css.rb +168 -53
- data/lib/sass/engine.rb +502 -174
- data/lib/sass/environment.rb +151 -111
- data/lib/sass/error.rb +7 -7
- data/lib/sass/exec.rb +176 -60
- data/lib/sass/features.rb +40 -0
- data/lib/sass/importers/base.rb +46 -7
- data/lib/sass/importers/deprecated_path.rb +51 -0
- data/lib/sass/importers/filesystem.rb +113 -30
- data/lib/sass/importers.rb +1 -0
- data/lib/sass/logger/base.rb +30 -0
- data/lib/sass/logger/log_level.rb +45 -0
- data/lib/sass/logger.rb +12 -0
- data/lib/sass/media.rb +213 -0
- data/lib/sass/plugin/compiler.rb +194 -104
- data/lib/sass/plugin/configuration.rb +18 -25
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +37 -11
- data/lib/sass/plugin.rb +10 -13
- data/lib/sass/railtie.rb +2 -1
- data/lib/sass/repl.rb +5 -6
- data/lib/sass/script/css_lexer.rb +8 -4
- data/lib/sass/script/css_parser.rb +5 -2
- data/lib/sass/script/functions.rb +1547 -618
- data/lib/sass/script/lexer.rb +122 -72
- data/lib/sass/script/parser.rb +304 -135
- data/lib/sass/script/tree/funcall.rb +306 -0
- data/lib/sass/script/{interpolation.rb → tree/interpolation.rb} +43 -13
- data/lib/sass/script/tree/list_literal.rb +77 -0
- data/lib/sass/script/tree/literal.rb +45 -0
- data/lib/sass/script/tree/map_literal.rb +64 -0
- data/lib/sass/script/{node.rb → tree/node.rb} +30 -12
- data/lib/sass/script/{operation.rb → tree/operation.rb} +33 -21
- data/lib/sass/script/{string_interpolation.rb → tree/string_interpolation.rb} +14 -4
- data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +21 -9
- data/lib/sass/script/tree/variable.rb +57 -0
- data/lib/sass/script/tree.rb +15 -0
- data/lib/sass/script/value/arg_list.rb +36 -0
- data/lib/sass/script/value/base.rb +238 -0
- data/lib/sass/script/value/bool.rb +40 -0
- data/lib/sass/script/{color.rb → value/color.rb} +256 -74
- data/lib/sass/script/value/deprecated_false.rb +55 -0
- data/lib/sass/script/value/helpers.rb +155 -0
- data/lib/sass/script/value/list.rb +128 -0
- data/lib/sass/script/value/map.rb +70 -0
- data/lib/sass/script/value/null.rb +49 -0
- data/lib/sass/script/{number.rb → value/number.rb} +115 -62
- data/lib/sass/script/{string.rb → value/string.rb} +9 -11
- data/lib/sass/script/value.rb +12 -0
- data/lib/sass/script.rb +35 -9
- data/lib/sass/scss/css_parser.rb +2 -12
- data/lib/sass/scss/parser.rb +657 -230
- data/lib/sass/scss/rx.rb +17 -12
- data/lib/sass/scss/static_parser.rb +37 -6
- data/lib/sass/scss.rb +0 -1
- data/lib/sass/selector/abstract_sequence.rb +35 -3
- data/lib/sass/selector/comma_sequence.rb +29 -14
- data/lib/sass/selector/sequence.rb +371 -74
- data/lib/sass/selector/simple.rb +28 -13
- data/lib/sass/selector/simple_sequence.rb +163 -36
- data/lib/sass/selector.rb +138 -36
- data/lib/sass/shared.rb +3 -5
- data/lib/sass/source/map.rb +196 -0
- data/lib/sass/source/position.rb +39 -0
- data/lib/sass/source/range.rb +41 -0
- data/lib/sass/stack.rb +126 -0
- data/lib/sass/supports.rb +228 -0
- data/lib/sass/tree/at_root_node.rb +82 -0
- data/lib/sass/tree/comment_node.rb +34 -29
- data/lib/sass/tree/content_node.rb +9 -0
- data/lib/sass/tree/css_import_node.rb +60 -0
- data/lib/sass/tree/debug_node.rb +3 -3
- data/lib/sass/tree/directive_node.rb +33 -3
- data/lib/sass/tree/each_node.rb +9 -9
- data/lib/sass/tree/extend_node.rb +20 -6
- data/lib/sass/tree/for_node.rb +6 -6
- data/lib/sass/tree/function_node.rb +12 -4
- data/lib/sass/tree/if_node.rb +2 -15
- data/lib/sass/tree/import_node.rb +11 -5
- data/lib/sass/tree/media_node.rb +27 -11
- data/lib/sass/tree/mixin_def_node.rb +15 -4
- data/lib/sass/tree/mixin_node.rb +27 -7
- data/lib/sass/tree/node.rb +69 -35
- data/lib/sass/tree/prop_node.rb +47 -31
- data/lib/sass/tree/return_node.rb +4 -3
- data/lib/sass/tree/root_node.rb +20 -4
- data/lib/sass/tree/rule_node.rb +37 -26
- data/lib/sass/tree/supports_node.rb +38 -0
- data/lib/sass/tree/trace_node.rb +33 -0
- data/lib/sass/tree/variable_node.rb +10 -4
- data/lib/sass/tree/visitors/base.rb +5 -8
- data/lib/sass/tree/visitors/check_nesting.rb +67 -52
- data/lib/sass/tree/visitors/convert.rb +134 -53
- data/lib/sass/tree/visitors/cssize.rb +245 -51
- data/lib/sass/tree/visitors/deep_copy.rb +102 -0
- data/lib/sass/tree/visitors/extend.rb +68 -0
- data/lib/sass/tree/visitors/perform.rb +331 -105
- data/lib/sass/tree/visitors/set_options.rb +125 -0
- data/lib/sass/tree/visitors/to_css.rb +259 -95
- data/lib/sass/tree/warn_node.rb +3 -3
- data/lib/sass/tree/while_node.rb +3 -3
- data/lib/sass/util/cross_platform_random.rb +19 -0
- data/lib/sass/util/multibyte_string_scanner.rb +157 -0
- data/lib/sass/util/normalized_map.rb +130 -0
- data/lib/sass/util/ordered_hash.rb +192 -0
- data/lib/sass/util/subset_map.rb +11 -2
- data/lib/sass/util/test.rb +9 -0
- data/lib/sass/util.rb +565 -39
- data/lib/sass/version.rb +27 -15
- data/lib/sass.rb +39 -4
- data/test/sass/cache_test.rb +15 -0
- data/test/sass/compiler_test.rb +223 -0
- data/test/sass/conversion_test.rb +901 -107
- data/test/sass/css2sass_test.rb +94 -0
- data/test/sass/engine_test.rb +1059 -164
- data/test/sass/exec_test.rb +86 -0
- data/test/sass/extend_test.rb +933 -837
- data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
- data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
- data/test/sass/functions_test.rb +995 -136
- data/test/sass/importer_test.rb +338 -18
- data/test/sass/logger_test.rb +58 -0
- data/test/sass/more_results/more_import.css +2 -2
- data/test/sass/plugin_test.rb +114 -30
- data/test/sass/results/cached_import_option.css +3 -0
- data/test/sass/results/filename_fn.css +3 -0
- data/test/sass/results/import.css +2 -2
- data/test/sass/results/import_charset.css +1 -0
- data/test/sass/results/import_charset_1_8.css +1 -0
- data/test/sass/results/import_charset_ibm866.css +1 -0
- data/test/sass/results/import_content.css +1 -0
- data/test/sass/results/script.css +1 -1
- data/test/sass/results/scss_import.css +2 -2
- data/test/sass/results/units.css +2 -2
- data/test/sass/script_conversion_test.rb +43 -1
- data/test/sass/script_test.rb +380 -36
- data/test/sass/scss/css_test.rb +257 -75
- data/test/sass/scss/scss_test.rb +2322 -110
- data/test/sass/source_map_test.rb +887 -0
- data/test/sass/templates/_cached_import_option_partial.scss +1 -0
- data/test/sass/templates/_double_import_loop2.sass +1 -0
- data/test/sass/templates/_filename_fn_import.scss +11 -0
- data/test/sass/templates/_imported_content.sass +3 -0
- data/test/sass/templates/_same_name_different_partiality.scss +1 -0
- data/test/sass/templates/bork5.sass +3 -0
- data/test/sass/templates/cached_import_option.scss +3 -0
- data/test/sass/templates/double_import_loop1.sass +1 -0
- data/test/sass/templates/filename_fn.scss +18 -0
- data/test/sass/templates/import_charset.sass +2 -0
- data/test/sass/templates/import_charset_1_8.sass +2 -0
- data/test/sass/templates/import_charset_ibm866.sass +2 -0
- data/test/sass/templates/import_content.sass +4 -0
- data/test/sass/templates/same_name_different_ext.sass +2 -0
- data/test/sass/templates/same_name_different_ext.scss +1 -0
- data/test/sass/templates/same_name_different_partiality.scss +1 -0
- data/test/sass/templates/single_import_loop.sass +1 -0
- data/test/sass/templates/subdir/import_up1.scss +1 -0
- data/test/sass/templates/subdir/import_up2.scss +1 -0
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
- data/test/sass/util/normalized_map_test.rb +51 -0
- data/test/sass/util_test.rb +183 -0
- data/test/sass/value_helpers_test.rb +181 -0
- data/test/test_helper.rb +45 -5
- data/vendor/listen/CHANGELOG.md +228 -0
- data/vendor/listen/CONTRIBUTING.md +38 -0
- data/vendor/listen/Gemfile +30 -0
- data/vendor/listen/Guardfile +8 -0
- data/vendor/{fssm → listen}/LICENSE +1 -1
- data/vendor/listen/README.md +315 -0
- data/vendor/listen/Rakefile +47 -0
- data/vendor/listen/Vagrantfile +96 -0
- data/vendor/listen/lib/listen/adapter.rb +214 -0
- data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
- data/vendor/listen/lib/listen/adapters/darwin.rb +85 -0
- data/vendor/listen/lib/listen/adapters/linux.rb +113 -0
- data/vendor/listen/lib/listen/adapters/polling.rb +67 -0
- data/vendor/listen/lib/listen/adapters/windows.rb +87 -0
- data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
- data/vendor/listen/lib/listen/directory_record.rb +371 -0
- data/vendor/listen/lib/listen/listener.rb +225 -0
- data/vendor/listen/lib/listen/multi_listener.rb +143 -0
- data/vendor/listen/lib/listen/turnstile.rb +28 -0
- data/vendor/listen/lib/listen/version.rb +3 -0
- data/vendor/listen/lib/listen.rb +40 -0
- data/vendor/listen/listen.gemspec +22 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +183 -0
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +1225 -0
- data/vendor/listen/spec/listen/listener_spec.rb +169 -0
- data/vendor/listen/spec/listen/multi_listener_spec.rb +174 -0
- data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
- data/vendor/listen/spec/listen_spec.rb +73 -0
- data/vendor/listen/spec/spec_helper.rb +21 -0
- data/vendor/listen/spec/support/adapter_helper.rb +629 -0
- data/vendor/listen/spec/support/directory_record_helper.rb +55 -0
- data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
- data/vendor/listen/spec/support/listeners_helper.rb +156 -0
- data/vendor/listen/spec/support/platform_helper.rb +15 -0
- metadata +344 -271
- data/lib/sass/less.rb +0 -382
- data/lib/sass/script/bool.rb +0 -18
- data/lib/sass/script/funcall.rb +0 -162
- data/lib/sass/script/list.rb +0 -76
- data/lib/sass/script/literal.rb +0 -245
- data/lib/sass/script/variable.rb +0 -54
- data/lib/sass/scss/sass_parser.rb +0 -11
- data/test/sass/less_conversion_test.rb +0 -653
- data/vendor/fssm/README.markdown +0 -55
- data/vendor/fssm/Rakefile +0 -59
- data/vendor/fssm/VERSION.yml +0 -5
- data/vendor/fssm/example.rb +0 -9
- data/vendor/fssm/fssm.gemspec +0 -77
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/fssm/lib/fssm/monitor.rb +0 -26
- data/vendor/fssm/lib/fssm/path.rb +0 -91
- data/vendor/fssm/lib/fssm/pathname.rb +0 -502
- data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
- data/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/fssm/lib/fssm/support.rb +0 -63
- data/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/fssm/lib/fssm.rb +0 -33
- data/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/fssm/spec/path_spec.rb +0 -75
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +0 -14
@@ -10,7 +10,8 @@ foo bar
|
|
10
10
|
SASS
|
11
11
|
foo bar {
|
12
12
|
baz: bang;
|
13
|
-
bip: bop;
|
13
|
+
bip: bop;
|
14
|
+
}
|
14
15
|
SCSS
|
15
16
|
assert_renders <<SASS, <<SCSS, :old => true
|
16
17
|
foo bar
|
@@ -19,7 +20,8 @@ foo bar
|
|
19
20
|
SASS
|
20
21
|
foo bar {
|
21
22
|
baz: bang;
|
22
|
-
bip: bop;
|
23
|
+
bip: bop;
|
24
|
+
}
|
23
25
|
SCSS
|
24
26
|
end
|
25
27
|
|
@@ -47,8 +49,10 @@ SASS
|
|
47
49
|
foo bar {
|
48
50
|
baz bang {
|
49
51
|
baz: bang;
|
50
|
-
bip: bop;
|
51
|
-
|
52
|
+
bip: bop;
|
53
|
+
}
|
54
|
+
blat: boo;
|
55
|
+
}
|
52
56
|
SCSS
|
53
57
|
end
|
54
58
|
|
@@ -60,7 +64,9 @@ foo bar
|
|
60
64
|
SASS
|
61
65
|
foo bar {
|
62
66
|
&:hover {
|
63
|
-
baz: bang;
|
67
|
+
baz: bang;
|
68
|
+
}
|
69
|
+
}
|
64
70
|
SCSS
|
65
71
|
end
|
66
72
|
|
@@ -68,9 +74,17 @@ SCSS
|
|
68
74
|
assert_renders <<SASS, <<SCSS
|
69
75
|
foo \#{$bar + "baz"}.bip
|
70
76
|
baz: bang
|
77
|
+
|
78
|
+
foo /\#{$bar + "baz"}/ .bip
|
79
|
+
baz: bang
|
71
80
|
SASS
|
72
81
|
foo \#{$bar + "baz"}.bip {
|
73
|
-
baz: bang;
|
82
|
+
baz: bang;
|
83
|
+
}
|
84
|
+
|
85
|
+
foo /\#{$bar + "baz"}/ .bip {
|
86
|
+
baz: bang;
|
87
|
+
}
|
74
88
|
SCSS
|
75
89
|
end
|
76
90
|
|
@@ -82,7 +96,8 @@ baz bang
|
|
82
96
|
SASS
|
83
97
|
foo bar,
|
84
98
|
baz bang {
|
85
|
-
baz: bang;
|
99
|
+
baz: bang;
|
100
|
+
}
|
86
101
|
SCSS
|
87
102
|
|
88
103
|
assert_renders <<SASS, <<SCSS
|
@@ -94,7 +109,9 @@ SASS
|
|
94
109
|
blat {
|
95
110
|
foo bar,
|
96
111
|
baz bang {
|
97
|
-
baz: bang;
|
112
|
+
baz: bang;
|
113
|
+
}
|
114
|
+
}
|
98
115
|
SCSS
|
99
116
|
end
|
100
117
|
|
@@ -105,13 +122,15 @@ foo bar baz bang
|
|
105
122
|
SASS
|
106
123
|
foo bar
|
107
124
|
baz bang {
|
108
|
-
baz: bang;
|
125
|
+
baz: bang;
|
126
|
+
}
|
109
127
|
SCSS
|
110
128
|
|
111
129
|
assert_scss_to_scss <<SCSS
|
112
130
|
foo bar
|
113
131
|
baz bang {
|
114
|
-
baz: bang;
|
132
|
+
baz: bang;
|
133
|
+
}
|
115
134
|
SCSS
|
116
135
|
end
|
117
136
|
|
@@ -123,17 +142,9 @@ foo bar
|
|
123
142
|
SASS
|
124
143
|
foo bar {
|
125
144
|
:hover {
|
126
|
-
baz: bang;
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
def test_property_name_interpolation
|
131
|
-
assert_renders <<SASS, <<SCSS
|
132
|
-
foo bar
|
133
|
-
baz\#{$bang}bip\#{$bop}: 12
|
134
|
-
SASS
|
135
|
-
foo bar {
|
136
|
-
baz\#{$bang}bip\#{$bop}: 12; }
|
145
|
+
baz: bang;
|
146
|
+
}
|
147
|
+
}
|
137
148
|
SCSS
|
138
149
|
end
|
139
150
|
|
@@ -143,7 +154,8 @@ foo bar
|
|
143
154
|
baz\#{$bang}bip\#{$bop}: 12
|
144
155
|
SASS
|
145
156
|
foo bar {
|
146
|
-
baz\#{$bang}bip\#{$bop}: 12;
|
157
|
+
baz\#{$bang}bip\#{$bop}: 12;
|
158
|
+
}
|
147
159
|
SCSS
|
148
160
|
end
|
149
161
|
|
@@ -153,7 +165,8 @@ foo bar
|
|
153
165
|
baz: 12 \#{$bang} bip \#{"bop"} blat
|
154
166
|
SASS
|
155
167
|
foo bar {
|
156
|
-
baz: 12 \#{$bang} bip \#{"bop"} blat;
|
168
|
+
baz: 12 \#{$bang} bip \#{"bop"} blat;
|
169
|
+
}
|
157
170
|
SCSS
|
158
171
|
end
|
159
172
|
|
@@ -163,7 +176,8 @@ foo bar
|
|
163
176
|
baz: 12 $bang "bip"
|
164
177
|
SASS
|
165
178
|
foo bar {
|
166
|
-
baz: 12 $bang "bip";
|
179
|
+
baz: 12 $bang "bip";
|
180
|
+
}
|
167
181
|
SCSS
|
168
182
|
end
|
169
183
|
|
@@ -173,31 +187,35 @@ foo bar
|
|
173
187
|
:baz 12 $bang "bip"
|
174
188
|
SASS
|
175
189
|
foo bar {
|
176
|
-
baz: 12 $bang "bip";
|
190
|
+
baz: 12 $bang "bip";
|
191
|
+
}
|
177
192
|
SCSS
|
178
193
|
end
|
179
194
|
|
180
195
|
def test_multiline_properties
|
181
196
|
assert_scss_to_sass <<SASS, <<SCSS
|
182
197
|
foo bar
|
183
|
-
baz: bip
|
198
|
+
baz: bip bam boon
|
184
199
|
SASS
|
185
200
|
foo bar {
|
186
201
|
baz:
|
187
202
|
bip
|
188
203
|
bam
|
189
|
-
boon;
|
204
|
+
boon;
|
205
|
+
}
|
190
206
|
SCSS
|
191
207
|
|
192
208
|
assert_scss_to_scss <<OUT, <<IN
|
193
209
|
foo bar {
|
194
|
-
baz: bip
|
210
|
+
baz: bip bam boon;
|
211
|
+
}
|
195
212
|
OUT
|
196
213
|
foo bar {
|
197
214
|
baz:
|
198
215
|
bip
|
199
216
|
bam
|
200
|
-
boon;
|
217
|
+
boon;
|
218
|
+
}
|
201
219
|
IN
|
202
220
|
end
|
203
221
|
|
@@ -210,18 +228,21 @@ foo bar {
|
|
210
228
|
baz:
|
211
229
|
$bip
|
212
230
|
"bam"
|
213
|
-
12px;
|
231
|
+
12px;
|
232
|
+
}
|
214
233
|
SCSS
|
215
234
|
|
216
235
|
assert_scss_to_scss <<OUT, <<IN
|
217
236
|
foo bar {
|
218
|
-
baz: $bip "bam" 12px;
|
237
|
+
baz: $bip "bam" 12px;
|
238
|
+
}
|
219
239
|
OUT
|
220
240
|
foo bar {
|
221
241
|
baz:
|
222
242
|
$bip
|
223
243
|
"bam"
|
224
|
-
12px;
|
244
|
+
12px;
|
245
|
+
}
|
225
246
|
IN
|
226
247
|
end
|
227
248
|
|
@@ -243,7 +264,8 @@ SASS
|
|
243
264
|
// baz
|
244
265
|
|
245
266
|
foo bar {
|
246
|
-
a: b;
|
267
|
+
a: b;
|
268
|
+
}
|
247
269
|
SCSS
|
248
270
|
|
249
271
|
assert_renders <<SASS, <<SCSS
|
@@ -261,7 +283,8 @@ SASS
|
|
261
283
|
// bang
|
262
284
|
|
263
285
|
foo bar {
|
264
|
-
a: b;
|
286
|
+
a: b;
|
287
|
+
}
|
265
288
|
SCSS
|
266
289
|
|
267
290
|
assert_sass_to_scss <<SCSS, <<SASS
|
@@ -271,7 +294,8 @@ SCSS
|
|
271
294
|
// bang
|
272
295
|
|
273
296
|
foo bar {
|
274
|
-
a: b;
|
297
|
+
a: b;
|
298
|
+
}
|
275
299
|
SCSS
|
276
300
|
// foo
|
277
301
|
// bar
|
@@ -345,7 +369,8 @@ SASS
|
|
345
369
|
/* baz */
|
346
370
|
|
347
371
|
foo bar {
|
348
|
-
a: b;
|
372
|
+
a: b;
|
373
|
+
}
|
349
374
|
SCSS
|
350
375
|
|
351
376
|
assert_scss_to_sass <<SASS, <<SCSS
|
@@ -363,7 +388,8 @@ SASS
|
|
363
388
|
bang */
|
364
389
|
|
365
390
|
foo bar {
|
366
|
-
a: b;
|
391
|
+
a: b;
|
392
|
+
}
|
367
393
|
SCSS
|
368
394
|
|
369
395
|
assert_scss_to_scss <<SCSS
|
@@ -373,7 +399,8 @@ SCSS
|
|
373
399
|
bang */
|
374
400
|
|
375
401
|
foo bar {
|
376
|
-
a: b;
|
402
|
+
a: b;
|
403
|
+
}
|
377
404
|
SCSS
|
378
405
|
|
379
406
|
assert_renders <<SASS, <<SCSS
|
@@ -391,7 +418,8 @@ SASS
|
|
391
418
|
* bang */
|
392
419
|
|
393
420
|
foo bar {
|
394
|
-
a: b;
|
421
|
+
a: b;
|
422
|
+
}
|
395
423
|
SCSS
|
396
424
|
end
|
397
425
|
|
@@ -411,7 +439,8 @@ foo {
|
|
411
439
|
* beep boop */
|
412
440
|
bang: bizz;
|
413
441
|
/* bubble bubble
|
414
|
-
* toil trouble */
|
442
|
+
* toil trouble */
|
443
|
+
}
|
415
444
|
SCSS
|
416
445
|
|
417
446
|
assert_sass_to_scss <<SCSS, <<SASS
|
@@ -423,7 +452,8 @@ foo {
|
|
423
452
|
bang: bizz;
|
424
453
|
/* bubble bubble
|
425
454
|
* toil trouble
|
426
|
-
* gorp */
|
455
|
+
* gorp */
|
456
|
+
}
|
427
457
|
SCSS
|
428
458
|
foo
|
429
459
|
bar: baz
|
@@ -449,7 +479,8 @@ foo {
|
|
449
479
|
/* foo
|
450
480
|
bar
|
451
481
|
baz */
|
452
|
-
a: b;
|
482
|
+
a: b;
|
483
|
+
}
|
453
484
|
SCSS
|
454
485
|
|
455
486
|
assert_sass_to_scss <<SCSS, <<SASS
|
@@ -457,7 +488,8 @@ foo {
|
|
457
488
|
/* foo
|
458
489
|
* bar
|
459
490
|
* baz */
|
460
|
-
a: b;
|
491
|
+
a: b;
|
492
|
+
}
|
461
493
|
SCSS
|
462
494
|
foo
|
463
495
|
/* foo
|
@@ -467,6 +499,29 @@ foo
|
|
467
499
|
SASS
|
468
500
|
end
|
469
501
|
|
502
|
+
def test_loud_comment_containing_silent_comment
|
503
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
504
|
+
/*
|
505
|
+
*// foo bar
|
506
|
+
SASS
|
507
|
+
/*
|
508
|
+
// foo bar
|
509
|
+
*/
|
510
|
+
SCSS
|
511
|
+
end
|
512
|
+
|
513
|
+
def test_silent_comment_containing_loud_comment
|
514
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
515
|
+
// /*
|
516
|
+
// * foo bar
|
517
|
+
// */
|
518
|
+
SASS
|
519
|
+
// /*
|
520
|
+
// * foo bar
|
521
|
+
// */
|
522
|
+
SCSS
|
523
|
+
end
|
524
|
+
|
470
525
|
def test_immediately_preceding_comments
|
471
526
|
assert_renders <<SASS, <<SCSS
|
472
527
|
/* Foo
|
@@ -479,7 +534,8 @@ SASS
|
|
479
534
|
* Bar
|
480
535
|
* Baz */
|
481
536
|
.foo#bar {
|
482
|
-
a: b;
|
537
|
+
a: b;
|
538
|
+
}
|
483
539
|
SCSS
|
484
540
|
|
485
541
|
assert_renders <<SASS, <<SCSS
|
@@ -493,10 +549,33 @@ SASS
|
|
493
549
|
// Bar
|
494
550
|
// Baz
|
495
551
|
@mixin foo {
|
496
|
-
a: b;
|
552
|
+
a: b;
|
553
|
+
}
|
497
554
|
SCSS
|
498
555
|
end
|
499
556
|
|
557
|
+
def test_immediately_following_comments
|
558
|
+
assert_sass_to_scss <<SCSS, <<SASS
|
559
|
+
.foobar {
|
560
|
+
// trailing comment
|
561
|
+
a: 1px;
|
562
|
+
}
|
563
|
+
SCSS
|
564
|
+
.foobar // trailing comment
|
565
|
+
a: 1px
|
566
|
+
SASS
|
567
|
+
|
568
|
+
assert_sass_to_scss <<SCSS, <<SASS
|
569
|
+
.foobar {
|
570
|
+
// trailing comment
|
571
|
+
a: 1px;
|
572
|
+
}
|
573
|
+
SCSS
|
574
|
+
.foobar /* trailing comment */
|
575
|
+
a: 1px
|
576
|
+
SASS
|
577
|
+
end
|
578
|
+
|
500
579
|
def test_debug
|
501
580
|
assert_renders <<SASS, <<SCSS
|
502
581
|
foo
|
@@ -505,7 +584,8 @@ foo
|
|
505
584
|
SASS
|
506
585
|
foo {
|
507
586
|
@debug 12px;
|
508
|
-
bar: baz;
|
587
|
+
bar: baz;
|
588
|
+
}
|
509
589
|
SCSS
|
510
590
|
end
|
511
591
|
|
@@ -517,7 +597,8 @@ foo
|
|
517
597
|
SASS
|
518
598
|
foo {
|
519
599
|
@foo #bar "baz";
|
520
|
-
bar: baz;
|
600
|
+
bar: baz;
|
601
|
+
}
|
521
602
|
SCSS
|
522
603
|
end
|
523
604
|
|
@@ -533,9 +614,11 @@ SASS
|
|
533
614
|
foo {
|
534
615
|
@foo #bar "baz" {
|
535
616
|
a: b;
|
536
|
-
c: d;
|
617
|
+
c: d;
|
618
|
+
}
|
537
619
|
|
538
|
-
bar: baz;
|
620
|
+
bar: baz;
|
621
|
+
}
|
539
622
|
SCSS
|
540
623
|
end
|
541
624
|
|
@@ -554,12 +637,16 @@ SASS
|
|
554
637
|
foo {
|
555
638
|
@foo #bar "baz" {
|
556
639
|
#blat {
|
557
|
-
a: b;
|
640
|
+
a: b;
|
641
|
+
}
|
558
642
|
.bang {
|
559
643
|
c: d;
|
560
|
-
e: f;
|
644
|
+
e: f;
|
645
|
+
}
|
646
|
+
}
|
561
647
|
|
562
|
-
bar: baz;
|
648
|
+
bar: baz;
|
649
|
+
}
|
563
650
|
SCSS
|
564
651
|
end
|
565
652
|
|
@@ -581,13 +668,17 @@ foo {
|
|
581
668
|
@foo #bar "baz" {
|
582
669
|
g: h;
|
583
670
|
#blat {
|
584
|
-
a: b;
|
671
|
+
a: b;
|
672
|
+
}
|
585
673
|
.bang {
|
586
674
|
c: d;
|
587
|
-
e: f;
|
588
|
-
|
675
|
+
e: f;
|
676
|
+
}
|
677
|
+
i: j;
|
678
|
+
}
|
589
679
|
|
590
|
-
bar: baz;
|
680
|
+
bar: baz;
|
681
|
+
}
|
591
682
|
SCSS
|
592
683
|
end
|
593
684
|
|
@@ -610,10 +701,13 @@ foo
|
|
610
701
|
SASS
|
611
702
|
foo {
|
612
703
|
@for $a from $b to $c {
|
613
|
-
a: b;
|
704
|
+
a: b;
|
705
|
+
}
|
614
706
|
@for $c from 1 to 16 {
|
615
707
|
d: e;
|
616
|
-
f: g;
|
708
|
+
f: g;
|
709
|
+
}
|
710
|
+
}
|
617
711
|
SCSS
|
618
712
|
end
|
619
713
|
|
@@ -628,10 +722,13 @@ foo
|
|
628
722
|
SASS
|
629
723
|
foo {
|
630
724
|
@while flaz($a + $b) {
|
631
|
-
a: b;
|
725
|
+
a: b;
|
726
|
+
}
|
632
727
|
@while 1 {
|
633
728
|
d: e;
|
634
|
-
f: g;
|
729
|
+
f: g;
|
730
|
+
}
|
731
|
+
}
|
635
732
|
SCSS
|
636
733
|
end
|
637
734
|
|
@@ -649,13 +746,18 @@ foo
|
|
649
746
|
SASS
|
650
747
|
foo {
|
651
748
|
@if $foo or $bar {
|
652
|
-
a: b;
|
749
|
+
a: b;
|
750
|
+
}
|
653
751
|
@if $baz {
|
654
|
-
d: e;
|
752
|
+
d: e;
|
753
|
+
}
|
655
754
|
@else if $bang {
|
656
|
-
f: g;
|
755
|
+
f: g;
|
756
|
+
}
|
657
757
|
@else {
|
658
|
-
h: i;
|
758
|
+
h: i;
|
759
|
+
}
|
760
|
+
}
|
659
761
|
SCSS
|
660
762
|
end
|
661
763
|
|
@@ -668,14 +770,28 @@ a
|
|
668
770
|
c
|
669
771
|
@each $str in foo, bar, baz, bang
|
670
772
|
d: $str
|
773
|
+
|
774
|
+
c
|
775
|
+
@each $key, $value in (foo: 1, bar: 2, baz: 3)
|
776
|
+
\#{$key}: $value
|
671
777
|
SASS
|
672
778
|
a {
|
673
779
|
@each $number in 1px 2px 3px 4px {
|
674
|
-
b: $number;
|
780
|
+
b: $number;
|
781
|
+
}
|
782
|
+
}
|
675
783
|
|
676
784
|
c {
|
677
785
|
@each $str in foo, bar, baz, bang {
|
678
|
-
d: $str;
|
786
|
+
d: $str;
|
787
|
+
}
|
788
|
+
}
|
789
|
+
|
790
|
+
c {
|
791
|
+
@each $key, $value in (foo: 1, bar: 2, baz: 3) {
|
792
|
+
\#{$key}: $value;
|
793
|
+
}
|
794
|
+
}
|
679
795
|
SCSS
|
680
796
|
end
|
681
797
|
|
@@ -693,7 +809,8 @@ SASS
|
|
693
809
|
@import url(bar.css);
|
694
810
|
|
695
811
|
foo {
|
696
|
-
bar: baz;
|
812
|
+
bar: baz;
|
813
|
+
}
|
697
814
|
SCSS
|
698
815
|
|
699
816
|
assert_renders <<SASS, <<SCSS
|
@@ -709,7 +826,8 @@ SASS
|
|
709
826
|
@import url(bar.css);
|
710
827
|
|
711
828
|
foo {
|
712
|
-
bar: baz;
|
829
|
+
bar: baz;
|
830
|
+
}
|
713
831
|
SCSS
|
714
832
|
end
|
715
833
|
|
@@ -759,6 +877,18 @@ SASS
|
|
759
877
|
SCSS
|
760
878
|
end
|
761
879
|
|
880
|
+
def test_import_with_interpolation
|
881
|
+
assert_renders <<SASS, <<SCSS
|
882
|
+
$family: unquote("Droid+Sans")
|
883
|
+
|
884
|
+
@import url("http://fonts.googleapis.com/css?family=\#{$family}")
|
885
|
+
SASS
|
886
|
+
$family: unquote("Droid+Sans");
|
887
|
+
|
888
|
+
@import url("http://fonts.googleapis.com/css?family=\#{$family}");
|
889
|
+
SCSS
|
890
|
+
end
|
891
|
+
|
762
892
|
def test_extend
|
763
893
|
assert_renders <<SASS, <<SCSS
|
764
894
|
.foo
|
@@ -767,7 +897,19 @@ SCSS
|
|
767
897
|
SASS
|
768
898
|
.foo {
|
769
899
|
@extend .bar;
|
770
|
-
@extend .baz:bang;
|
900
|
+
@extend .baz:bang;
|
901
|
+
}
|
902
|
+
SCSS
|
903
|
+
end
|
904
|
+
|
905
|
+
def test_comma_extendee
|
906
|
+
assert_renders <<SASS, <<SCSS
|
907
|
+
.baz
|
908
|
+
@extend .foo, .bar
|
909
|
+
SASS
|
910
|
+
.baz {
|
911
|
+
@extend .foo, .bar;
|
912
|
+
}
|
771
913
|
SCSS
|
772
914
|
end
|
773
915
|
|
@@ -779,7 +921,9 @@ SCSS
|
|
779
921
|
SASS
|
780
922
|
@mixin foo-bar {
|
781
923
|
baz {
|
782
|
-
a: b;
|
924
|
+
a: b;
|
925
|
+
}
|
926
|
+
}
|
783
927
|
SCSS
|
784
928
|
|
785
929
|
assert_scss_to_sass <<SASS, <<SCSS
|
@@ -789,13 +933,17 @@ SCSS
|
|
789
933
|
SASS
|
790
934
|
@mixin foo-bar() {
|
791
935
|
baz {
|
792
|
-
a: b;
|
936
|
+
a: b;
|
937
|
+
}
|
938
|
+
}
|
793
939
|
SCSS
|
794
940
|
|
795
941
|
assert_sass_to_scss <<SCSS, <<SASS
|
796
942
|
@mixin foo-bar {
|
797
943
|
baz {
|
798
|
-
a: b;
|
944
|
+
a: b;
|
945
|
+
}
|
946
|
+
}
|
799
947
|
SCSS
|
800
948
|
=foo-bar()
|
801
949
|
baz
|
@@ -811,7 +959,9 @@ SASS
|
|
811
959
|
SASS
|
812
960
|
@mixin foo-bar($baz, $bang) {
|
813
961
|
baz {
|
814
|
-
a: $baz $bang;
|
962
|
+
a: $baz $bang;
|
963
|
+
}
|
964
|
+
}
|
815
965
|
SCSS
|
816
966
|
end
|
817
967
|
|
@@ -823,13 +973,17 @@ SCSS
|
|
823
973
|
SASS
|
824
974
|
@mixin foo-bar($baz, $bang: 12px) {
|
825
975
|
baz {
|
826
|
-
a: $baz $bang;
|
976
|
+
a: $baz $bang;
|
977
|
+
}
|
978
|
+
}
|
827
979
|
SCSS
|
828
980
|
|
829
981
|
assert_sass_to_scss <<SCSS, <<SASS
|
830
982
|
@mixin foo-bar($baz, $bang: foo) {
|
831
983
|
baz {
|
832
|
-
a: $baz $bang;
|
984
|
+
a: $baz $bang;
|
985
|
+
}
|
986
|
+
}
|
833
987
|
SCSS
|
834
988
|
=foo-bar($baz, $bang: foo)
|
835
989
|
baz
|
@@ -845,7 +999,8 @@ foo
|
|
845
999
|
SASS
|
846
1000
|
foo {
|
847
1001
|
@include foo-bar;
|
848
|
-
a: blip;
|
1002
|
+
a: blip;
|
1003
|
+
}
|
849
1004
|
SCSS
|
850
1005
|
end
|
851
1006
|
|
@@ -857,7 +1012,8 @@ foo
|
|
857
1012
|
SASS
|
858
1013
|
foo {
|
859
1014
|
@include foo-bar(12px, "blaz");
|
860
|
-
a: blip;
|
1015
|
+
a: blip;
|
1016
|
+
}
|
861
1017
|
SCSS
|
862
1018
|
end
|
863
1019
|
|
@@ -871,7 +1027,21 @@ SASS
|
|
871
1027
|
foo {
|
872
1028
|
@include foo-bar(12px, "blaz", $blip: blap, $bloop: blop);
|
873
1029
|
@include foo-bar($blip: blap, $bloop: blop);
|
874
|
-
a: blip;
|
1030
|
+
a: blip;
|
1031
|
+
}
|
1032
|
+
SCSS
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def test_mixin_include_with_hyphen_conversion_keyword_arg
|
1036
|
+
assert_renders <<SASS, <<SCSS
|
1037
|
+
foo
|
1038
|
+
+foo-bar($a-b_c: val)
|
1039
|
+
a: blip
|
1040
|
+
SASS
|
1041
|
+
foo {
|
1042
|
+
@include foo-bar($a-b_c: val);
|
1043
|
+
a: blip;
|
1044
|
+
}
|
875
1045
|
SCSS
|
876
1046
|
end
|
877
1047
|
|
@@ -883,7 +1053,8 @@ SCSS
|
|
883
1053
|
SASS
|
884
1054
|
@function foo() {
|
885
1055
|
$var: 1 + 1;
|
886
|
-
@return $var;
|
1056
|
+
@return $var;
|
1057
|
+
}
|
887
1058
|
SCSS
|
888
1059
|
end
|
889
1060
|
|
@@ -895,7 +1066,9 @@ SCSS
|
|
895
1066
|
SASS
|
896
1067
|
@function foo($var1, $var2) {
|
897
1068
|
@if $var1 {
|
898
|
-
@return $var1 + $var2;
|
1069
|
+
@return $var1 + $var2;
|
1070
|
+
}
|
1071
|
+
}
|
899
1072
|
SCSS
|
900
1073
|
end
|
901
1074
|
|
@@ -907,7 +1080,9 @@ SCSS
|
|
907
1080
|
SASS
|
908
1081
|
@function foo($var1, $var2: foo) {
|
909
1082
|
@if $var1 {
|
910
|
-
@return $var1 + $var2;
|
1083
|
+
@return $var1 + $var2;
|
1084
|
+
}
|
1085
|
+
}
|
911
1086
|
SCSS
|
912
1087
|
end
|
913
1088
|
|
@@ -923,7 +1098,8 @@ $var1: 12px + 15px;
|
|
923
1098
|
|
924
1099
|
foo {
|
925
1100
|
$var2: flaz(#abcdef);
|
926
|
-
val: $var1 $var2;
|
1101
|
+
val: $var1 $var2;
|
1102
|
+
}
|
927
1103
|
SCSS
|
928
1104
|
end
|
929
1105
|
|
@@ -939,7 +1115,8 @@ $var1: 12px + 15px !default;
|
|
939
1115
|
|
940
1116
|
foo {
|
941
1117
|
$var2: flaz(#abcdef) !default;
|
942
|
-
val: $var1 $var2;
|
1118
|
+
val: $var1 $var2;
|
1119
|
+
}
|
943
1120
|
SCSS
|
944
1121
|
end
|
945
1122
|
|
@@ -967,7 +1144,8 @@ foo
|
|
967
1144
|
a: (1px / 2px)
|
968
1145
|
SASS
|
969
1146
|
foo {
|
970
|
-
a: (1px / 2px);
|
1147
|
+
a: (1px / 2px);
|
1148
|
+
}
|
971
1149
|
SCSS
|
972
1150
|
end
|
973
1151
|
|
@@ -981,7 +1159,8 @@ SASS
|
|
981
1159
|
$var: 1px / 2px;
|
982
1160
|
|
983
1161
|
foo {
|
984
|
-
a: $var;
|
1162
|
+
a: $var;
|
1163
|
+
}
|
985
1164
|
SCSS
|
986
1165
|
|
987
1166
|
assert_renders <<SASS, <<SCSS
|
@@ -993,7 +1172,8 @@ SASS
|
|
993
1172
|
$var: 1px;
|
994
1173
|
|
995
1174
|
foo {
|
996
|
-
a: $var / 2px;
|
1175
|
+
a: $var / 2px;
|
1176
|
+
}
|
997
1177
|
SCSS
|
998
1178
|
|
999
1179
|
assert_renders <<SASS, <<SCSS
|
@@ -1001,7 +1181,8 @@ foo
|
|
1001
1181
|
a: 1 + 1px / 2px
|
1002
1182
|
SASS
|
1003
1183
|
foo {
|
1004
|
-
a: 1 + 1px / 2px;
|
1184
|
+
a: 1 + 1px / 2px;
|
1185
|
+
}
|
1005
1186
|
SCSS
|
1006
1187
|
end
|
1007
1188
|
|
@@ -1011,7 +1192,100 @@ foo
|
|
1011
1192
|
a: 1px / 2px
|
1012
1193
|
SASS
|
1013
1194
|
foo {
|
1014
|
-
a: 1px / 2px;
|
1195
|
+
a: 1px / 2px;
|
1196
|
+
}
|
1197
|
+
SCSS
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
def test_directive_with_interpolation
|
1201
|
+
assert_renders <<SASS, <<SCSS
|
1202
|
+
$baz: 12
|
1203
|
+
|
1204
|
+
@foo bar\#{$baz} qux
|
1205
|
+
a: b
|
1206
|
+
SASS
|
1207
|
+
$baz: 12;
|
1208
|
+
|
1209
|
+
@foo bar\#{$baz} qux {
|
1210
|
+
a: b;
|
1211
|
+
}
|
1212
|
+
SCSS
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
def test_media_with_interpolation
|
1216
|
+
assert_renders <<SASS, <<SCSS
|
1217
|
+
$baz: 12
|
1218
|
+
|
1219
|
+
@media bar\#{$baz}
|
1220
|
+
a: b
|
1221
|
+
SASS
|
1222
|
+
$baz: 12;
|
1223
|
+
|
1224
|
+
@media bar\#{$baz} {
|
1225
|
+
a: b;
|
1226
|
+
}
|
1227
|
+
SCSS
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
def test_media_with_expressions
|
1231
|
+
assert_sass_to_scss <<SCSS, <<SASS
|
1232
|
+
$media1: screen;
|
1233
|
+
$media2: print;
|
1234
|
+
$var: -webkit-min-device-pixel-ratio;
|
1235
|
+
$val: 20;
|
1236
|
+
|
1237
|
+
@media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2} {
|
1238
|
+
a: b;
|
1239
|
+
}
|
1240
|
+
SCSS
|
1241
|
+
$media1: screen
|
1242
|
+
$media2: print
|
1243
|
+
$var: -webkit-min-device-pixel-ratio
|
1244
|
+
$val: 20
|
1245
|
+
|
1246
|
+
@media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
|
1247
|
+
a: b
|
1248
|
+
SASS
|
1249
|
+
|
1250
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1251
|
+
$media1: screen
|
1252
|
+
$media2: print
|
1253
|
+
$var: -webkit-min-device-pixel-ratio
|
1254
|
+
$val: 20
|
1255
|
+
|
1256
|
+
@media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
|
1257
|
+
a: b
|
1258
|
+
SASS
|
1259
|
+
$media1: screen;
|
1260
|
+
$media2: print;
|
1261
|
+
$var: -webkit-min-device-pixel-ratio;
|
1262
|
+
$val: 20;
|
1263
|
+
|
1264
|
+
@media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2} {
|
1265
|
+
a: b;
|
1266
|
+
}
|
1267
|
+
SCSS
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
def test_supports_with_expressions
|
1271
|
+
assert_renders <<SASS, <<SCSS
|
1272
|
+
$query: "(feature1: val)"
|
1273
|
+
$feature: feature2
|
1274
|
+
$val: val
|
1275
|
+
|
1276
|
+
@supports \#{$query} and ($feature: $val) or (not ($feature + 3: $val + 4))
|
1277
|
+
foo
|
1278
|
+
a: b
|
1279
|
+
SASS
|
1280
|
+
$query: "(feature1: val)";
|
1281
|
+
$feature: feature2;
|
1282
|
+
$val: val;
|
1283
|
+
|
1284
|
+
@supports \#{$query} and ($feature: $val) or (not ($feature + 3: $val + 4)) {
|
1285
|
+
foo {
|
1286
|
+
a: b;
|
1287
|
+
}
|
1288
|
+
}
|
1015
1289
|
SCSS
|
1016
1290
|
end
|
1017
1291
|
|
@@ -1035,7 +1309,8 @@ foo {
|
|
1035
1309
|
.name: val;
|
1036
1310
|
name/**/: val;
|
1037
1311
|
name/*\\**/: val;
|
1038
|
-
name: val;
|
1312
|
+
name: val;
|
1313
|
+
}
|
1039
1314
|
SCSS
|
1040
1315
|
end
|
1041
1316
|
|
@@ -1053,7 +1328,8 @@ foo {
|
|
1053
1328
|
*name: val;
|
1054
1329
|
#name: val;
|
1055
1330
|
.name: val;
|
1056
|
-
name: val;
|
1331
|
+
name: val;
|
1332
|
+
}
|
1057
1333
|
SCSS
|
1058
1334
|
end
|
1059
1335
|
|
@@ -1064,7 +1340,8 @@ SCSS
|
|
1064
1340
|
a: b
|
1065
1341
|
SASS
|
1066
1342
|
#{s} {
|
1067
|
-
a: b;
|
1343
|
+
a: b;
|
1344
|
+
}
|
1068
1345
|
SCSS
|
1069
1346
|
end
|
1070
1347
|
|
@@ -1097,8 +1374,10 @@ div {
|
|
1097
1374
|
before: before;
|
1098
1375
|
background: {
|
1099
1376
|
color: blue;
|
1100
|
-
repeat: no-repeat;
|
1101
|
-
|
1377
|
+
repeat: no-repeat;
|
1378
|
+
};
|
1379
|
+
after: after;
|
1380
|
+
}
|
1102
1381
|
|
1103
1382
|
SCSS
|
1104
1383
|
end
|
@@ -1106,17 +1385,22 @@ SCSS
|
|
1106
1385
|
def test_dasherize
|
1107
1386
|
assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
|
1108
1387
|
@mixin under-scored-mixin($under-scored-arg: $under-scored-default) {
|
1109
|
-
bar: $under-scored-arg;
|
1388
|
+
bar: $under-scored-arg;
|
1389
|
+
}
|
1110
1390
|
|
1111
1391
|
div {
|
1112
1392
|
foo: under-scored-fn($under-scored-var + "before\#{$another-under-scored-var}after");
|
1113
1393
|
@include under-scored-mixin($passed-arg);
|
1114
|
-
selector-\#{$under-scored-interp}: bold;
|
1394
|
+
selector-\#{$under-scored-interp}: bold;
|
1395
|
+
}
|
1115
1396
|
|
1116
1397
|
@if $under-scored {
|
1117
1398
|
@for $for-var from $from-var to $to-var {
|
1118
1399
|
@while $while-var == true {
|
1119
|
-
$while-var: false;
|
1400
|
+
$while-var: false;
|
1401
|
+
}
|
1402
|
+
}
|
1403
|
+
}
|
1120
1404
|
SCSS
|
1121
1405
|
=under_scored_mixin($under_scored_arg: $under_scored_default)
|
1122
1406
|
bar: $under_scored_arg
|
@@ -1134,21 +1418,531 @@ SASS
|
|
1134
1418
|
def test_loud_comment_conversion
|
1135
1419
|
assert_renders(<<SASS, <<SCSS)
|
1136
1420
|
/*! \#{"interpolated"}
|
1137
|
-
/*!
|
1138
|
-
* \#{"also interpolated"}
|
1139
1421
|
SASS
|
1140
1422
|
/*! \#{"interpolated"} */
|
1141
|
-
/*!
|
1142
|
-
* \#{"also interpolated"} */
|
1143
1423
|
SCSS
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
def test_content_conversion
|
1427
|
+
assert_renders(<<SASS, <<SCSS)
|
1428
|
+
$color: blue
|
1429
|
+
|
1430
|
+
=context($class, $color: red)
|
1431
|
+
.\#{$class}
|
1432
|
+
background-color: $color
|
1433
|
+
@content
|
1434
|
+
border-color: $color
|
1435
|
+
|
1436
|
+
+context(parent)
|
1437
|
+
+context(child, $color: yellow)
|
1438
|
+
color: $color
|
1439
|
+
SASS
|
1440
|
+
$color: blue;
|
1441
|
+
|
1442
|
+
@mixin context($class, $color: red) {
|
1443
|
+
.\#{$class} {
|
1444
|
+
background-color: $color;
|
1445
|
+
@content;
|
1446
|
+
border-color: $color;
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
@include context(parent) {
|
1451
|
+
@include context(child, $color: yellow) {
|
1452
|
+
color: $color;
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
SCSS
|
1456
|
+
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
def test_empty_content
|
1460
|
+
assert_scss_to_scss(<<SCSS)
|
1461
|
+
@mixin foo {
|
1462
|
+
@content;
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
@include foo {}
|
1466
|
+
SCSS
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
def test_placeholder_conversion
|
1470
|
+
assert_renders(<<SASS, <<SCSS)
|
1471
|
+
#content a%foo.bar
|
1472
|
+
color: blue
|
1473
|
+
SASS
|
1474
|
+
#content a%foo.bar {
|
1475
|
+
color: blue;
|
1476
|
+
}
|
1477
|
+
SCSS
|
1478
|
+
end
|
1479
|
+
|
1480
|
+
def test_reference_selector
|
1481
|
+
assert_renders(<<SASS, <<SCSS)
|
1482
|
+
foo /bar|baz/ bang
|
1483
|
+
a: b
|
1484
|
+
SASS
|
1485
|
+
foo /bar|baz/ bang {
|
1486
|
+
a: b;
|
1487
|
+
}
|
1488
|
+
SCSS
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
def test_subject
|
1492
|
+
assert_renders(<<SASS, <<SCSS)
|
1493
|
+
foo bar! baz
|
1494
|
+
a: b
|
1495
|
+
SASS
|
1496
|
+
foo bar! baz {
|
1497
|
+
a: b;
|
1498
|
+
}
|
1499
|
+
SCSS
|
1500
|
+
end
|
1501
|
+
|
1502
|
+
def test_placeholder_interoplation_conversion
|
1144
1503
|
assert_renders(<<SASS, <<SCSS)
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1504
|
+
$foo: foo
|
1505
|
+
|
1506
|
+
%\#{$foo}
|
1507
|
+
color: blue
|
1508
|
+
|
1509
|
+
.bar
|
1510
|
+
@extend %foo
|
1511
|
+
SASS
|
1512
|
+
$foo: foo;
|
1513
|
+
|
1514
|
+
%\#{$foo} {
|
1515
|
+
color: blue;
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
.bar {
|
1519
|
+
@extend %foo;
|
1520
|
+
}
|
1521
|
+
SCSS
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
def test_indent
|
1525
|
+
assert_renders <<SASS, <<SCSS, :indent => " "
|
1526
|
+
foo bar
|
1527
|
+
baz bang
|
1528
|
+
baz: bang
|
1529
|
+
bip: bop
|
1530
|
+
blat: boo
|
1531
|
+
SASS
|
1532
|
+
foo bar {
|
1533
|
+
baz bang {
|
1534
|
+
baz: bang;
|
1535
|
+
bip: bop;
|
1536
|
+
}
|
1537
|
+
blat: boo;
|
1538
|
+
}
|
1539
|
+
SCSS
|
1540
|
+
|
1541
|
+
assert_renders <<SASS, <<SCSS, :indent => "\t"
|
1542
|
+
foo bar
|
1543
|
+
baz bang
|
1544
|
+
baz: bang
|
1545
|
+
bip: bop
|
1546
|
+
blat: boo
|
1547
|
+
SASS
|
1548
|
+
foo bar {
|
1549
|
+
baz bang {
|
1550
|
+
baz: bang;
|
1551
|
+
bip: bop;
|
1552
|
+
}
|
1553
|
+
blat: boo;
|
1554
|
+
}
|
1555
|
+
SCSS
|
1556
|
+
|
1557
|
+
assert_sass_to_scss <<SCSS, <<SASS, :indent => " "
|
1558
|
+
foo bar {
|
1559
|
+
baz bang {
|
1560
|
+
baz: bang;
|
1561
|
+
bip: bop;
|
1562
|
+
}
|
1563
|
+
blat: boo;
|
1564
|
+
}
|
1565
|
+
SCSS
|
1566
|
+
foo bar
|
1567
|
+
baz bang
|
1568
|
+
baz: bang
|
1569
|
+
bip: bop
|
1570
|
+
blat: boo
|
1571
|
+
SASS
|
1572
|
+
|
1573
|
+
assert_sass_to_scss <<SCSS, <<SASS, :indent => "\t"
|
1574
|
+
foo bar {
|
1575
|
+
baz bang {
|
1576
|
+
baz: bang;
|
1577
|
+
bip: bop;
|
1578
|
+
}
|
1579
|
+
blat: boo;
|
1580
|
+
}
|
1581
|
+
SCSS
|
1582
|
+
foo bar
|
1583
|
+
baz bang
|
1584
|
+
baz: bang
|
1585
|
+
bip: bop
|
1586
|
+
blat: boo
|
1587
|
+
SASS
|
1588
|
+
|
1589
|
+
assert_scss_to_sass <<SASS, <<SCSS, :indent => " "
|
1590
|
+
foo bar
|
1591
|
+
baz bang
|
1592
|
+
baz: bang
|
1593
|
+
bip: bop
|
1594
|
+
blat: boo
|
1595
|
+
SASS
|
1596
|
+
foo bar {
|
1597
|
+
baz bang {
|
1598
|
+
baz: bang;
|
1599
|
+
bip: bop;
|
1600
|
+
}
|
1601
|
+
blat: boo;
|
1602
|
+
}
|
1603
|
+
SCSS
|
1604
|
+
|
1605
|
+
assert_scss_to_sass <<SASS, <<SCSS, :indent => "\t"
|
1606
|
+
foo bar
|
1607
|
+
baz bang
|
1608
|
+
baz: bang
|
1609
|
+
bip: bop
|
1610
|
+
blat: boo
|
1611
|
+
SASS
|
1612
|
+
foo bar {
|
1613
|
+
baz bang {
|
1614
|
+
baz: bang;
|
1615
|
+
bip: bop;
|
1616
|
+
}
|
1617
|
+
blat: boo;
|
1618
|
+
}
|
1619
|
+
SCSS
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
def test_extend_with_optional
|
1623
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1624
|
+
foo
|
1625
|
+
@extend .bar !optional
|
1148
1626
|
SASS
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1627
|
+
foo {
|
1628
|
+
@extend .bar !optional;
|
1629
|
+
}
|
1630
|
+
SCSS
|
1631
|
+
end
|
1632
|
+
|
1633
|
+
def test_mixin_var_args
|
1634
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1635
|
+
=foo($args...)
|
1636
|
+
a: b
|
1637
|
+
|
1638
|
+
=bar($a, $args...)
|
1639
|
+
a: b
|
1640
|
+
|
1641
|
+
.foo
|
1642
|
+
+foo($list...)
|
1643
|
+
+bar(1, $list...)
|
1644
|
+
SASS
|
1645
|
+
@mixin foo($args...) {
|
1646
|
+
a: b;
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
@mixin bar($a, $args...) {
|
1650
|
+
a: b;
|
1651
|
+
}
|
1652
|
+
|
1653
|
+
.foo {
|
1654
|
+
@include foo($list...);
|
1655
|
+
@include bar(1, $list...);
|
1656
|
+
}
|
1657
|
+
SCSS
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
def test_mixin_var_kwargs
|
1661
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1662
|
+
=foo($a: b, $c: d)
|
1663
|
+
a: $a
|
1664
|
+
c: $c
|
1665
|
+
|
1666
|
+
.foo
|
1667
|
+
+foo($list..., $map...)
|
1668
|
+
+foo(pos, $list..., $kwd: val, $map...)
|
1669
|
+
SASS
|
1670
|
+
@mixin foo($a: b, $c: d) {
|
1671
|
+
a: $a;
|
1672
|
+
c: $c;
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
.foo {
|
1676
|
+
@include foo($list..., $map...);
|
1677
|
+
@include foo(pos, $list..., $kwd: val, $map...);
|
1678
|
+
}
|
1679
|
+
SCSS
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
def test_function_var_args
|
1683
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1684
|
+
@function foo($args...)
|
1685
|
+
@return foo
|
1686
|
+
|
1687
|
+
@function bar($a, $args...)
|
1688
|
+
@return bar
|
1689
|
+
|
1690
|
+
.foo
|
1691
|
+
a: foo($list...)
|
1692
|
+
b: bar(1, $list...)
|
1693
|
+
SASS
|
1694
|
+
@function foo($args...) {
|
1695
|
+
@return foo;
|
1696
|
+
}
|
1697
|
+
|
1698
|
+
@function bar($a, $args...) {
|
1699
|
+
@return bar;
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
.foo {
|
1703
|
+
a: foo($list...);
|
1704
|
+
b: bar(1, $list...);
|
1705
|
+
}
|
1706
|
+
SCSS
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
def test_function_var_kwargs
|
1710
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1711
|
+
@function foo($a: b, $c: d)
|
1712
|
+
@return foo
|
1713
|
+
|
1714
|
+
.foo
|
1715
|
+
a: foo($list..., $map...)
|
1716
|
+
b: foo(pos, $list..., $kwd: val, $map...)
|
1717
|
+
SASS
|
1718
|
+
@function foo($a: b, $c: d) {
|
1719
|
+
@return foo;
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
.foo {
|
1723
|
+
a: foo($list..., $map...);
|
1724
|
+
b: foo(pos, $list..., $kwd: val, $map...);
|
1725
|
+
}
|
1726
|
+
SCSS
|
1727
|
+
end
|
1728
|
+
|
1729
|
+
def test_at_root
|
1730
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1731
|
+
.foo
|
1732
|
+
@at-root
|
1733
|
+
.bar
|
1734
|
+
a: b
|
1735
|
+
.baz
|
1736
|
+
c: d
|
1737
|
+
SASS
|
1738
|
+
.foo {
|
1739
|
+
@at-root {
|
1740
|
+
.bar {
|
1741
|
+
a: b;
|
1742
|
+
}
|
1743
|
+
.baz {
|
1744
|
+
c: d;
|
1745
|
+
}
|
1746
|
+
}
|
1747
|
+
}
|
1748
|
+
SCSS
|
1749
|
+
end
|
1750
|
+
|
1751
|
+
def test_at_root_with_selector
|
1752
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1753
|
+
.foo
|
1754
|
+
@at-root .bar
|
1755
|
+
a: b
|
1756
|
+
SASS
|
1757
|
+
.foo {
|
1758
|
+
@at-root .bar {
|
1759
|
+
a: b;
|
1760
|
+
}
|
1761
|
+
}
|
1762
|
+
SCSS
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
def test_at_root_without
|
1766
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1767
|
+
.foo
|
1768
|
+
@at-root (without: media rule)
|
1769
|
+
a: b
|
1770
|
+
SASS
|
1771
|
+
.foo {
|
1772
|
+
@at-root (without: media rule) {
|
1773
|
+
a: b;
|
1774
|
+
}
|
1775
|
+
}
|
1776
|
+
SCSS
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
def test_at_root_with
|
1780
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1781
|
+
.foo
|
1782
|
+
@at-root (with: media rule)
|
1783
|
+
a: b
|
1784
|
+
SASS
|
1785
|
+
.foo {
|
1786
|
+
@at-root (with: media rule) {
|
1787
|
+
a: b;
|
1788
|
+
}
|
1789
|
+
}
|
1790
|
+
SCSS
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
def test_function_var_kwargs_with_list
|
1794
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1795
|
+
@function foo($a: b, $c: d)
|
1796
|
+
@return $a, $c
|
1797
|
+
|
1798
|
+
.foo
|
1799
|
+
a: foo($list..., $map...)
|
1800
|
+
SASS
|
1801
|
+
@function foo($a: b, $c: d) {
|
1802
|
+
@return $a, $c;
|
1803
|
+
}
|
1804
|
+
|
1805
|
+
.foo {
|
1806
|
+
a: foo($list..., $map...);
|
1807
|
+
}
|
1808
|
+
SCSS
|
1809
|
+
end
|
1810
|
+
|
1811
|
+
## Regression Tests
|
1812
|
+
|
1813
|
+
def test_list_in_args
|
1814
|
+
assert_renders(<<SASS, <<SCSS)
|
1815
|
+
+mixin((a, b, c))
|
1816
|
+
|
1817
|
+
+mixin($arg: (a, b, c))
|
1818
|
+
|
1819
|
+
+mixin(a, b, (c, d, e)...)
|
1820
|
+
SASS
|
1821
|
+
@include mixin((a, b, c));
|
1822
|
+
|
1823
|
+
@include mixin($arg: (a, b, c));
|
1824
|
+
|
1825
|
+
@include mixin(a, b, (c, d, e)...);
|
1826
|
+
SCSS
|
1827
|
+
end
|
1828
|
+
|
1829
|
+
def test_media_query_with_expr
|
1830
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1831
|
+
@media foo and (bar: baz)
|
1832
|
+
a: b
|
1833
|
+
SASS
|
1834
|
+
@media foo and (bar: baz) {
|
1835
|
+
a: b; }
|
1836
|
+
SCSS
|
1837
|
+
end
|
1838
|
+
|
1839
|
+
def test_nested_if_statements
|
1840
|
+
assert_renders(<<SASS, <<SCSS)
|
1841
|
+
@if $foo
|
1842
|
+
one
|
1843
|
+
a: b
|
1844
|
+
@else
|
1845
|
+
@if $bar
|
1846
|
+
two
|
1847
|
+
a: b
|
1848
|
+
@else
|
1849
|
+
three
|
1850
|
+
a: b
|
1851
|
+
SASS
|
1852
|
+
@if $foo {
|
1853
|
+
one {
|
1854
|
+
a: b;
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
@else {
|
1858
|
+
@if $bar {
|
1859
|
+
two {
|
1860
|
+
a: b;
|
1861
|
+
}
|
1862
|
+
}
|
1863
|
+
@else {
|
1864
|
+
three {
|
1865
|
+
a: b;
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
}
|
1869
|
+
SCSS
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
def test_comment_indentation
|
1873
|
+
assert_renders(<<SASS, <<SCSS, :indent => ' ')
|
1874
|
+
foo
|
1875
|
+
// bar
|
1876
|
+
/* baz
|
1877
|
+
a: b
|
1878
|
+
SASS
|
1879
|
+
foo {
|
1880
|
+
// bar
|
1881
|
+
/* baz */
|
1882
|
+
a: b;
|
1883
|
+
}
|
1884
|
+
SCSS
|
1885
|
+
end
|
1886
|
+
|
1887
|
+
def test_keyword_arguments
|
1888
|
+
assert_renders(<<SASS, <<SCSS, :dasherize => true)
|
1889
|
+
$foo: foo($dash-ed: 2px)
|
1890
|
+
SASS
|
1891
|
+
$foo: foo($dash-ed: 2px);
|
1892
|
+
SCSS
|
1893
|
+
assert_scss_to_sass(<<SASS, <<SCSS, :dasherize => true)
|
1894
|
+
$foo: foo($dash-ed: 2px)
|
1895
|
+
SASS
|
1896
|
+
$foo: foo($dash_ed: 2px);
|
1897
|
+
SCSS
|
1898
|
+
assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
|
1899
|
+
$foo: foo($dash-ed: 2px);
|
1900
|
+
SCSS
|
1901
|
+
$foo: foo($dash_ed: 2px)
|
1902
|
+
SASS
|
1903
|
+
assert_renders(<<SASS, <<SCSS)
|
1904
|
+
$foo: foo($under_scored: 1px)
|
1905
|
+
SASS
|
1906
|
+
$foo: foo($under_scored: 1px);
|
1907
|
+
SCSS
|
1908
|
+
assert_renders(<<SASS, <<SCSS)
|
1909
|
+
$foo: foo($dash-ed: 2px, $under_scored: 1px)
|
1910
|
+
SASS
|
1911
|
+
$foo: foo($dash-ed: 2px, $under_scored: 1px);
|
1912
|
+
SCSS
|
1913
|
+
end
|
1914
|
+
|
1915
|
+
def test_ambiguous_negation
|
1916
|
+
assert_renders(<<SASS, <<SCSS, :indent => ' ')
|
1917
|
+
foo
|
1918
|
+
ok: -$foo
|
1919
|
+
comma: 10px, -$foo
|
1920
|
+
needs-parens: 10px (-$foo)
|
1921
|
+
no-parens: a 50px + 60px b
|
1922
|
+
SASS
|
1923
|
+
foo {
|
1924
|
+
ok: -$foo;
|
1925
|
+
comma: 10px, -$foo;
|
1926
|
+
needs-parens: 10px (-$foo);
|
1927
|
+
no-parens: a 50px + 60px b;
|
1928
|
+
}
|
1929
|
+
SCSS
|
1930
|
+
end
|
1931
|
+
|
1932
|
+
def test_variable_with_global
|
1933
|
+
assert_renders(<<SASS, <<SCSS)
|
1934
|
+
$var: 1
|
1935
|
+
|
1936
|
+
foo
|
1937
|
+
$var: 2 !global
|
1938
|
+
$var: 3 !global !default
|
1939
|
+
SASS
|
1940
|
+
$var: 1;
|
1941
|
+
|
1942
|
+
foo {
|
1943
|
+
$var: 2 !global;
|
1944
|
+
$var: 3 !global !default;
|
1945
|
+
}
|
1152
1946
|
SCSS
|
1153
1947
|
end
|
1154
1948
|
|
@@ -1174,7 +1968,7 @@ SCSS
|
|
1174
1968
|
options ||= {}
|
1175
1969
|
|
1176
1970
|
assert_equal(scss.rstrip, to_scss(in_scss, options.merge(:syntax => :scss)).rstrip,
|
1177
|
-
"Expected SCSS to transform to #{scss == in_scss ? 'itself' : 'SCSS'}
|
1971
|
+
"Expected SCSS to transform to #{scss == in_scss ? 'itself' : 'SCSS'}")
|
1178
1972
|
end
|
1179
1973
|
|
1180
1974
|
def assert_sass_to_scss(scss, sass, options = {})
|