sass 3.7.4 → 4.0.0.alpha.1

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.
Files changed (257) hide show
  1. checksums.yaml +13 -5
  2. data/.yardopts +1 -1
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/CONTRIBUTING.md +1 -146
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +25 -39
  7. data/Rakefile +274 -0
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/lib/sass.rb +3 -3
  11. data/lib/sass/cache_stores/filesystem.rb +2 -2
  12. data/lib/sass/cache_stores/memory.rb +5 -4
  13. data/lib/sass/callbacks.rb +2 -2
  14. data/lib/sass/css.rb +12 -12
  15. data/lib/sass/engine.rb +44 -62
  16. data/lib/sass/environment.rb +7 -35
  17. data/lib/sass/error.rb +14 -14
  18. data/lib/sass/exec/base.rb +14 -3
  19. data/lib/sass/exec/sass_convert.rb +6 -20
  20. data/lib/sass/exec/sass_scss.rb +29 -5
  21. data/lib/sass/features.rb +2 -3
  22. data/lib/sass/importers/filesystem.rb +6 -11
  23. data/lib/sass/logger.rb +3 -8
  24. data/lib/sass/logger/base.rb +2 -19
  25. data/lib/sass/plugin.rb +2 -3
  26. data/lib/sass/plugin/compiler.rb +67 -48
  27. data/lib/sass/plugin/configuration.rb +3 -3
  28. data/lib/sass/plugin/merb.rb +1 -1
  29. data/lib/sass/plugin/rack.rb +3 -3
  30. data/lib/sass/plugin/staleness_checker.rb +3 -3
  31. data/lib/sass/railtie.rb +1 -1
  32. data/lib/sass/script.rb +3 -3
  33. data/lib/sass/script/css_parser.rb +15 -5
  34. data/lib/sass/script/functions.rb +121 -337
  35. data/lib/sass/script/lexer.rb +36 -102
  36. data/lib/sass/script/parser.rb +153 -529
  37. data/lib/sass/script/tree/funcall.rb +34 -42
  38. data/lib/sass/script/tree/interpolation.rb +26 -171
  39. data/lib/sass/script/tree/list_literal.rb +8 -23
  40. data/lib/sass/script/tree/map_literal.rb +2 -2
  41. data/lib/sass/script/tree/node.rb +3 -3
  42. data/lib/sass/script/tree/operation.rb +16 -43
  43. data/lib/sass/script/tree/string_interpolation.rb +43 -64
  44. data/lib/sass/script/tree/variable.rb +1 -1
  45. data/lib/sass/script/value.rb +0 -2
  46. data/lib/sass/script/value/arg_list.rb +1 -1
  47. data/lib/sass/script/value/base.rb +9 -27
  48. data/lib/sass/script/value/color.rb +18 -26
  49. data/lib/sass/script/value/helpers.rb +18 -44
  50. data/lib/sass/script/value/list.rb +14 -35
  51. data/lib/sass/script/value/map.rb +2 -2
  52. data/lib/sass/script/value/number.rb +16 -26
  53. data/lib/sass/script/value/string.rb +1 -30
  54. data/lib/sass/scss.rb +2 -0
  55. data/lib/sass/scss/css_parser.rb +3 -7
  56. data/lib/sass/scss/parser.rb +78 -196
  57. data/lib/sass/scss/rx.rb +14 -7
  58. data/lib/sass/scss/script_lexer.rb +15 -0
  59. data/lib/sass/scss/script_parser.rb +25 -0
  60. data/lib/sass/scss/static_parser.rb +55 -38
  61. data/lib/sass/selector.rb +10 -7
  62. data/lib/sass/selector/abstract_sequence.rb +12 -15
  63. data/lib/sass/selector/comma_sequence.rb +6 -24
  64. data/lib/sass/selector/pseudo.rb +6 -19
  65. data/lib/sass/selector/sequence.rb +16 -14
  66. data/lib/sass/selector/simple.rb +7 -9
  67. data/lib/sass/selector/simple_sequence.rb +12 -16
  68. data/lib/sass/shared.rb +1 -1
  69. data/lib/sass/source/map.rb +9 -7
  70. data/lib/sass/source/position.rb +4 -4
  71. data/lib/sass/stack.rb +3 -23
  72. data/lib/sass/tree/charset_node.rb +1 -1
  73. data/lib/sass/tree/comment_node.rb +1 -1
  74. data/lib/sass/tree/function_node.rb +3 -2
  75. data/lib/sass/tree/node.rb +3 -5
  76. data/lib/sass/tree/prop_node.rb +58 -49
  77. data/lib/sass/tree/rule_node.rb +8 -15
  78. data/lib/sass/tree/visitors/check_nesting.rb +23 -19
  79. data/lib/sass/tree/visitors/convert.rb +13 -15
  80. data/lib/sass/tree/visitors/cssize.rb +15 -4
  81. data/lib/sass/tree/visitors/deep_copy.rb +2 -2
  82. data/lib/sass/tree/visitors/extend.rb +14 -10
  83. data/lib/sass/tree/visitors/perform.rb +18 -29
  84. data/lib/sass/tree/visitors/set_options.rb +2 -2
  85. data/lib/sass/tree/visitors/to_css.rb +47 -77
  86. data/lib/sass/util.rb +311 -98
  87. data/lib/sass/util/cross_platform_random.rb +19 -0
  88. data/lib/sass/util/multibyte_string_scanner.rb +133 -127
  89. data/lib/sass/util/normalized_map.rb +8 -1
  90. data/lib/sass/util/ordered_hash.rb +192 -0
  91. data/lib/sass/version.rb +6 -2
  92. data/test/sass/cache_test.rb +131 -0
  93. data/test/sass/callbacks_test.rb +61 -0
  94. data/test/sass/compiler_test.rb +236 -0
  95. data/test/sass/conversion_test.rb +2171 -0
  96. data/test/sass/css2sass_test.rb +526 -0
  97. data/test/sass/data/hsl-rgb.txt +319 -0
  98. data/test/sass/encoding_test.rb +219 -0
  99. data/test/sass/engine_test.rb +3400 -0
  100. data/test/sass/exec_test.rb +86 -0
  101. data/test/sass/extend_test.rb +1719 -0
  102. data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
  103. data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
  104. data/test/sass/functions_test.rb +1984 -0
  105. data/test/sass/importer_test.rb +421 -0
  106. data/test/sass/logger_test.rb +58 -0
  107. data/test/sass/mock_importer.rb +49 -0
  108. data/test/sass/more_results/more1.css +9 -0
  109. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  110. data/test/sass/more_results/more_import.css +29 -0
  111. data/test/sass/more_templates/_more_partial.sass +2 -0
  112. data/test/sass/more_templates/more1.sass +23 -0
  113. data/test/sass/more_templates/more_import.sass +11 -0
  114. data/test/sass/plugin_test.rb +556 -0
  115. data/test/sass/results/alt.css +4 -0
  116. data/test/sass/results/basic.css +9 -0
  117. data/test/sass/results/cached_import_option.css +3 -0
  118. data/test/sass/results/compact.css +5 -0
  119. data/test/sass/results/complex.css +86 -0
  120. data/test/sass/results/compressed.css +1 -0
  121. data/test/sass/results/expanded.css +19 -0
  122. data/test/sass/results/filename_fn.css +3 -0
  123. data/test/sass/results/if.css +3 -0
  124. data/test/sass/results/import.css +31 -0
  125. data/test/sass/results/import_charset.css +5 -0
  126. data/test/sass/results/import_charset_1_8.css +5 -0
  127. data/test/sass/results/import_charset_ibm866.css +5 -0
  128. data/test/sass/results/import_content.css +1 -0
  129. data/test/sass/results/line_numbers.css +49 -0
  130. data/test/sass/results/mixins.css +95 -0
  131. data/test/sass/results/multiline.css +24 -0
  132. data/test/sass/results/nested.css +22 -0
  133. data/test/sass/results/options.css +1 -0
  134. data/test/sass/results/parent_ref.css +13 -0
  135. data/test/sass/results/script.css +16 -0
  136. data/test/sass/results/scss_import.css +31 -0
  137. data/test/sass/results/scss_importee.css +2 -0
  138. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  139. data/test/sass/results/subdir/subdir.css +3 -0
  140. data/test/sass/results/units.css +11 -0
  141. data/test/sass/results/warn.css +0 -0
  142. data/test/sass/results/warn_imported.css +0 -0
  143. data/test/sass/script_conversion_test.rb +306 -0
  144. data/test/sass/script_test.rb +1206 -0
  145. data/test/sass/scss/css_test.rb +1281 -0
  146. data/test/sass/scss/rx_test.rb +160 -0
  147. data/test/sass/scss/scss_test.rb +4147 -0
  148. data/test/sass/scss/test_helper.rb +37 -0
  149. data/test/sass/source_map_test.rb +1055 -0
  150. data/test/sass/superselector_test.rb +210 -0
  151. data/test/sass/templates/_cached_import_option_partial.scss +1 -0
  152. data/test/sass/templates/_double_import_loop2.sass +1 -0
  153. data/test/sass/templates/_filename_fn_import.scss +11 -0
  154. data/test/sass/templates/_imported_charset_ibm866.sass +4 -0
  155. data/test/sass/templates/_imported_charset_utf8.sass +4 -0
  156. data/test/sass/templates/_imported_content.sass +3 -0
  157. data/test/sass/templates/_partial.sass +2 -0
  158. data/test/sass/templates/_same_name_different_partiality.scss +1 -0
  159. data/test/sass/templates/alt.sass +16 -0
  160. data/test/sass/templates/basic.sass +23 -0
  161. data/test/sass/templates/bork1.sass +2 -0
  162. data/test/sass/templates/bork2.sass +2 -0
  163. data/test/sass/templates/bork3.sass +2 -0
  164. data/test/sass/templates/bork4.sass +2 -0
  165. data/test/sass/templates/bork5.sass +3 -0
  166. data/test/sass/templates/cached_import_option.scss +3 -0
  167. data/test/sass/templates/compact.sass +17 -0
  168. data/test/sass/templates/complex.sass +305 -0
  169. data/test/sass/templates/compressed.sass +15 -0
  170. data/test/sass/templates/double_import_loop1.sass +1 -0
  171. data/test/sass/templates/expanded.sass +17 -0
  172. data/test/sass/templates/filename_fn.scss +18 -0
  173. data/test/sass/templates/if.sass +11 -0
  174. data/test/sass/templates/import.sass +12 -0
  175. data/test/sass/templates/import_charset.sass +9 -0
  176. data/test/sass/templates/import_charset_1_8.sass +6 -0
  177. data/test/sass/templates/import_charset_ibm866.sass +11 -0
  178. data/test/sass/templates/import_content.sass +4 -0
  179. data/test/sass/templates/importee.less +2 -0
  180. data/test/sass/templates/importee.sass +19 -0
  181. data/test/sass/templates/line_numbers.sass +13 -0
  182. data/test/sass/templates/mixin_bork.sass +5 -0
  183. data/test/sass/templates/mixins.sass +76 -0
  184. data/test/sass/templates/multiline.sass +20 -0
  185. data/test/sass/templates/nested.sass +25 -0
  186. data/test/sass/templates/nested_bork1.sass +2 -0
  187. data/test/sass/templates/nested_bork2.sass +2 -0
  188. data/test/sass/templates/nested_bork3.sass +2 -0
  189. data/test/sass/templates/nested_bork4.sass +2 -0
  190. data/test/sass/templates/nested_import.sass +2 -0
  191. data/test/sass/templates/nested_mixin_bork.sass +6 -0
  192. data/test/sass/templates/options.sass +2 -0
  193. data/test/sass/templates/parent_ref.sass +25 -0
  194. data/test/sass/templates/same_name_different_ext.sass +2 -0
  195. data/test/sass/templates/same_name_different_ext.scss +1 -0
  196. data/test/sass/templates/same_name_different_partiality.scss +1 -0
  197. data/test/sass/templates/script.sass +101 -0
  198. data/test/sass/templates/scss_import.scss +12 -0
  199. data/test/sass/templates/scss_importee.scss +1 -0
  200. data/test/sass/templates/single_import_loop.sass +1 -0
  201. data/test/sass/templates/subdir/import_up1.scss +1 -0
  202. data/test/sass/templates/subdir/import_up2.scss +1 -0
  203. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  204. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  205. data/test/sass/templates/subdir/subdir.sass +6 -0
  206. data/test/sass/templates/units.sass +11 -0
  207. data/test/sass/templates/warn.sass +3 -0
  208. data/test/sass/templates/warn_imported.sass +4 -0
  209. data/test/sass/test_helper.rb +8 -0
  210. data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
  211. data/test/sass/util/normalized_map_test.rb +51 -0
  212. data/test/sass/util/subset_map_test.rb +91 -0
  213. data/test/sass/util_test.rb +438 -0
  214. data/test/sass/value_helpers_test.rb +179 -0
  215. data/test/test_helper.rb +110 -0
  216. data/vendor/listen/CHANGELOG.md +1 -0
  217. data/vendor/listen/CONTRIBUTING.md +38 -0
  218. data/vendor/listen/Gemfile +20 -0
  219. data/vendor/listen/Guardfile +8 -0
  220. data/vendor/listen/LICENSE +20 -0
  221. data/vendor/listen/README.md +349 -0
  222. data/vendor/listen/Rakefile +5 -0
  223. data/vendor/listen/Vagrantfile +96 -0
  224. data/vendor/listen/lib/listen.rb +54 -0
  225. data/vendor/listen/lib/listen/adapter.rb +327 -0
  226. data/vendor/listen/lib/listen/adapters/bsd.rb +75 -0
  227. data/vendor/listen/lib/listen/adapters/darwin.rb +48 -0
  228. data/vendor/listen/lib/listen/adapters/linux.rb +81 -0
  229. data/vendor/listen/lib/listen/adapters/polling.rb +58 -0
  230. data/vendor/listen/lib/listen/adapters/windows.rb +91 -0
  231. data/vendor/listen/lib/listen/directory_record.rb +406 -0
  232. data/vendor/listen/lib/listen/listener.rb +323 -0
  233. data/vendor/listen/lib/listen/turnstile.rb +32 -0
  234. data/vendor/listen/lib/listen/version.rb +3 -0
  235. data/vendor/listen/listen.gemspec +28 -0
  236. data/vendor/listen/spec/listen/adapter_spec.rb +149 -0
  237. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
  238. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
  239. data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
  240. data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
  241. data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
  242. data/vendor/listen/spec/listen/directory_record_spec.rb +1250 -0
  243. data/vendor/listen/spec/listen/listener_spec.rb +258 -0
  244. data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
  245. data/vendor/listen/spec/listen_spec.rb +67 -0
  246. data/vendor/listen/spec/spec_helper.rb +25 -0
  247. data/vendor/listen/spec/support/adapter_helper.rb +666 -0
  248. data/vendor/listen/spec/support/directory_record_helper.rb +57 -0
  249. data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
  250. data/vendor/listen/spec/support/listeners_helper.rb +179 -0
  251. data/vendor/listen/spec/support/platform_helper.rb +15 -0
  252. metadata +217 -76
  253. data/extra/sass-spec-ref.sh +0 -40
  254. data/lib/sass/deprecation.rb +0 -55
  255. data/lib/sass/logger/delayed.rb +0 -50
  256. data/lib/sass/script/value/callable.rb +0 -25
  257. data/lib/sass/script/value/function.rb +0 -19
@@ -0,0 +1,2171 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+
4
+ class ConversionTest < MiniTest::Test
5
+ def test_basic
6
+ assert_renders <<SASS, <<SCSS
7
+ foo bar
8
+ baz: bang
9
+ bip: bop
10
+ SASS
11
+ foo bar {
12
+ baz: bang;
13
+ bip: bop;
14
+ }
15
+ SCSS
16
+ assert_renders <<SASS, <<SCSS, :old => true
17
+ foo bar
18
+ :baz bang
19
+ :bip bop
20
+ SASS
21
+ foo bar {
22
+ baz: bang;
23
+ bip: bop;
24
+ }
25
+ SCSS
26
+ end
27
+
28
+ def test_empty_selector
29
+ assert_renders "foo bar", "foo bar {}"
30
+ end
31
+
32
+ def test_empty_directive
33
+ assert_renders "@media screen", "@media screen {}"
34
+ end
35
+
36
+ def test_empty_control_directive
37
+ assert_renders "@if false", "@if false {}"
38
+ end
39
+
40
+ def test_nesting
41
+ assert_renders <<SASS, <<SCSS
42
+ foo bar
43
+ baz bang
44
+ baz: bang
45
+ bip: bop
46
+
47
+ blat: boo
48
+ SASS
49
+ foo bar {
50
+ baz bang {
51
+ baz: bang;
52
+ bip: bop;
53
+ }
54
+
55
+ blat: boo;
56
+ }
57
+ SCSS
58
+ end
59
+
60
+ def test_nesting_with_parent_ref
61
+ assert_renders <<SASS, <<SCSS
62
+ foo bar
63
+ &:hover
64
+ baz: bang
65
+ SASS
66
+ foo bar {
67
+ &:hover {
68
+ baz: bang;
69
+ }
70
+ }
71
+ SCSS
72
+ end
73
+
74
+ def test_selector_interpolation
75
+ assert_renders <<SASS, <<SCSS
76
+ foo \#{$bar + "baz"}.bip
77
+ baz: bang
78
+
79
+ foo /\#{$bar + "baz"}/ .bip
80
+ baz: bang
81
+ SASS
82
+ foo \#{$bar + "baz"}.bip {
83
+ baz: bang;
84
+ }
85
+
86
+ foo /\#{$bar + "baz"}/ .bip {
87
+ baz: bang;
88
+ }
89
+ SCSS
90
+ end
91
+
92
+ def test_multiline_selector_with_commas
93
+ assert_renders <<SASS, <<SCSS
94
+ foo bar,
95
+ baz bang
96
+ baz: bang
97
+ SASS
98
+ foo bar,
99
+ baz bang {
100
+ baz: bang;
101
+ }
102
+ SCSS
103
+
104
+ assert_renders <<SASS, <<SCSS
105
+ blat
106
+ foo bar,
107
+ baz bang
108
+ baz: bang
109
+ SASS
110
+ blat {
111
+ foo bar,
112
+ baz bang {
113
+ baz: bang;
114
+ }
115
+ }
116
+ SCSS
117
+ end
118
+
119
+ def test_multiline_selector_without_commas
120
+ assert_scss_to_sass <<SASS, <<SCSS
121
+ foo bar baz bang
122
+ baz: bang
123
+ SASS
124
+ foo bar
125
+ baz bang {
126
+ baz: bang;
127
+ }
128
+ SCSS
129
+
130
+ assert_scss_to_scss <<SCSS
131
+ foo bar
132
+ baz bang {
133
+ baz: bang;
134
+ }
135
+ SCSS
136
+ end
137
+
138
+ def test_escaped_selector
139
+ assert_renders <<SASS, <<SCSS
140
+ foo bar
141
+ \\:hover
142
+ baz: bang
143
+ SASS
144
+ foo bar {
145
+ :hover {
146
+ baz: bang;
147
+ }
148
+ }
149
+ SCSS
150
+ end
151
+
152
+ def test_property_name_interpolation
153
+ assert_renders <<SASS, <<SCSS
154
+ foo bar
155
+ baz\#{$bang}bip\#{$bop}: 12
156
+ SASS
157
+ foo bar {
158
+ baz\#{$bang}bip\#{$bop}: 12;
159
+ }
160
+ SCSS
161
+ end
162
+
163
+ def test_property_value_interpolation
164
+ assert_renders <<SASS, <<SCSS
165
+ foo bar
166
+ baz: 12 \#{$bang} bip \#{"bop"} blat
167
+ SASS
168
+ foo bar {
169
+ baz: 12 \#{$bang} bip \#{"bop"} blat;
170
+ }
171
+ SCSS
172
+ end
173
+
174
+ def test_dynamic_properties
175
+ assert_renders <<SASS, <<SCSS
176
+ foo bar
177
+ baz: 12 $bang "bip"
178
+ SASS
179
+ foo bar {
180
+ baz: 12 $bang "bip";
181
+ }
182
+ SCSS
183
+ end
184
+
185
+ def test_dynamic_properties_with_old
186
+ assert_renders <<SASS, <<SCSS, :old => true
187
+ foo bar
188
+ :baz 12 $bang "bip"
189
+ SASS
190
+ foo bar {
191
+ baz: 12 $bang "bip";
192
+ }
193
+ SCSS
194
+ end
195
+
196
+ def test_multiline_properties
197
+ assert_scss_to_sass <<SASS, <<SCSS
198
+ foo bar
199
+ baz: bip bam boon
200
+ SASS
201
+ foo bar {
202
+ baz:
203
+ bip
204
+ bam
205
+ boon;
206
+ }
207
+ SCSS
208
+
209
+ assert_scss_to_scss <<OUT, <<IN
210
+ foo bar {
211
+ baz: bip bam boon;
212
+ }
213
+ OUT
214
+ foo bar {
215
+ baz:
216
+ bip
217
+ bam
218
+ boon;
219
+ }
220
+ IN
221
+ end
222
+
223
+ def test_multiline_dynamic_properties
224
+ assert_scss_to_sass <<SASS, <<SCSS
225
+ foo bar
226
+ baz: $bip "bam" 12px
227
+ SASS
228
+ foo bar {
229
+ baz:
230
+ $bip
231
+ "bam"
232
+ 12px;
233
+ }
234
+ SCSS
235
+
236
+ assert_scss_to_scss <<OUT, <<IN
237
+ foo bar {
238
+ baz: $bip "bam" 12px;
239
+ }
240
+ OUT
241
+ foo bar {
242
+ baz:
243
+ $bip
244
+ "bam"
245
+ 12px;
246
+ }
247
+ IN
248
+ end
249
+
250
+ def test_silent_comments
251
+ assert_renders <<SASS, <<SCSS
252
+ // foo
253
+
254
+ // bar
255
+
256
+ // baz
257
+
258
+ foo bar
259
+ a: b
260
+ SASS
261
+ // foo
262
+
263
+ // bar
264
+
265
+ // baz
266
+
267
+ foo bar {
268
+ a: b;
269
+ }
270
+ SCSS
271
+
272
+ assert_renders <<SASS, <<SCSS
273
+ // foo
274
+ // bar
275
+ // baz
276
+ // bang
277
+
278
+ foo bar
279
+ a: b
280
+ SASS
281
+ // foo
282
+ // bar
283
+ // baz
284
+ // bang
285
+
286
+ foo bar {
287
+ a: b;
288
+ }
289
+ SCSS
290
+
291
+ assert_renders <<SASS, <<SCSS
292
+ // foo
293
+ // bar
294
+ // baz
295
+ // bang
296
+
297
+ foo bar
298
+ a: b
299
+ SASS
300
+ // foo
301
+ // bar
302
+ // baz
303
+ // bang
304
+
305
+ foo bar {
306
+ a: b;
307
+ }
308
+ SCSS
309
+ end
310
+
311
+ def test_nested_silent_comments
312
+ assert_renders <<SASS, <<SCSS
313
+ foo
314
+ bar: baz
315
+
316
+ // bip bop
317
+ // beep boop
318
+ bang: bizz
319
+
320
+ // bubble bubble
321
+ // toil trouble
322
+ SASS
323
+ foo {
324
+ bar: baz;
325
+
326
+ // bip bop
327
+ // beep boop
328
+ bang: bizz;
329
+
330
+ // bubble bubble
331
+ // toil trouble
332
+ }
333
+ SCSS
334
+
335
+ assert_sass_to_scss <<SCSS, <<SASS
336
+ foo {
337
+ bar: baz;
338
+
339
+ // bip bop
340
+ // beep boop
341
+ // bap blimp
342
+ bang: bizz;
343
+
344
+ // bubble bubble
345
+ // toil trouble
346
+ // gorp
347
+ }
348
+ SCSS
349
+ foo
350
+ bar: baz
351
+
352
+ // bip bop
353
+ beep boop
354
+ bap blimp
355
+ bang: bizz
356
+
357
+ // bubble bubble
358
+ toil trouble
359
+ gorp
360
+ SASS
361
+ end
362
+
363
+ def test_preserves_triple_slash_comments
364
+ assert_renders <<SASS, <<SCSS
365
+ /// foo
366
+ /// bar
367
+ foo
368
+ /// bip bop
369
+ /// beep boop
370
+ SASS
371
+ /// foo
372
+ /// bar
373
+ foo {
374
+ /// bip bop
375
+ /// beep boop
376
+ }
377
+ SCSS
378
+ end
379
+
380
+ def test_loud_comments
381
+ assert_renders <<SASS, <<SCSS
382
+ /* foo
383
+
384
+ /* bar
385
+
386
+ /* baz
387
+
388
+ foo bar
389
+ a: b
390
+ SASS
391
+ /* foo */
392
+
393
+ /* bar */
394
+
395
+ /* baz */
396
+
397
+ foo bar {
398
+ a: b;
399
+ }
400
+ SCSS
401
+
402
+ assert_scss_to_sass <<SASS, <<SCSS
403
+ /* foo
404
+ * bar
405
+ * baz
406
+ * bang
407
+
408
+ foo bar
409
+ a: b
410
+ SASS
411
+ /* foo
412
+ bar
413
+ baz
414
+ bang */
415
+
416
+ foo bar {
417
+ a: b;
418
+ }
419
+ SCSS
420
+
421
+ assert_scss_to_scss <<SCSS
422
+ /* foo
423
+ bar
424
+ baz
425
+ bang */
426
+
427
+ foo bar {
428
+ a: b;
429
+ }
430
+ SCSS
431
+
432
+ assert_renders <<SASS, <<SCSS
433
+ /* foo
434
+ * bar
435
+ * baz
436
+ * bang
437
+
438
+ foo bar
439
+ a: b
440
+ SASS
441
+ /* foo
442
+ * bar
443
+ * baz
444
+ * bang */
445
+
446
+ foo bar {
447
+ a: b;
448
+ }
449
+ SCSS
450
+ end
451
+
452
+ def test_nested_loud_comments
453
+ assert_renders <<SASS, <<SCSS
454
+ foo
455
+ bar: baz
456
+
457
+ /* bip bop
458
+ * beep boop
459
+ bang: bizz
460
+
461
+ /* bubble bubble
462
+ * toil trouble
463
+ SASS
464
+ foo {
465
+ bar: baz;
466
+
467
+ /* bip bop
468
+ * beep boop */
469
+ bang: bizz;
470
+
471
+ /* bubble bubble
472
+ * toil trouble */
473
+ }
474
+ SCSS
475
+
476
+ assert_sass_to_scss <<SCSS, <<SASS
477
+ foo {
478
+ bar: baz;
479
+
480
+ /* bip bop
481
+ * beep boop
482
+ * bap blimp */
483
+ bang: bizz;
484
+
485
+ /* bubble bubble
486
+ * toil trouble
487
+ * gorp */
488
+ }
489
+ SCSS
490
+ foo
491
+ bar: baz
492
+
493
+ /* bip bop
494
+ beep boop
495
+ bap blimp
496
+ bang: bizz
497
+
498
+ /* bubble bubble
499
+ toil trouble
500
+ gorp
501
+ SASS
502
+ end
503
+
504
+ def test_preserves_double_star_comments
505
+ assert_renders <<SASS, <<SCSS
506
+ /** foo
507
+ * bar
508
+ foo
509
+ /** bip bop
510
+ * beep boop
511
+ SASS
512
+ /** foo
513
+ * bar */
514
+ foo {
515
+ /** bip bop
516
+ * beep boop */
517
+ }
518
+ SCSS
519
+ end
520
+
521
+ def test_loud_comments_with_weird_indentation
522
+ assert_scss_to_sass <<SASS, <<SCSS
523
+ foo
524
+ /* foo
525
+ * bar
526
+ * baz
527
+ a: b
528
+ SASS
529
+ foo {
530
+ /* foo
531
+ bar
532
+ baz */
533
+ a: b;
534
+ }
535
+ SCSS
536
+
537
+ assert_sass_to_scss <<SCSS, <<SASS
538
+ foo {
539
+ /* foo
540
+ * bar
541
+ * baz */
542
+ a: b;
543
+ }
544
+ SCSS
545
+ foo
546
+ /* foo
547
+ bar
548
+ baz
549
+ a: b
550
+ SASS
551
+ end
552
+
553
+ def test_loud_comment_containing_silent_comment
554
+ assert_scss_to_sass <<SASS, <<SCSS
555
+ /*
556
+ *// foo bar
557
+ SASS
558
+ /*
559
+ // foo bar
560
+ */
561
+ SCSS
562
+ end
563
+
564
+ def test_silent_comment_containing_loud_comment
565
+ assert_scss_to_sass <<SASS, <<SCSS
566
+ // /*
567
+ // * foo bar
568
+ // */
569
+ SASS
570
+ // /*
571
+ // * foo bar
572
+ // */
573
+ SCSS
574
+ end
575
+
576
+ def test_immediately_preceding_comments
577
+ assert_renders <<SASS, <<SCSS
578
+ /* Foo
579
+ * Bar
580
+ * Baz
581
+ .foo#bar
582
+ a: b
583
+ SASS
584
+ /* Foo
585
+ * Bar
586
+ * Baz */
587
+ .foo#bar {
588
+ a: b;
589
+ }
590
+ SCSS
591
+
592
+ assert_renders <<SASS, <<SCSS
593
+ // Foo
594
+ // Bar
595
+ // Baz
596
+ =foo
597
+ a: b
598
+ SASS
599
+ // Foo
600
+ // Bar
601
+ // Baz
602
+ @mixin foo {
603
+ a: b;
604
+ }
605
+ SCSS
606
+ end
607
+
608
+ def test_immediately_following_comments
609
+ assert_sass_to_scss <<SCSS, <<SASS
610
+ .foobar {
611
+ // trailing comment
612
+ a: 1px;
613
+ }
614
+ SCSS
615
+ .foobar // trailing comment
616
+ a: 1px
617
+ SASS
618
+
619
+ assert_sass_to_scss <<SCSS, <<SASS
620
+ .foobar {
621
+ // trailing comment
622
+ a: 1px;
623
+ }
624
+ SCSS
625
+ .foobar /* trailing comment */
626
+ a: 1px
627
+ SASS
628
+ end
629
+
630
+ def test_debug
631
+ assert_renders <<SASS, <<SCSS
632
+ foo
633
+ @debug 12px
634
+
635
+ bar: baz
636
+ SASS
637
+ foo {
638
+ @debug 12px;
639
+
640
+ bar: baz;
641
+ }
642
+ SCSS
643
+ end
644
+
645
+ def test_error
646
+ assert_renders <<SASS, <<SCSS
647
+ foo
648
+ @error "oh no!"
649
+
650
+ bar: baz
651
+ SASS
652
+ foo {
653
+ @error "oh no!";
654
+
655
+ bar: baz;
656
+ }
657
+ SCSS
658
+ end
659
+
660
+ def test_directive_without_children
661
+ assert_renders <<SASS, <<SCSS
662
+ foo
663
+ @foo #bar "baz"
664
+
665
+ bar: baz
666
+ SASS
667
+ foo {
668
+ @foo #bar "baz";
669
+
670
+ bar: baz;
671
+ }
672
+ SCSS
673
+ end
674
+
675
+ def test_directive_with_prop_children
676
+ assert_renders <<SASS, <<SCSS
677
+ foo
678
+ @foo #bar "baz"
679
+ a: b
680
+ c: d
681
+
682
+ bar: baz
683
+ SASS
684
+ foo {
685
+ @foo #bar "baz" {
686
+ a: b;
687
+ c: d;
688
+ }
689
+
690
+ bar: baz;
691
+ }
692
+ SCSS
693
+ end
694
+
695
+ def test_directive_with_rule_children
696
+ assert_renders <<SASS, <<SCSS
697
+ foo
698
+ @foo #bar "baz"
699
+ #blat
700
+ a: b
701
+
702
+ .bang
703
+ c: d
704
+ e: f
705
+
706
+ bar: baz
707
+ SASS
708
+ foo {
709
+ @foo #bar "baz" {
710
+ #blat {
711
+ a: b;
712
+ }
713
+
714
+ .bang {
715
+ c: d;
716
+ e: f;
717
+ }
718
+ }
719
+
720
+ bar: baz;
721
+ }
722
+ SCSS
723
+ end
724
+
725
+ def test_directive_with_rule_and_prop_children
726
+ assert_renders <<SASS, <<SCSS
727
+ foo
728
+ @foo #bar "baz"
729
+ g: h
730
+
731
+ #blat
732
+ a: b
733
+
734
+ .bang
735
+ c: d
736
+ e: f
737
+
738
+ i: j
739
+
740
+ bar: baz
741
+ SASS
742
+ foo {
743
+ @foo #bar "baz" {
744
+ g: h;
745
+
746
+ #blat {
747
+ a: b;
748
+ }
749
+
750
+ .bang {
751
+ c: d;
752
+ e: f;
753
+ }
754
+
755
+ i: j;
756
+ }
757
+
758
+ bar: baz;
759
+ }
760
+ SCSS
761
+ end
762
+
763
+ def test_charset
764
+ assert_renders <<SASS, <<SCSS
765
+ @charset "utf-8"
766
+ SASS
767
+ @charset "utf-8";
768
+ SCSS
769
+ end
770
+
771
+ def test_for
772
+ assert_renders <<SASS, <<SCSS
773
+ foo
774
+ @for $a from $b to $c
775
+ a: b
776
+
777
+ @for $c from 1 to 16
778
+ d: e
779
+ f: g
780
+ SASS
781
+ foo {
782
+ @for $a from $b to $c {
783
+ a: b;
784
+ }
785
+
786
+ @for $c from 1 to 16 {
787
+ d: e;
788
+ f: g;
789
+ }
790
+ }
791
+ SCSS
792
+ end
793
+
794
+ def test_while
795
+ assert_renders <<SASS, <<SCSS
796
+ foo
797
+ @while flaz($a + $b)
798
+ a: b
799
+
800
+ @while 1
801
+ d: e
802
+ f: g
803
+ SASS
804
+ foo {
805
+ @while flaz($a + $b) {
806
+ a: b;
807
+ }
808
+
809
+ @while 1 {
810
+ d: e;
811
+ f: g;
812
+ }
813
+ }
814
+ SCSS
815
+ end
816
+
817
+ def test_if
818
+ assert_renders <<SASS, <<SCSS
819
+ foo
820
+ @if $foo or $bar
821
+ a: b
822
+
823
+ @if $baz
824
+ d: e
825
+ @else if $bang
826
+ f: g
827
+ @else
828
+ h: i
829
+ SASS
830
+ foo {
831
+ @if $foo or $bar {
832
+ a: b;
833
+ }
834
+
835
+ @if $baz {
836
+ d: e;
837
+ }
838
+ @else if $bang {
839
+ f: g;
840
+ }
841
+ @else {
842
+ h: i;
843
+ }
844
+ }
845
+ SCSS
846
+ end
847
+
848
+ def test_each
849
+ assert_renders <<SASS, <<SCSS
850
+ a
851
+ @each $number in 1px 2px 3px 4px
852
+ b: $number
853
+
854
+ c
855
+ @each $str in foo, bar, baz, bang
856
+ d: $str
857
+
858
+ c
859
+ @each $key, $value in (foo: 1, bar: 2, baz: 3)
860
+ \#{$key}: $value
861
+ SASS
862
+ a {
863
+ @each $number in 1px 2px 3px 4px {
864
+ b: $number;
865
+ }
866
+ }
867
+
868
+ c {
869
+ @each $str in foo, bar, baz, bang {
870
+ d: $str;
871
+ }
872
+ }
873
+
874
+ c {
875
+ @each $key, $value in (foo: 1, bar: 2, baz: 3) {
876
+ \#{$key}: $value;
877
+ }
878
+ }
879
+ SCSS
880
+ end
881
+
882
+ def test_import
883
+ assert_renders <<SASS, <<SCSS
884
+ @import foo
885
+
886
+ @import url(bar.css)
887
+
888
+ foo
889
+ bar: baz
890
+ SASS
891
+ @import "foo";
892
+
893
+ @import url(bar.css);
894
+
895
+ foo {
896
+ bar: baz;
897
+ }
898
+ SCSS
899
+
900
+ assert_renders <<SASS, <<SCSS
901
+ @import foo.css
902
+
903
+ @import url(bar.css)
904
+
905
+ foo
906
+ bar: baz
907
+ SASS
908
+ @import "foo.css";
909
+
910
+ @import url(bar.css);
911
+
912
+ foo {
913
+ bar: baz;
914
+ }
915
+ SCSS
916
+ end
917
+
918
+ def test_import_as_directive_in_sass
919
+ assert_equal "@import foo.css\n", to_sass('@import "foo.css"')
920
+ end
921
+
922
+ def test_import_as_directive_in_scss
923
+ assert_renders <<SASS, <<SCSS
924
+ @import "foo.css" print
925
+ SASS
926
+ @import "foo.css" print;
927
+ SCSS
928
+
929
+ assert_renders <<SASS, <<SCSS
930
+ @import url(foo.css) screen, print
931
+ SASS
932
+ @import url(foo.css) screen, print;
933
+ SCSS
934
+ end
935
+
936
+ def test_adjacent_imports
937
+ assert_renders <<SASS, <<SCSS
938
+ @import foo.sass
939
+ @import bar.scss
940
+ @import baz
941
+ SASS
942
+ @import "foo.sass";
943
+ @import "bar.scss";
944
+ @import "baz";
945
+ SCSS
946
+ end
947
+
948
+ def test_non_adjacent_imports
949
+ assert_renders <<SASS, <<SCSS
950
+ @import foo.sass
951
+
952
+ @import bar.scss
953
+
954
+ @import baz
955
+ SASS
956
+ @import "foo.sass";
957
+
958
+ @import "bar.scss";
959
+
960
+ @import "baz";
961
+ SCSS
962
+ end
963
+
964
+ def test_import_with_interpolation
965
+ assert_renders <<SASS, <<SCSS
966
+ $family: unquote("Droid+Sans")
967
+
968
+ @import url("http://fonts.googleapis.com/css?family=\#{$family}")
969
+ SASS
970
+ $family: unquote("Droid+Sans");
971
+
972
+ @import url("http://fonts.googleapis.com/css?family=\#{$family}");
973
+ SCSS
974
+ end
975
+
976
+ def test_extend
977
+ assert_renders <<SASS, <<SCSS
978
+ .foo
979
+ @extend .bar
980
+
981
+ @extend .baz:bang
982
+ SASS
983
+ .foo {
984
+ @extend .bar;
985
+
986
+ @extend .baz:bang;
987
+ }
988
+ SCSS
989
+ end
990
+
991
+ def test_comma_extendee
992
+ assert_renders <<SASS, <<SCSS
993
+ .baz
994
+ @extend .foo, .bar
995
+ SASS
996
+ .baz {
997
+ @extend .foo, .bar;
998
+ }
999
+ SCSS
1000
+ end
1001
+
1002
+ def test_argless_mixin_definition
1003
+ assert_renders <<SASS, <<SCSS
1004
+ =foo-bar
1005
+ baz
1006
+ a: b
1007
+ SASS
1008
+ @mixin foo-bar {
1009
+ baz {
1010
+ a: b;
1011
+ }
1012
+ }
1013
+ SCSS
1014
+
1015
+ assert_scss_to_sass <<SASS, <<SCSS
1016
+ =foo-bar
1017
+ baz
1018
+ a: b
1019
+ SASS
1020
+ @mixin foo-bar() {
1021
+ baz {
1022
+ a: b;
1023
+ }
1024
+ }
1025
+ SCSS
1026
+
1027
+ assert_sass_to_scss <<SCSS, <<SASS
1028
+ @mixin foo-bar {
1029
+ baz {
1030
+ a: b;
1031
+ }
1032
+ }
1033
+ SCSS
1034
+ =foo-bar()
1035
+ baz
1036
+ a: b
1037
+ SASS
1038
+ end
1039
+
1040
+ def test_mixin_definition_without_defaults
1041
+ assert_renders <<SASS, <<SCSS
1042
+ =foo-bar($baz, $bang)
1043
+ baz
1044
+ a: $baz $bang
1045
+ SASS
1046
+ @mixin foo-bar($baz, $bang) {
1047
+ baz {
1048
+ a: $baz $bang;
1049
+ }
1050
+ }
1051
+ SCSS
1052
+ end
1053
+
1054
+ def test_mixin_definition_with_defaults
1055
+ assert_renders <<SASS, <<SCSS
1056
+ =foo-bar($baz, $bang: 12px)
1057
+ baz
1058
+ a: $baz $bang
1059
+ SASS
1060
+ @mixin foo-bar($baz, $bang: 12px) {
1061
+ baz {
1062
+ a: $baz $bang;
1063
+ }
1064
+ }
1065
+ SCSS
1066
+
1067
+ assert_sass_to_scss <<SCSS, <<SASS
1068
+ @mixin foo-bar($baz, $bang: foo) {
1069
+ baz {
1070
+ a: $baz $bang;
1071
+ }
1072
+ }
1073
+ SCSS
1074
+ =foo-bar($baz, $bang: foo)
1075
+ baz
1076
+ a: $baz $bang
1077
+ SASS
1078
+ end
1079
+
1080
+ def test_argless_mixin_include
1081
+ assert_renders <<SASS, <<SCSS
1082
+ foo
1083
+ +foo-bar
1084
+
1085
+ a: blip
1086
+ SASS
1087
+ foo {
1088
+ @include foo-bar;
1089
+
1090
+ a: blip;
1091
+ }
1092
+ SCSS
1093
+ end
1094
+
1095
+ def test_mixin_include
1096
+ assert_renders <<SASS, <<SCSS
1097
+ foo
1098
+ +foo-bar(12px, "blaz")
1099
+
1100
+ a: blip
1101
+ SASS
1102
+ foo {
1103
+ @include foo-bar(12px, "blaz");
1104
+
1105
+ a: blip;
1106
+ }
1107
+ SCSS
1108
+ end
1109
+
1110
+ def test_mixin_include_with_keyword_args
1111
+ assert_renders <<SASS, <<SCSS
1112
+ foo
1113
+ +foo-bar(12px, "blaz", $blip: blap, $bloop: blop)
1114
+
1115
+ +foo-bar($blip: blap, $bloop: blop)
1116
+
1117
+ a: blip
1118
+ SASS
1119
+ foo {
1120
+ @include foo-bar(12px, "blaz", $blip: blap, $bloop: blop);
1121
+
1122
+ @include foo-bar($blip: blap, $bloop: blop);
1123
+
1124
+ a: blip;
1125
+ }
1126
+ SCSS
1127
+ end
1128
+
1129
+ def test_mixin_include_with_hyphen_conversion_keyword_arg
1130
+ assert_renders <<SASS, <<SCSS
1131
+ foo
1132
+ +foo-bar($a-b_c: val)
1133
+
1134
+ a: blip
1135
+ SASS
1136
+ foo {
1137
+ @include foo-bar($a-b_c: val);
1138
+
1139
+ a: blip;
1140
+ }
1141
+ SCSS
1142
+ end
1143
+
1144
+ def test_argless_function_definition
1145
+ assert_renders <<SASS, <<SCSS
1146
+ @function foo()
1147
+ $var: 1 + 1
1148
+
1149
+ @return $var
1150
+ SASS
1151
+ @function foo() {
1152
+ $var: 1 + 1;
1153
+
1154
+ @return $var;
1155
+ }
1156
+ SCSS
1157
+ end
1158
+
1159
+ def test_function_definition_without_defaults
1160
+ assert_renders <<SASS, <<SCSS
1161
+ @function foo($var1, $var2)
1162
+ @if $var1
1163
+ @return $var1 + $var2
1164
+ SASS
1165
+ @function foo($var1, $var2) {
1166
+ @if $var1 {
1167
+ @return $var1 + $var2;
1168
+ }
1169
+ }
1170
+ SCSS
1171
+ end
1172
+
1173
+ def test_function_definition_with_defaults
1174
+ assert_renders <<SASS, <<SCSS
1175
+ @function foo($var1, $var2: foo)
1176
+ @if $var1
1177
+ @return $var1 + $var2
1178
+ SASS
1179
+ @function foo($var1, $var2: foo) {
1180
+ @if $var1 {
1181
+ @return $var1 + $var2;
1182
+ }
1183
+ }
1184
+ SCSS
1185
+ end
1186
+
1187
+ def test_variable_definition
1188
+ assert_renders <<SASS, <<SCSS
1189
+ $var1: 12px + 15px
1190
+
1191
+ foo
1192
+ $var2: flaz(#abcdef)
1193
+
1194
+ val: $var1 $var2
1195
+ SASS
1196
+ $var1: 12px + 15px;
1197
+
1198
+ foo {
1199
+ $var2: flaz(#abcdef);
1200
+
1201
+ val: $var1 $var2;
1202
+ }
1203
+ SCSS
1204
+ end
1205
+
1206
+ def test_guarded_variable_definition
1207
+ assert_renders <<SASS, <<SCSS
1208
+ $var1: 12px + 15px !default
1209
+
1210
+ foo
1211
+ $var2: flaz(#abcdef) !default
1212
+
1213
+ val: $var1 $var2
1214
+ SASS
1215
+ $var1: 12px + 15px !default;
1216
+
1217
+ foo {
1218
+ $var2: flaz(#abcdef) !default;
1219
+
1220
+ val: $var1 $var2;
1221
+ }
1222
+ SCSS
1223
+ end
1224
+
1225
+ def test_multiple_variable_definitions
1226
+ assert_renders <<SASS, <<SCSS
1227
+ $var1: foo
1228
+ $var2: bar
1229
+ $var3: baz
1230
+
1231
+ $var4: bip
1232
+ $var5: bap
1233
+ SASS
1234
+ $var1: foo;
1235
+ $var2: bar;
1236
+ $var3: baz;
1237
+
1238
+ $var4: bip;
1239
+ $var5: bap;
1240
+ SCSS
1241
+ end
1242
+
1243
+ def test_division_asserted_with_parens
1244
+ assert_renders <<SASS, <<SCSS
1245
+ foo
1246
+ a: (1px / 2px)
1247
+ SASS
1248
+ foo {
1249
+ a: (1px / 2px);
1250
+ }
1251
+ SCSS
1252
+ end
1253
+
1254
+ def test_division_not_asserted_when_unnecessary
1255
+ assert_renders <<SASS, <<SCSS
1256
+ $var: 1px / 2px
1257
+
1258
+ foo
1259
+ a: $var
1260
+ SASS
1261
+ $var: 1px / 2px;
1262
+
1263
+ foo {
1264
+ a: $var;
1265
+ }
1266
+ SCSS
1267
+
1268
+ assert_renders <<SASS, <<SCSS
1269
+ $var: 1px
1270
+
1271
+ foo
1272
+ a: $var / 2px
1273
+ SASS
1274
+ $var: 1px;
1275
+
1276
+ foo {
1277
+ a: $var / 2px;
1278
+ }
1279
+ SCSS
1280
+
1281
+ assert_renders <<SASS, <<SCSS
1282
+ foo
1283
+ a: 1 + 1px / 2px
1284
+ SASS
1285
+ foo {
1286
+ a: 1 + 1px / 2px;
1287
+ }
1288
+ SCSS
1289
+ end
1290
+
1291
+ def test_literal_slash
1292
+ assert_renders <<SASS, <<SCSS
1293
+ foo
1294
+ a: 1px / 2px
1295
+ SASS
1296
+ foo {
1297
+ a: 1px / 2px;
1298
+ }
1299
+ SCSS
1300
+
1301
+ # Regression test for issue 1787
1302
+ assert_renders <<SASS, <<SCSS
1303
+ foo
1304
+ a: 1px / 2px 3px
1305
+ SASS
1306
+ foo {
1307
+ a: 1px / 2px 3px;
1308
+ }
1309
+ SCSS
1310
+ end
1311
+
1312
+ def test_directive_with_interpolation
1313
+ assert_renders <<SASS, <<SCSS
1314
+ $baz: 12
1315
+
1316
+ @foo bar\#{$baz} qux
1317
+ a: b
1318
+ SASS
1319
+ $baz: 12;
1320
+
1321
+ @foo bar\#{$baz} qux {
1322
+ a: b;
1323
+ }
1324
+ SCSS
1325
+ end
1326
+
1327
+ def test_media_with_interpolation
1328
+ assert_renders <<SASS, <<SCSS
1329
+ $baz: 12
1330
+
1331
+ @media bar\#{$baz}
1332
+ a: b
1333
+ SASS
1334
+ $baz: 12;
1335
+
1336
+ @media bar\#{$baz} {
1337
+ a: b;
1338
+ }
1339
+ SCSS
1340
+ end
1341
+
1342
+ def test_media_with_expressions
1343
+ assert_renders <<SASS, <<SCSS
1344
+ $media1: screen
1345
+ $media2: print
1346
+ $var: -webkit-min-device-pixel-ratio
1347
+ $val: 20
1348
+
1349
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
1350
+ a: b
1351
+ SASS
1352
+ $media1: screen;
1353
+ $media2: print;
1354
+ $var: -webkit-min-device-pixel-ratio;
1355
+ $val: 20;
1356
+
1357
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2} {
1358
+ a: b;
1359
+ }
1360
+ SCSS
1361
+ end
1362
+
1363
+ def test_media_with_feature
1364
+ assert_renders <<SASS, <<SCSS
1365
+ @media screen and (-webkit-transform-3d)
1366
+ a: b
1367
+ SASS
1368
+ @media screen and (-webkit-transform-3d) {
1369
+ a: b;
1370
+ }
1371
+ SCSS
1372
+ end
1373
+
1374
+ def test_supports_with_expressions
1375
+ assert_renders <<SASS, <<SCSS
1376
+ $query: "(feature1: val)"
1377
+ $feature: feature2
1378
+ $val: val
1379
+
1380
+ @supports (\#{$query} and ($feature: $val)) or (not ($feature + 3: $val + 4))
1381
+ foo
1382
+ a: b
1383
+ SASS
1384
+ $query: "(feature1: val)";
1385
+ $feature: feature2;
1386
+ $val: val;
1387
+
1388
+ @supports (\#{$query} and ($feature: $val)) or (not ($feature + 3: $val + 4)) {
1389
+ foo {
1390
+ a: b;
1391
+ }
1392
+ }
1393
+ SCSS
1394
+ end
1395
+
1396
+ # Hacks
1397
+
1398
+ def test_declaration_hacks
1399
+ assert_renders <<SASS, <<SCSS
1400
+ foo
1401
+ _name: val
1402
+ *name: val
1403
+ #name: val
1404
+ .name: val
1405
+ name/**/: val
1406
+ name/*\\**/: val
1407
+ name: val
1408
+ SASS
1409
+ foo {
1410
+ _name: val;
1411
+ *name: val;
1412
+ #name: val;
1413
+ .name: val;
1414
+ name/**/: val;
1415
+ name/*\\**/: val;
1416
+ name: val;
1417
+ }
1418
+ SCSS
1419
+ end
1420
+
1421
+ def test_old_declaration_hacks
1422
+ assert_renders <<SASS, <<SCSS, :old => true
1423
+ foo
1424
+ :_name val
1425
+ :*name val
1426
+ :#name val
1427
+ :.name val
1428
+ :name val
1429
+ SASS
1430
+ foo {
1431
+ _name: val;
1432
+ *name: val;
1433
+ #name: val;
1434
+ .name: val;
1435
+ name: val;
1436
+ }
1437
+ SCSS
1438
+ end
1439
+
1440
+ def test_selector_hacks
1441
+ assert_selector_renders = lambda do |s|
1442
+ assert_renders <<SASS, <<SCSS
1443
+ #{s}
1444
+ a: b
1445
+ SASS
1446
+ #{s} {
1447
+ a: b;
1448
+ }
1449
+ SCSS
1450
+ end
1451
+
1452
+ assert_selector_renders['> E']
1453
+ assert_selector_renders['+ E']
1454
+ assert_selector_renders['~ E']
1455
+ assert_selector_renders['> > E']
1456
+
1457
+ assert_selector_renders['E*']
1458
+ assert_selector_renders['E*.foo']
1459
+ assert_selector_renders['E*:hover']
1460
+ end
1461
+
1462
+ def test_disallowed_colon_hack
1463
+ assert_raise_message(Sass::SyntaxError, 'The ":name: val" hack is not allowed in the Sass indented syntax') do
1464
+ to_sass("foo {:name: val;}", :syntax => :scss)
1465
+ end
1466
+ end
1467
+
1468
+ def test_nested_properties
1469
+ assert_renders <<SASS, <<SCSS
1470
+ div
1471
+ before: before
1472
+ background:
1473
+ color: blue
1474
+ repeat: no-repeat
1475
+ after: after
1476
+ SASS
1477
+ div {
1478
+ before: before;
1479
+ background: {
1480
+ color: blue;
1481
+ repeat: no-repeat;
1482
+ };
1483
+ after: after;
1484
+ }
1485
+
1486
+ SCSS
1487
+ end
1488
+
1489
+ def test_dasherize
1490
+ assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
1491
+ @mixin under-scored-mixin($under-scored-arg: $under-scored-default) {
1492
+ bar: $under-scored-arg;
1493
+ }
1494
+
1495
+ div {
1496
+ foo: under-scored-fn($under-scored-var + "before\#{$another-under-scored-var}after");
1497
+
1498
+ @include under-scored-mixin($passed-arg);
1499
+
1500
+ selector-\#{$under-scored-interp}: bold;
1501
+ }
1502
+
1503
+ @if $under-scored {
1504
+ @for $for-var from $from-var to $to-var {
1505
+ @while $while-var == true {
1506
+ $while-var: false;
1507
+ }
1508
+ }
1509
+ }
1510
+ SCSS
1511
+ =under_scored_mixin($under_scored_arg: $under_scored_default)
1512
+ bar: $under_scored_arg
1513
+ div
1514
+ foo: under_scored_fn($under_scored_var + "before\#{$another_under_scored_var}after")
1515
+ +under_scored_mixin($passed_arg)
1516
+ selector-\#{$under_scored_interp}: bold
1517
+ @if $under_scored
1518
+ @for $for_var from $from_var to $to_var
1519
+ @while $while_var == true
1520
+ $while_var : false
1521
+ SASS
1522
+ end
1523
+
1524
+ def test_loud_comment_conversion
1525
+ assert_renders(<<SASS, <<SCSS)
1526
+ /*! \#{"interpolated"}
1527
+ SASS
1528
+ /*! \#{"interpolated"} */
1529
+ SCSS
1530
+ end
1531
+
1532
+ def test_content_conversion
1533
+ assert_renders(<<SASS, <<SCSS)
1534
+ $color: blue
1535
+
1536
+ =context($class, $color: red)
1537
+ .\#{$class}
1538
+ background-color: $color
1539
+
1540
+ @content
1541
+
1542
+ border-color: $color
1543
+
1544
+ +context(parent)
1545
+ +context(child, $color: yellow)
1546
+ color: $color
1547
+ SASS
1548
+ $color: blue;
1549
+
1550
+ @mixin context($class, $color: red) {
1551
+ .\#{$class} {
1552
+ background-color: $color;
1553
+
1554
+ @content;
1555
+
1556
+ border-color: $color;
1557
+ }
1558
+ }
1559
+
1560
+ @include context(parent) {
1561
+ @include context(child, $color: yellow) {
1562
+ color: $color;
1563
+ }
1564
+ }
1565
+ SCSS
1566
+
1567
+ end
1568
+
1569
+ def test_empty_content
1570
+ assert_scss_to_scss(<<SCSS)
1571
+ @mixin foo {
1572
+ @content;
1573
+ }
1574
+
1575
+ @include foo {}
1576
+ SCSS
1577
+ end
1578
+
1579
+ def test_placeholder_conversion
1580
+ assert_renders(<<SASS, <<SCSS)
1581
+ #content a%foo.bar
1582
+ color: blue
1583
+ SASS
1584
+ #content a%foo.bar {
1585
+ color: blue;
1586
+ }
1587
+ SCSS
1588
+ end
1589
+
1590
+ def test_reference_selector
1591
+ assert_renders(<<SASS, <<SCSS)
1592
+ foo /bar|baz/ bang
1593
+ a: b
1594
+ SASS
1595
+ foo /bar|baz/ bang {
1596
+ a: b;
1597
+ }
1598
+ SCSS
1599
+ end
1600
+
1601
+ def test_subject
1602
+ assert_renders(<<SASS, <<SCSS)
1603
+ foo bar! baz
1604
+ a: b
1605
+ SASS
1606
+ foo bar! baz {
1607
+ a: b;
1608
+ }
1609
+ SCSS
1610
+ end
1611
+
1612
+ def test_placeholder_interoplation_conversion
1613
+ assert_renders(<<SASS, <<SCSS)
1614
+ $foo: foo
1615
+
1616
+ %\#{$foo}
1617
+ color: blue
1618
+
1619
+ .bar
1620
+ @extend %foo
1621
+ SASS
1622
+ $foo: foo;
1623
+
1624
+ %\#{$foo} {
1625
+ color: blue;
1626
+ }
1627
+
1628
+ .bar {
1629
+ @extend %foo;
1630
+ }
1631
+ SCSS
1632
+ end
1633
+
1634
+ def test_indent
1635
+ assert_renders <<SASS, <<SCSS, :indent => " "
1636
+ foo bar
1637
+ baz bang
1638
+ baz: bang
1639
+ bip: bop
1640
+
1641
+ blat: boo
1642
+ SASS
1643
+ foo bar {
1644
+ baz bang {
1645
+ baz: bang;
1646
+ bip: bop;
1647
+ }
1648
+
1649
+ blat: boo;
1650
+ }
1651
+ SCSS
1652
+
1653
+ assert_renders <<SASS, <<SCSS, :indent => "\t"
1654
+ foo bar
1655
+ baz bang
1656
+ baz: bang
1657
+ bip: bop
1658
+
1659
+ blat: boo
1660
+ SASS
1661
+ foo bar {
1662
+ baz bang {
1663
+ baz: bang;
1664
+ bip: bop;
1665
+ }
1666
+
1667
+ blat: boo;
1668
+ }
1669
+ SCSS
1670
+
1671
+ assert_sass_to_scss <<SCSS, <<SASS, :indent => " "
1672
+ foo bar {
1673
+ baz bang {
1674
+ baz: bang;
1675
+ bip: bop;
1676
+ }
1677
+
1678
+ blat: boo;
1679
+ }
1680
+ SCSS
1681
+ foo bar
1682
+ baz bang
1683
+ baz: bang
1684
+ bip: bop
1685
+
1686
+ blat: boo
1687
+ SASS
1688
+
1689
+ assert_sass_to_scss <<SCSS, <<SASS, :indent => "\t"
1690
+ foo bar {
1691
+ baz bang {
1692
+ baz: bang;
1693
+ bip: bop;
1694
+ }
1695
+
1696
+ blat: boo;
1697
+ }
1698
+ SCSS
1699
+ foo bar
1700
+ baz bang
1701
+ baz: bang
1702
+ bip: bop
1703
+
1704
+ blat: boo
1705
+ SASS
1706
+
1707
+ assert_scss_to_sass <<SASS, <<SCSS, :indent => " "
1708
+ foo bar
1709
+ baz bang
1710
+ baz: bang
1711
+ bip: bop
1712
+
1713
+ blat: boo
1714
+ SASS
1715
+ foo bar {
1716
+ baz bang {
1717
+ baz: bang;
1718
+ bip: bop;
1719
+ }
1720
+
1721
+ blat: boo;
1722
+ }
1723
+ SCSS
1724
+
1725
+ assert_scss_to_sass <<SASS, <<SCSS, :indent => "\t"
1726
+ foo bar
1727
+ baz bang
1728
+ baz: bang
1729
+ bip: bop
1730
+
1731
+ blat: boo
1732
+ SASS
1733
+ foo bar {
1734
+ baz bang {
1735
+ baz: bang;
1736
+ bip: bop;
1737
+ }
1738
+
1739
+ blat: boo;
1740
+ }
1741
+ SCSS
1742
+ end
1743
+
1744
+ def test_extend_with_optional
1745
+ assert_renders <<SASS, <<SCSS
1746
+ foo
1747
+ @extend .bar !optional
1748
+ SASS
1749
+ foo {
1750
+ @extend .bar !optional;
1751
+ }
1752
+ SCSS
1753
+ end
1754
+
1755
+ def test_mixin_var_args
1756
+ assert_renders <<SASS, <<SCSS
1757
+ =foo($args...)
1758
+ a: b
1759
+
1760
+ =bar($a, $args...)
1761
+ a: b
1762
+
1763
+ .foo
1764
+ +foo($list...)
1765
+
1766
+ +bar(1, $list...)
1767
+ SASS
1768
+ @mixin foo($args...) {
1769
+ a: b;
1770
+ }
1771
+
1772
+ @mixin bar($a, $args...) {
1773
+ a: b;
1774
+ }
1775
+
1776
+ .foo {
1777
+ @include foo($list...);
1778
+
1779
+ @include bar(1, $list...);
1780
+ }
1781
+ SCSS
1782
+ end
1783
+
1784
+ def test_mixin_var_kwargs
1785
+ assert_renders <<SASS, <<SCSS
1786
+ =foo($a: b, $c: d)
1787
+ a: $a
1788
+ c: $c
1789
+
1790
+ .foo
1791
+ +foo($list..., $map...)
1792
+
1793
+ +foo(pos, $list..., $kwd: val, $map...)
1794
+ SASS
1795
+ @mixin foo($a: b, $c: d) {
1796
+ a: $a;
1797
+ c: $c;
1798
+ }
1799
+
1800
+ .foo {
1801
+ @include foo($list..., $map...);
1802
+
1803
+ @include foo(pos, $list..., $kwd: val, $map...);
1804
+ }
1805
+ SCSS
1806
+ end
1807
+
1808
+ def test_function_var_args
1809
+ assert_renders <<SASS, <<SCSS
1810
+ @function foo($args...)
1811
+ @return foo
1812
+
1813
+ @function bar($a, $args...)
1814
+ @return bar
1815
+
1816
+ .foo
1817
+ a: foo($list...)
1818
+ b: bar(1, $list...)
1819
+ SASS
1820
+ @function foo($args...) {
1821
+ @return foo;
1822
+ }
1823
+
1824
+ @function bar($a, $args...) {
1825
+ @return bar;
1826
+ }
1827
+
1828
+ .foo {
1829
+ a: foo($list...);
1830
+ b: bar(1, $list...);
1831
+ }
1832
+ SCSS
1833
+ end
1834
+
1835
+ def test_function_var_kwargs
1836
+ assert_renders <<SASS, <<SCSS
1837
+ @function foo($a: b, $c: d)
1838
+ @return foo
1839
+
1840
+ .foo
1841
+ a: foo($list..., $map...)
1842
+ b: foo(pos, $list..., $kwd: val, $map...)
1843
+ SASS
1844
+ @function foo($a: b, $c: d) {
1845
+ @return foo;
1846
+ }
1847
+
1848
+ .foo {
1849
+ a: foo($list..., $map...);
1850
+ b: foo(pos, $list..., $kwd: val, $map...);
1851
+ }
1852
+ SCSS
1853
+ end
1854
+
1855
+ def test_at_root
1856
+ assert_renders <<SASS, <<SCSS
1857
+ .foo
1858
+ @at-root
1859
+ .bar
1860
+ a: b
1861
+
1862
+ .baz
1863
+ c: d
1864
+ SASS
1865
+ .foo {
1866
+ @at-root {
1867
+ .bar {
1868
+ a: b;
1869
+ }
1870
+
1871
+ .baz {
1872
+ c: d;
1873
+ }
1874
+ }
1875
+ }
1876
+ SCSS
1877
+ end
1878
+
1879
+ def test_at_root_with_selector
1880
+ assert_renders <<SASS, <<SCSS
1881
+ .foo
1882
+ @at-root .bar
1883
+ a: b
1884
+ SASS
1885
+ .foo {
1886
+ @at-root .bar {
1887
+ a: b;
1888
+ }
1889
+ }
1890
+ SCSS
1891
+ end
1892
+
1893
+ def test_at_root_without
1894
+ assert_renders <<SASS, <<SCSS
1895
+ .foo
1896
+ @at-root (without: media rule)
1897
+ a: b
1898
+ SASS
1899
+ .foo {
1900
+ @at-root (without: media rule) {
1901
+ a: b;
1902
+ }
1903
+ }
1904
+ SCSS
1905
+ end
1906
+
1907
+ def test_at_root_with
1908
+ assert_renders <<SASS, <<SCSS
1909
+ .foo
1910
+ @at-root (with: media rule)
1911
+ a: b
1912
+ SASS
1913
+ .foo {
1914
+ @at-root (with: media rule) {
1915
+ a: b;
1916
+ }
1917
+ }
1918
+ SCSS
1919
+ end
1920
+
1921
+ def test_function_var_kwargs_with_list
1922
+ assert_renders <<SASS, <<SCSS
1923
+ @function foo($a: b, $c: d)
1924
+ @return $a, $c
1925
+
1926
+ .foo
1927
+ a: foo($list..., $map...)
1928
+ SASS
1929
+ @function foo($a: b, $c: d) {
1930
+ @return $a, $c;
1931
+ }
1932
+
1933
+ .foo {
1934
+ a: foo($list..., $map...);
1935
+ }
1936
+ SCSS
1937
+ end
1938
+
1939
+ def test_keyframes
1940
+ assert_renders(<<SASS, <<SCSS)
1941
+ @keyframes identifier
1942
+ 0%
1943
+ top: 0
1944
+ left: 0
1945
+
1946
+ 30%
1947
+ top: 50px
1948
+
1949
+ 68%, 72%
1950
+ left: 50px
1951
+
1952
+ 100%
1953
+ top: 100px
1954
+ left: 100%
1955
+ SASS
1956
+ @keyframes identifier {
1957
+ 0% {
1958
+ top: 0;
1959
+ left: 0;
1960
+ }
1961
+
1962
+ 30% {
1963
+ top: 50px;
1964
+ }
1965
+
1966
+ 68%, 72% {
1967
+ left: 50px;
1968
+ }
1969
+
1970
+ 100% {
1971
+ top: 100px;
1972
+ left: 100%;
1973
+ }
1974
+ }
1975
+ SCSS
1976
+ end
1977
+
1978
+ ## Regression Tests
1979
+
1980
+ def test_list_in_args
1981
+ assert_renders(<<SASS, <<SCSS)
1982
+ +mixin((a, b, c))
1983
+
1984
+ +mixin($arg: (a, b, c))
1985
+
1986
+ +mixin(a, b, (c, d, e)...)
1987
+ SASS
1988
+ @include mixin((a, b, c));
1989
+
1990
+ @include mixin($arg: (a, b, c));
1991
+
1992
+ @include mixin(a, b, (c, d, e)...);
1993
+ SCSS
1994
+ end
1995
+
1996
+ def test_media_query_with_expr
1997
+ assert_renders <<SASS, <<SCSS
1998
+ @media foo and (bar: baz)
1999
+ a: b
2000
+ SASS
2001
+ @media foo and (bar: baz) {
2002
+ a: b;
2003
+ }
2004
+ SCSS
2005
+ end
2006
+
2007
+ def test_nested_if_statements
2008
+ assert_renders(<<SASS, <<SCSS)
2009
+ @if $foo
2010
+ one
2011
+ a: b
2012
+ @else
2013
+ @if $bar
2014
+ two
2015
+ a: b
2016
+ @else
2017
+ three
2018
+ a: b
2019
+ SASS
2020
+ @if $foo {
2021
+ one {
2022
+ a: b;
2023
+ }
2024
+ }
2025
+ @else {
2026
+ @if $bar {
2027
+ two {
2028
+ a: b;
2029
+ }
2030
+ }
2031
+ @else {
2032
+ three {
2033
+ a: b;
2034
+ }
2035
+ }
2036
+ }
2037
+ SCSS
2038
+ end
2039
+
2040
+ def test_comment_indentation
2041
+ assert_renders(<<SASS, <<SCSS, :indent => ' ')
2042
+ foo
2043
+ // bar
2044
+ /* baz
2045
+ a: b
2046
+ SASS
2047
+ foo {
2048
+ // bar
2049
+ /* baz */
2050
+ a: b;
2051
+ }
2052
+ SCSS
2053
+ end
2054
+
2055
+ def test_keyword_arguments
2056
+ assert_renders(<<SASS, <<SCSS, :dasherize => true)
2057
+ $foo: foo($dash-ed: 2px)
2058
+ SASS
2059
+ $foo: foo($dash-ed: 2px);
2060
+ SCSS
2061
+ assert_scss_to_sass(<<SASS, <<SCSS, :dasherize => true)
2062
+ $foo: foo($dash-ed: 2px)
2063
+ SASS
2064
+ $foo: foo($dash_ed: 2px);
2065
+ SCSS
2066
+ assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
2067
+ $foo: foo($dash-ed: 2px);
2068
+ SCSS
2069
+ $foo: foo($dash_ed: 2px)
2070
+ SASS
2071
+ assert_renders(<<SASS, <<SCSS)
2072
+ $foo: foo($under_scored: 1px)
2073
+ SASS
2074
+ $foo: foo($under_scored: 1px);
2075
+ SCSS
2076
+ assert_renders(<<SASS, <<SCSS)
2077
+ $foo: foo($dash-ed: 2px, $under_scored: 1px)
2078
+ SASS
2079
+ $foo: foo($dash-ed: 2px, $under_scored: 1px);
2080
+ SCSS
2081
+ end
2082
+
2083
+ def test_ambiguous_negation
2084
+ assert_renders(<<SASS, <<SCSS, :indent => ' ')
2085
+ foo
2086
+ ok: -$foo
2087
+ comma: 10px, -$foo
2088
+ needs-parens: 10px (-$foo)
2089
+ SASS
2090
+ foo {
2091
+ ok: -$foo;
2092
+ comma: 10px, -$foo;
2093
+ needs-parens: 10px (-$foo);
2094
+ }
2095
+ SCSS
2096
+ end
2097
+
2098
+ def test_variable_with_global
2099
+ assert_renders(<<SASS, <<SCSS)
2100
+ $var: 1
2101
+
2102
+ foo
2103
+ $var: 2 !global
2104
+ $var: 3 !global !default
2105
+ SASS
2106
+ $var: 1;
2107
+
2108
+ foo {
2109
+ $var: 2 !global;
2110
+ $var: 3 !global !default;
2111
+ }
2112
+ SCSS
2113
+ end
2114
+
2115
+ def test_import_with_supports_clause
2116
+ assert_renders(<<'SASS', <<'SCSS')
2117
+ @import url("fallback-layout.css") supports(not (display: #{$display-type}))
2118
+ SASS
2119
+ @import url("fallback-layout.css") supports(not (display: #{$display-type}));
2120
+ SCSS
2121
+ end
2122
+
2123
+ private
2124
+
2125
+ def assert_sass_to_sass(sass, options = {})
2126
+ assert_equal(sass.rstrip, to_sass(sass, options).rstrip,
2127
+ "Expected Sass to transform to itself")
2128
+ end
2129
+
2130
+ def assert_scss_to_sass(sass, scss, options = {})
2131
+ assert_equal(sass.rstrip, to_sass(scss, options.merge(:syntax => :scss)).rstrip,
2132
+ "Expected SCSS to transform to Sass")
2133
+ end
2134
+
2135
+ def assert_scss_to_scss(scss, in_scss = nil, options = nil)
2136
+ if in_scss.is_a?(Hash)
2137
+ options = in_scss
2138
+ in_scss = nil
2139
+ end
2140
+
2141
+ in_scss ||= scss
2142
+ options ||= {}
2143
+
2144
+ assert_equal(scss.rstrip, to_scss(in_scss, options.merge(:syntax => :scss)).rstrip,
2145
+ "Expected SCSS to transform to #{scss == in_scss ? 'itself' : 'SCSS'}")
2146
+ end
2147
+
2148
+ def assert_sass_to_scss(scss, sass, options = {})
2149
+ assert_equal(scss.rstrip, to_scss(sass, options).rstrip,
2150
+ "Expected Sass to transform to SCSS")
2151
+ end
2152
+
2153
+ def assert_renders(sass, scss, options = {})
2154
+ assert_sass_to_sass(sass, options)
2155
+ assert_scss_to_sass(sass, scss, options)
2156
+ assert_scss_to_scss(scss, options)
2157
+ assert_sass_to_scss(scss, sass, options)
2158
+ end
2159
+
2160
+ def to_sass(scss, options = {})
2161
+ Sass::Util.silence_sass_warnings do
2162
+ Sass::Engine.new(scss, options).to_tree.to_sass(options)
2163
+ end
2164
+ end
2165
+
2166
+ def to_scss(sass, options = {})
2167
+ Sass::Util.silence_sass_warnings do
2168
+ Sass::Engine.new(sass, options).to_tree.to_scss(options)
2169
+ end
2170
+ end
2171
+ end