sass 3.4.25 → 3.5.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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -117
  4. data/VERSION +1 -1
  5. data/VERSION_DATE +1 -1
  6. data/VERSION_NAME +1 -1
  7. data/lib/sass/cache_stores/filesystem.rb +1 -1
  8. data/lib/sass/css.rb +1 -2
  9. data/lib/sass/engine.rb +38 -20
  10. data/lib/sass/environment.rb +26 -5
  11. data/lib/sass/error.rb +2 -2
  12. data/lib/sass/exec/base.rb +2 -11
  13. data/lib/sass/features.rb +1 -0
  14. data/lib/sass/importers/filesystem.rb +2 -2
  15. data/lib/sass/plugin/compiler.rb +20 -50
  16. data/lib/sass/plugin/configuration.rb +2 -2
  17. data/lib/sass/railtie.rb +1 -1
  18. data/lib/sass/script/functions.rb +235 -43
  19. data/lib/sass/script/lexer.rb +13 -2
  20. data/lib/sass/script/parser.rb +69 -67
  21. data/lib/sass/script/tree/funcall.rb +35 -30
  22. data/lib/sass/script/tree/list_literal.rb +23 -8
  23. data/lib/sass/script/tree/map_literal.rb +2 -2
  24. data/lib/sass/script/tree/node.rb +0 -8
  25. data/lib/sass/script/tree/operation.rb +0 -7
  26. data/lib/sass/script/value/arg_list.rb +1 -1
  27. data/lib/sass/script/value/base.rb +17 -0
  28. data/lib/sass/script/value/callable.rb +25 -0
  29. data/lib/sass/script/value/color.rb +5 -0
  30. data/lib/sass/script/value/function.rb +19 -0
  31. data/lib/sass/script/value/helpers.rb +29 -9
  32. data/lib/sass/script/value/list.rb +35 -14
  33. data/lib/sass/script/value/map.rb +2 -2
  34. data/lib/sass/script/value/number.rb +1 -1
  35. data/lib/sass/script/value.rb +2 -0
  36. data/lib/sass/scss/parser.rb +99 -40
  37. data/lib/sass/scss/rx.rb +4 -10
  38. data/lib/sass/scss/static_parser.rb +5 -24
  39. data/lib/sass/selector/abstract_sequence.rb +7 -6
  40. data/lib/sass/selector/comma_sequence.rb +7 -4
  41. data/lib/sass/selector/pseudo.rb +19 -2
  42. data/lib/sass/selector/sequence.rb +35 -6
  43. data/lib/sass/selector/simple.rb +9 -2
  44. data/lib/sass/selector/simple_sequence.rb +8 -4
  45. data/lib/sass/selector.rb +4 -0
  46. data/lib/sass/source/map.rb +2 -2
  47. data/lib/sass/stack.rb +21 -1
  48. data/lib/sass/tree/charset_node.rb +1 -1
  49. data/lib/sass/tree/prop_node.rb +45 -53
  50. data/lib/sass/tree/rule_node.rb +3 -2
  51. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  52. data/lib/sass/tree/visitors/convert.rb +2 -3
  53. data/lib/sass/tree/visitors/cssize.rb +4 -15
  54. data/lib/sass/tree/visitors/deep_copy.rb +1 -1
  55. data/lib/sass/tree/visitors/extend.rb +2 -8
  56. data/lib/sass/tree/visitors/perform.rb +21 -9
  57. data/lib/sass/tree/visitors/set_options.rb +1 -1
  58. data/lib/sass/tree/visitors/to_css.rb +47 -13
  59. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  60. data/lib/sass/util/normalized_map.rb +1 -8
  61. data/lib/sass/util.rb +12 -290
  62. data/lib/sass/version.rb +0 -2
  63. data/lib/sass.rb +0 -7
  64. data/test/sass/cache_test.rb +0 -1
  65. data/test/sass/callbacks_test.rb +0 -1
  66. data/test/sass/compiler_test.rb +4 -15
  67. data/test/sass/conversion_test.rb +113 -163
  68. data/test/sass/css2sass_test.rb +16 -19
  69. data/test/sass/css_variable_test.rb +176 -71
  70. data/test/sass/encoding_test.rb +2 -33
  71. data/test/sass/engine_test.rb +71 -19
  72. data/test/sass/exec_test.rb +0 -1
  73. data/test/sass/extend_test.rb +37 -92
  74. data/test/sass/functions_test.rb +58 -14
  75. data/test/sass/importer_test.rb +2 -3
  76. data/test/sass/logger_test.rb +0 -1
  77. data/test/sass/plugin_test.rb +6 -10
  78. data/test/sass/results/script.css +1 -1
  79. data/test/sass/results/units.css +2 -2
  80. data/test/sass/script_conversion_test.rb +10 -2
  81. data/test/sass/script_test.rb +22 -24
  82. data/test/sass/scss/css_test.rb +3 -18
  83. data/test/sass/scss/rx_test.rb +0 -1
  84. data/test/sass/scss/scss_test.rb +49 -16
  85. data/test/sass/source_map_test.rb +13 -16
  86. data/test/sass/superselector_test.rb +0 -1
  87. data/test/sass/util/multibyte_string_scanner_test.rb +121 -124
  88. data/test/sass/util/normalized_map_test.rb +0 -1
  89. data/test/sass/util/subset_map_test.rb +0 -1
  90. data/test/sass/util_test.rb +4 -39
  91. data/test/sass/value_helpers_test.rb +0 -1
  92. data/test/sass-spec.yml +1 -1
  93. data/test/test_helper.rb +39 -0
  94. metadata +19 -44
  95. data/lib/sass/script/css_variable_warning.rb +0 -52
  96. data/lib/sass/util/cross_platform_random.rb +0 -19
  97. data/lib/sass/util/ordered_hash.rb +0 -192
  98. data/test/sass/results/import_charset_1_8.css +0 -5
  99. data/test/sass/templates/import_charset_1_8.sass +0 -6
  100. data/vendor/listen/CHANGELOG.md +0 -1
  101. data/vendor/listen/CONTRIBUTING.md +0 -38
  102. data/vendor/listen/Gemfile +0 -20
  103. data/vendor/listen/Guardfile +0 -8
  104. data/vendor/listen/LICENSE +0 -20
  105. data/vendor/listen/README.md +0 -349
  106. data/vendor/listen/Rakefile +0 -5
  107. data/vendor/listen/Vagrantfile +0 -96
  108. data/vendor/listen/lib/listen/adapter.rb +0 -327
  109. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  110. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  111. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  112. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  113. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  114. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  115. data/vendor/listen/lib/listen/listener.rb +0 -323
  116. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  117. data/vendor/listen/lib/listen/version.rb +0 -3
  118. data/vendor/listen/lib/listen.rb +0 -54
  119. data/vendor/listen/listen.gemspec +0 -28
  120. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  121. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  122. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  123. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  124. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  125. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  126. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  127. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  128. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  129. data/vendor/listen/spec/listen_spec.rb +0 -67
  130. data/vendor/listen/spec/spec_helper.rb +0 -25
  131. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  132. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  133. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  134. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  135. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -1,9 +1,8 @@
1
- #!/usr/bin/env ruby
2
1
  require File.dirname(__FILE__) + '/../test_helper'
3
2
 
4
3
  class ConversionTest < MiniTest::Test
5
4
  def test_basic
6
- assert_renders <<SASS, <<SCSS
5
+ assert_converts <<SASS, <<SCSS
7
6
  foo bar
8
7
  baz: bang
9
8
  bip: bop
@@ -13,7 +12,7 @@ foo bar {
13
12
  bip: bop;
14
13
  }
15
14
  SCSS
16
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
15
+ silence_warnings {assert_converts <<SASS, <<SCSS, options: {old: true}}
17
16
  foo bar
18
17
  :baz bang
19
18
  :bip bop
@@ -26,19 +25,19 @@ SCSS
26
25
  end
27
26
 
28
27
  def test_empty_selector
29
- assert_renders "foo bar", "foo bar {}"
28
+ assert_converts "foo bar", "foo bar {}"
30
29
  end
31
30
 
32
31
  def test_empty_directive
33
- assert_renders "@media screen", "@media screen {}"
32
+ assert_converts "@media screen", "@media screen {}"
34
33
  end
35
34
 
36
35
  def test_empty_control_directive
37
- assert_renders "@if false", "@if false {}"
36
+ assert_converts "@if false", "@if false {}"
38
37
  end
39
38
 
40
39
  def test_nesting
41
- assert_renders <<SASS, <<SCSS
40
+ assert_converts <<SASS, <<SCSS
42
41
  foo bar
43
42
  baz bang
44
43
  baz: bang
@@ -58,7 +57,7 @@ SCSS
58
57
  end
59
58
 
60
59
  def test_nesting_with_parent_ref
61
- assert_renders <<SASS, <<SCSS
60
+ assert_converts <<SASS, <<SCSS
62
61
  foo bar
63
62
  &:hover
64
63
  baz: bang
@@ -72,7 +71,7 @@ SCSS
72
71
  end
73
72
 
74
73
  def test_selector_interpolation
75
- assert_renders <<SASS, <<SCSS
74
+ assert_converts <<SASS, <<SCSS
76
75
  foo \#{$bar + "baz"}.bip
77
76
  baz: bang
78
77
 
@@ -90,7 +89,7 @@ SCSS
90
89
  end
91
90
 
92
91
  def test_multiline_selector_with_commas
93
- assert_renders <<SASS, <<SCSS
92
+ assert_converts <<SASS, <<SCSS
94
93
  foo bar,
95
94
  baz bang
96
95
  baz: bang
@@ -101,7 +100,7 @@ baz bang {
101
100
  }
102
101
  SCSS
103
102
 
104
- assert_renders <<SASS, <<SCSS
103
+ assert_converts <<SASS, <<SCSS
105
104
  blat
106
105
  foo bar,
107
106
  baz bang
@@ -136,7 +135,7 @@ SCSS
136
135
  end
137
136
 
138
137
  def test_escaped_selector
139
- assert_renders <<SASS, <<SCSS
138
+ assert_converts <<SASS, <<SCSS
140
139
  foo bar
141
140
  \\:hover
142
141
  baz: bang
@@ -150,7 +149,7 @@ SCSS
150
149
  end
151
150
 
152
151
  def test_property_name_interpolation
153
- assert_renders <<SASS, <<SCSS
152
+ assert_converts <<SASS, <<SCSS
154
153
  foo bar
155
154
  baz\#{$bang}bip\#{$bop}: 12
156
155
  SASS
@@ -161,7 +160,7 @@ SCSS
161
160
  end
162
161
 
163
162
  def test_property_value_interpolation
164
- assert_renders <<SASS, <<SCSS
163
+ assert_converts <<SASS, <<SCSS
165
164
  foo bar
166
165
  baz: 12 \#{$bang} bip \#{"bop"} blat
167
166
  SASS
@@ -172,7 +171,7 @@ SCSS
172
171
  end
173
172
 
174
173
  def test_dynamic_properties
175
- assert_renders <<SASS, <<SCSS
174
+ assert_converts <<SASS, <<SCSS
176
175
  foo bar
177
176
  baz: 12 $bang "bip"
178
177
  SASS
@@ -183,7 +182,7 @@ SCSS
183
182
  end
184
183
 
185
184
  def test_dynamic_properties_with_old
186
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
185
+ silence_warnings {assert_converts <<SASS, <<SCSS, options: {old: true}}
187
186
  foo bar
188
187
  :baz 12 $bang "bip"
189
188
  SASS
@@ -206,7 +205,7 @@ foo bar {
206
205
  }
207
206
  SCSS
208
207
 
209
- assert_scss_to_scss <<OUT, <<IN
208
+ assert_scss_to_scss <<OUT, source: <<IN
210
209
  foo bar {
211
210
  baz: bip bam boon;
212
211
  }
@@ -233,7 +232,7 @@ foo bar {
233
232
  }
234
233
  SCSS
235
234
 
236
- assert_scss_to_scss <<OUT, <<IN
235
+ assert_scss_to_scss <<OUT, source: <<IN
237
236
  foo bar {
238
237
  baz: $bip "bam" 12px;
239
238
  }
@@ -248,7 +247,7 @@ IN
248
247
  end
249
248
 
250
249
  def test_silent_comments
251
- assert_renders <<SASS, <<SCSS
250
+ assert_converts <<SASS, <<SCSS
252
251
  // foo
253
252
 
254
253
  // bar
@@ -269,7 +268,7 @@ foo bar {
269
268
  }
270
269
  SCSS
271
270
 
272
- assert_renders <<SASS, <<SCSS
271
+ assert_converts <<SASS, <<SCSS
273
272
  // foo
274
273
  // bar
275
274
  // baz
@@ -288,7 +287,7 @@ foo bar {
288
287
  }
289
288
  SCSS
290
289
 
291
- assert_renders <<SASS, <<SCSS
290
+ assert_converts <<SASS, <<SCSS
292
291
  // foo
293
292
  // bar
294
293
  // baz
@@ -309,7 +308,7 @@ SCSS
309
308
  end
310
309
 
311
310
  def test_nested_silent_comments
312
- assert_renders <<SASS, <<SCSS
311
+ assert_converts <<SASS, <<SCSS
313
312
  foo
314
313
  bar: baz
315
314
 
@@ -361,7 +360,7 @@ SASS
361
360
  end
362
361
 
363
362
  def test_preserves_triple_slash_comments
364
- assert_renders <<SASS, <<SCSS
363
+ assert_converts <<SASS, <<SCSS
365
364
  /// foo
366
365
  /// bar
367
366
  foo
@@ -378,7 +377,7 @@ SCSS
378
377
  end
379
378
 
380
379
  def test_loud_comments
381
- assert_renders <<SASS, <<SCSS
380
+ assert_converts <<SASS, <<SCSS
382
381
  /* foo
383
382
 
384
383
  /* bar
@@ -429,7 +428,7 @@ foo bar {
429
428
  }
430
429
  SCSS
431
430
 
432
- assert_renders <<SASS, <<SCSS
431
+ assert_converts <<SASS, <<SCSS
433
432
  /* foo
434
433
  * bar
435
434
  * baz
@@ -450,7 +449,7 @@ SCSS
450
449
  end
451
450
 
452
451
  def test_nested_loud_comments
453
- assert_renders <<SASS, <<SCSS
452
+ assert_converts <<SASS, <<SCSS
454
453
  foo
455
454
  bar: baz
456
455
 
@@ -502,7 +501,7 @@ SASS
502
501
  end
503
502
 
504
503
  def test_preserves_double_star_comments
505
- assert_renders <<SASS, <<SCSS
504
+ assert_converts <<SASS, <<SCSS
506
505
  /** foo
507
506
  * bar
508
507
  foo
@@ -574,7 +573,7 @@ SCSS
574
573
  end
575
574
 
576
575
  def test_immediately_preceding_comments
577
- assert_renders <<SASS, <<SCSS
576
+ assert_converts <<SASS, <<SCSS
578
577
  /* Foo
579
578
  * Bar
580
579
  * Baz
@@ -589,7 +588,7 @@ SASS
589
588
  }
590
589
  SCSS
591
590
 
592
- assert_renders <<SASS, <<SCSS
591
+ assert_converts <<SASS, <<SCSS
593
592
  // Foo
594
593
  // Bar
595
594
  // Baz
@@ -628,7 +627,7 @@ SASS
628
627
  end
629
628
 
630
629
  def test_debug
631
- assert_renders <<SASS, <<SCSS
630
+ assert_converts <<SASS, <<SCSS
632
631
  foo
633
632
  @debug 12px
634
633
 
@@ -643,7 +642,7 @@ SCSS
643
642
  end
644
643
 
645
644
  def test_error
646
- assert_renders <<SASS, <<SCSS
645
+ assert_converts <<SASS, <<SCSS
647
646
  foo
648
647
  @error "oh no!"
649
648
 
@@ -658,7 +657,7 @@ SCSS
658
657
  end
659
658
 
660
659
  def test_directive_without_children
661
- assert_renders <<SASS, <<SCSS
660
+ assert_converts <<SASS, <<SCSS
662
661
  foo
663
662
  @foo #bar "baz"
664
663
 
@@ -673,7 +672,7 @@ SCSS
673
672
  end
674
673
 
675
674
  def test_directive_with_prop_children
676
- assert_renders <<SASS, <<SCSS
675
+ assert_converts <<SASS, <<SCSS
677
676
  foo
678
677
  @foo #bar "baz"
679
678
  a: b
@@ -693,7 +692,7 @@ SCSS
693
692
  end
694
693
 
695
694
  def test_directive_with_rule_children
696
- assert_renders <<SASS, <<SCSS
695
+ assert_converts <<SASS, <<SCSS
697
696
  foo
698
697
  @foo #bar "baz"
699
698
  #blat
@@ -723,7 +722,7 @@ SCSS
723
722
  end
724
723
 
725
724
  def test_directive_with_rule_and_prop_children
726
- assert_renders <<SASS, <<SCSS
725
+ assert_converts <<SASS, <<SCSS
727
726
  foo
728
727
  @foo #bar "baz"
729
728
  g: h
@@ -761,7 +760,7 @@ SCSS
761
760
  end
762
761
 
763
762
  def test_charset
764
- assert_renders <<SASS, <<SCSS
763
+ assert_converts <<SASS, <<SCSS
765
764
  @charset "utf-8"
766
765
  SASS
767
766
  @charset "utf-8";
@@ -769,7 +768,7 @@ SCSS
769
768
  end
770
769
 
771
770
  def test_for
772
- assert_renders <<SASS, <<SCSS
771
+ assert_converts <<SASS, <<SCSS
773
772
  foo
774
773
  @for $a from $b to $c
775
774
  a: b
@@ -792,7 +791,7 @@ SCSS
792
791
  end
793
792
 
794
793
  def test_while
795
- assert_renders <<SASS, <<SCSS
794
+ assert_converts <<SASS, <<SCSS
796
795
  foo
797
796
  @while flaz($a + $b)
798
797
  a: b
@@ -815,7 +814,7 @@ SCSS
815
814
  end
816
815
 
817
816
  def test_if
818
- assert_renders <<SASS, <<SCSS
817
+ assert_converts <<SASS, <<SCSS
819
818
  foo
820
819
  @if $foo or $bar
821
820
  a: b
@@ -846,7 +845,7 @@ SCSS
846
845
  end
847
846
 
848
847
  def test_each
849
- assert_renders <<SASS, <<SCSS
848
+ assert_converts <<SASS, <<SCSS
850
849
  a
851
850
  @each $number in 1px 2px 3px 4px
852
851
  b: $number
@@ -880,7 +879,7 @@ SCSS
880
879
  end
881
880
 
882
881
  def test_import
883
- assert_renders <<SASS, <<SCSS
882
+ assert_converts <<SASS, <<SCSS
884
883
  @import foo
885
884
 
886
885
  @import url(bar.css)
@@ -897,7 +896,7 @@ foo {
897
896
  }
898
897
  SCSS
899
898
 
900
- assert_renders <<SASS, <<SCSS
899
+ assert_converts <<SASS, <<SCSS
901
900
  @import foo.css
902
901
 
903
902
  @import url(bar.css)
@@ -920,13 +919,13 @@ SCSS
920
919
  end
921
920
 
922
921
  def test_import_as_directive_in_scss
923
- assert_renders <<SASS, <<SCSS
922
+ assert_converts <<SASS, <<SCSS
924
923
  @import "foo.css" print
925
924
  SASS
926
925
  @import "foo.css" print;
927
926
  SCSS
928
927
 
929
- assert_renders <<SASS, <<SCSS
928
+ assert_converts <<SASS, <<SCSS
930
929
  @import url(foo.css) screen, print
931
930
  SASS
932
931
  @import url(foo.css) screen, print;
@@ -934,7 +933,7 @@ SCSS
934
933
  end
935
934
 
936
935
  def test_adjacent_imports
937
- assert_renders <<SASS, <<SCSS
936
+ assert_converts <<SASS, <<SCSS
938
937
  @import foo.sass
939
938
  @import bar.scss
940
939
  @import baz
@@ -946,7 +945,7 @@ SCSS
946
945
  end
947
946
 
948
947
  def test_non_adjacent_imports
949
- assert_renders <<SASS, <<SCSS
948
+ assert_converts <<SASS, <<SCSS
950
949
  @import foo.sass
951
950
 
952
951
  @import bar.scss
@@ -962,7 +961,7 @@ SCSS
962
961
  end
963
962
 
964
963
  def test_import_with_interpolation
965
- assert_renders <<SASS, <<SCSS
964
+ assert_converts <<SASS, <<SCSS
966
965
  $family: unquote("Droid+Sans")
967
966
 
968
967
  @import url("http://fonts.googleapis.com/css?family=\#{$family}")
@@ -974,7 +973,7 @@ SCSS
974
973
  end
975
974
 
976
975
  def test_extend
977
- assert_renders <<SASS, <<SCSS
976
+ assert_converts <<SASS, <<SCSS
978
977
  .foo
979
978
  @extend .bar
980
979
 
@@ -989,7 +988,7 @@ SCSS
989
988
  end
990
989
 
991
990
  def test_comma_extendee
992
- assert_renders <<SASS, <<SCSS
991
+ assert_converts <<SASS, <<SCSS
993
992
  .baz
994
993
  @extend .foo, .bar
995
994
  SASS
@@ -1000,7 +999,7 @@ SCSS
1000
999
  end
1001
1000
 
1002
1001
  def test_argless_mixin_definition
1003
- assert_renders <<SASS, <<SCSS
1002
+ assert_converts <<SASS, <<SCSS
1004
1003
  =foo-bar
1005
1004
  baz
1006
1005
  a: b
@@ -1038,7 +1037,7 @@ SASS
1038
1037
  end
1039
1038
 
1040
1039
  def test_mixin_definition_without_defaults
1041
- assert_renders <<SASS, <<SCSS
1040
+ assert_converts <<SASS, <<SCSS
1042
1041
  =foo-bar($baz, $bang)
1043
1042
  baz
1044
1043
  a: $baz $bang
@@ -1052,7 +1051,7 @@ SCSS
1052
1051
  end
1053
1052
 
1054
1053
  def test_mixin_definition_with_defaults
1055
- assert_renders <<SASS, <<SCSS
1054
+ assert_converts <<SASS, <<SCSS
1056
1055
  =foo-bar($baz, $bang: 12px)
1057
1056
  baz
1058
1057
  a: $baz $bang
@@ -1078,7 +1077,7 @@ SASS
1078
1077
  end
1079
1078
 
1080
1079
  def test_argless_mixin_include
1081
- assert_renders <<SASS, <<SCSS
1080
+ assert_converts <<SASS, <<SCSS
1082
1081
  foo
1083
1082
  +foo-bar
1084
1083
 
@@ -1093,7 +1092,7 @@ SCSS
1093
1092
  end
1094
1093
 
1095
1094
  def test_mixin_include
1096
- assert_renders <<SASS, <<SCSS
1095
+ assert_converts <<SASS, <<SCSS
1097
1096
  foo
1098
1097
  +foo-bar(12px, "blaz")
1099
1098
 
@@ -1108,7 +1107,7 @@ SCSS
1108
1107
  end
1109
1108
 
1110
1109
  def test_mixin_include_with_keyword_args
1111
- assert_renders <<SASS, <<SCSS
1110
+ assert_converts <<SASS, <<SCSS
1112
1111
  foo
1113
1112
  +foo-bar(12px, "blaz", $blip: blap, $bloop: blop)
1114
1113
 
@@ -1127,7 +1126,7 @@ SCSS
1127
1126
  end
1128
1127
 
1129
1128
  def test_consecutive_mixin_includes
1130
- assert_renders <<SASS, <<SCSS
1129
+ assert_converts <<SASS, <<SCSS
1131
1130
  foo
1132
1131
  +foo-bar
1133
1132
  +foo-bar
@@ -1144,7 +1143,7 @@ SCSS
1144
1143
  end
1145
1144
 
1146
1145
  def test_mixin_include_with_hyphen_conversion_keyword_arg
1147
- assert_renders <<SASS, <<SCSS
1146
+ assert_converts <<SASS, <<SCSS
1148
1147
  foo
1149
1148
  +foo-bar($a-b_c: val)
1150
1149
 
@@ -1159,7 +1158,7 @@ SCSS
1159
1158
  end
1160
1159
 
1161
1160
  def test_argless_function_definition
1162
- assert_renders <<SASS, <<SCSS
1161
+ assert_converts <<SASS, <<SCSS
1163
1162
  @function foo()
1164
1163
  $var: 1 + 1
1165
1164
 
@@ -1174,7 +1173,7 @@ SCSS
1174
1173
  end
1175
1174
 
1176
1175
  def test_function_definition_without_defaults
1177
- assert_renders <<SASS, <<SCSS
1176
+ assert_converts <<SASS, <<SCSS
1178
1177
  @function foo($var1, $var2)
1179
1178
  @if $var1
1180
1179
  @return $var1 + $var2
@@ -1188,7 +1187,7 @@ SCSS
1188
1187
  end
1189
1188
 
1190
1189
  def test_function_definition_with_defaults
1191
- assert_renders <<SASS, <<SCSS
1190
+ assert_converts <<SASS, <<SCSS
1192
1191
  @function foo($var1, $var2: foo)
1193
1192
  @if $var1
1194
1193
  @return $var1 + $var2
@@ -1202,7 +1201,7 @@ SCSS
1202
1201
  end
1203
1202
 
1204
1203
  def test_variable_definition
1205
- assert_renders <<SASS, <<SCSS
1204
+ assert_converts <<SASS, <<SCSS
1206
1205
  $var1: 12px + 15px
1207
1206
 
1208
1207
  foo
@@ -1221,7 +1220,7 @@ SCSS
1221
1220
  end
1222
1221
 
1223
1222
  def test_guarded_variable_definition
1224
- assert_renders <<SASS, <<SCSS
1223
+ assert_converts <<SASS, <<SCSS
1225
1224
  $var1: 12px + 15px !default
1226
1225
 
1227
1226
  foo
@@ -1240,7 +1239,7 @@ SCSS
1240
1239
  end
1241
1240
 
1242
1241
  def test_multiple_variable_definitions
1243
- assert_renders <<SASS, <<SCSS
1242
+ assert_converts <<SASS, <<SCSS
1244
1243
  $var1: foo
1245
1244
  $var2: bar
1246
1245
  $var3: baz
@@ -1258,7 +1257,7 @@ SCSS
1258
1257
  end
1259
1258
 
1260
1259
  def test_division_asserted_with_parens
1261
- assert_renders <<SASS, <<SCSS
1260
+ assert_converts <<SASS, <<SCSS
1262
1261
  foo
1263
1262
  a: (1px / 2px)
1264
1263
  SASS
@@ -1269,7 +1268,7 @@ SCSS
1269
1268
  end
1270
1269
 
1271
1270
  def test_division_not_asserted_when_unnecessary
1272
- assert_renders <<SASS, <<SCSS
1271
+ assert_converts <<SASS, <<SCSS
1273
1272
  $var: 1px / 2px
1274
1273
 
1275
1274
  foo
@@ -1282,7 +1281,7 @@ foo {
1282
1281
  }
1283
1282
  SCSS
1284
1283
 
1285
- assert_renders <<SASS, <<SCSS
1284
+ assert_converts <<SASS, <<SCSS
1286
1285
  $var: 1px
1287
1286
 
1288
1287
  foo
@@ -1295,7 +1294,7 @@ foo {
1295
1294
  }
1296
1295
  SCSS
1297
1296
 
1298
- assert_renders <<SASS, <<SCSS
1297
+ assert_converts <<SASS, <<SCSS
1299
1298
  foo
1300
1299
  a: 1 + 1px / 2px
1301
1300
  SASS
@@ -1306,7 +1305,7 @@ SCSS
1306
1305
  end
1307
1306
 
1308
1307
  def test_literal_slash
1309
- assert_renders <<SASS, <<SCSS
1308
+ assert_converts <<SASS, <<SCSS
1310
1309
  foo
1311
1310
  a: 1px / 2px
1312
1311
  SASS
@@ -1316,7 +1315,7 @@ foo {
1316
1315
  SCSS
1317
1316
 
1318
1317
  # Regression test for issue 1787
1319
- assert_renders <<SASS, <<SCSS
1318
+ assert_converts <<SASS, <<SCSS
1320
1319
  foo
1321
1320
  a: 1px / 2px 3px
1322
1321
  SASS
@@ -1327,7 +1326,7 @@ SCSS
1327
1326
  end
1328
1327
 
1329
1328
  def test_directive_with_interpolation
1330
- assert_renders <<SASS, <<SCSS
1329
+ assert_converts <<SASS, <<SCSS
1331
1330
  $baz: 12
1332
1331
 
1333
1332
  @foo bar\#{$baz} qux
@@ -1342,7 +1341,7 @@ SCSS
1342
1341
  end
1343
1342
 
1344
1343
  def test_media_with_interpolation
1345
- assert_renders <<SASS, <<SCSS
1344
+ assert_converts <<SASS, <<SCSS
1346
1345
  $baz: 12
1347
1346
 
1348
1347
  @media bar\#{$baz}
@@ -1357,7 +1356,7 @@ SCSS
1357
1356
  end
1358
1357
 
1359
1358
  def test_media_with_expressions
1360
- assert_renders <<SASS, <<SCSS
1359
+ assert_converts <<SASS, <<SCSS
1361
1360
  $media1: screen
1362
1361
  $media2: print
1363
1362
  $var: -webkit-min-device-pixel-ratio
@@ -1378,7 +1377,7 @@ SCSS
1378
1377
  end
1379
1378
 
1380
1379
  def test_media_with_feature
1381
- assert_renders <<SASS, <<SCSS
1380
+ assert_converts <<SASS, <<SCSS
1382
1381
  @media screen and (-webkit-transform-3d)
1383
1382
  a: b
1384
1383
  SASS
@@ -1389,7 +1388,7 @@ SCSS
1389
1388
  end
1390
1389
 
1391
1390
  def test_supports_with_expressions
1392
- assert_renders <<SASS, <<SCSS
1391
+ assert_converts <<SASS, <<SCSS
1393
1392
  $query: "(feature1: val)"
1394
1393
  $feature: feature2
1395
1394
  $val: val
@@ -1413,7 +1412,7 @@ SCSS
1413
1412
  # Hacks
1414
1413
 
1415
1414
  def test_declaration_hacks
1416
- assert_renders <<SASS, <<SCSS
1415
+ assert_converts <<SASS, <<SCSS
1417
1416
  foo
1418
1417
  _name: val
1419
1418
  *name: val
@@ -1436,7 +1435,7 @@ SCSS
1436
1435
  end
1437
1436
 
1438
1437
  def test_old_declaration_hacks
1439
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
1438
+ silence_warnings {assert_converts <<SASS, <<SCSS, options: {old: true}}
1440
1439
  foo
1441
1440
  :_name val
1442
1441
  :*name val
@@ -1456,7 +1455,7 @@ SCSS
1456
1455
 
1457
1456
  def test_selector_hacks
1458
1457
  assert_selector_renders = lambda do |s|
1459
- assert_renders <<SASS, <<SCSS
1458
+ assert_converts <<SASS, <<SCSS
1460
1459
  #{s}
1461
1460
  a: b
1462
1461
  SASS
@@ -1483,7 +1482,7 @@ SCSS
1483
1482
  end
1484
1483
 
1485
1484
  def test_nested_properties
1486
- assert_renders <<SASS, <<SCSS
1485
+ assert_converts <<SASS, <<SCSS
1487
1486
  div
1488
1487
  before: before
1489
1488
  background:
@@ -1504,7 +1503,7 @@ SCSS
1504
1503
  end
1505
1504
 
1506
1505
  def test_dasherize
1507
- assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
1506
+ assert_sass_to_scss(<<SCSS, <<SASS, options: {dasherize: true})
1508
1507
  @mixin under-scored-mixin($under-scored-arg: $under-scored-default) {
1509
1508
  bar: $under-scored-arg;
1510
1509
  }
@@ -1539,7 +1538,7 @@ SASS
1539
1538
  end
1540
1539
 
1541
1540
  def test_loud_comment_conversion
1542
- assert_renders(<<SASS, <<SCSS)
1541
+ assert_converts(<<SASS, <<SCSS)
1543
1542
  /*! \#{"interpolated"}
1544
1543
  SASS
1545
1544
  /*! \#{"interpolated"} */
@@ -1547,7 +1546,7 @@ SCSS
1547
1546
  end
1548
1547
 
1549
1548
  def test_content_conversion
1550
- assert_renders(<<SASS, <<SCSS)
1549
+ assert_converts(<<SASS, <<SCSS)
1551
1550
  $color: blue
1552
1551
 
1553
1552
  =context($class, $color: red)
@@ -1594,7 +1593,7 @@ SCSS
1594
1593
  end
1595
1594
 
1596
1595
  def test_placeholder_conversion
1597
- assert_renders(<<SASS, <<SCSS)
1596
+ assert_converts(<<SASS, <<SCSS)
1598
1597
  #content a%foo.bar
1599
1598
  color: blue
1600
1599
  SASS
@@ -1605,7 +1604,7 @@ SCSS
1605
1604
  end
1606
1605
 
1607
1606
  def test_reference_selector
1608
- assert_renders(<<SASS, <<SCSS)
1607
+ assert_converts(<<SASS, <<SCSS)
1609
1608
  foo /bar|baz/ bang
1610
1609
  a: b
1611
1610
  SASS
@@ -1616,7 +1615,7 @@ SCSS
1616
1615
  end
1617
1616
 
1618
1617
  def test_subject
1619
- assert_renders(<<SASS, <<SCSS)
1618
+ assert_converts(<<SASS, <<SCSS)
1620
1619
  foo bar! baz
1621
1620
  a: b
1622
1621
  SASS
@@ -1627,7 +1626,7 @@ SCSS
1627
1626
  end
1628
1627
 
1629
1628
  def test_placeholder_interoplation_conversion
1630
- assert_renders(<<SASS, <<SCSS)
1629
+ assert_converts(<<SASS, <<SCSS)
1631
1630
  $foo: foo
1632
1631
 
1633
1632
  %\#{$foo}
@@ -1649,7 +1648,7 @@ SCSS
1649
1648
  end
1650
1649
 
1651
1650
  def test_indent
1652
- assert_renders <<SASS, <<SCSS, :indent => " "
1651
+ assert_converts <<SASS, <<SCSS, options: {indent: " "}
1653
1652
  foo bar
1654
1653
  baz bang
1655
1654
  baz: bang
@@ -1667,7 +1666,7 @@ foo bar {
1667
1666
  }
1668
1667
  SCSS
1669
1668
 
1670
- assert_renders <<SASS, <<SCSS, :indent => "\t"
1669
+ assert_converts <<SASS, <<SCSS, options: {indent: "\t"}
1671
1670
  foo bar
1672
1671
  baz bang
1673
1672
  baz: bang
@@ -1685,7 +1684,7 @@ foo bar {
1685
1684
  }
1686
1685
  SCSS
1687
1686
 
1688
- assert_sass_to_scss <<SCSS, <<SASS, :indent => " "
1687
+ assert_sass_to_scss <<SCSS, <<SASS, options: {indent: " "}
1689
1688
  foo bar {
1690
1689
  baz bang {
1691
1690
  baz: bang;
@@ -1703,7 +1702,7 @@ foo bar
1703
1702
  blat: boo
1704
1703
  SASS
1705
1704
 
1706
- assert_sass_to_scss <<SCSS, <<SASS, :indent => "\t"
1705
+ assert_sass_to_scss <<SCSS, <<SASS, options: {indent: "\t"}
1707
1706
  foo bar {
1708
1707
  baz bang {
1709
1708
  baz: bang;
@@ -1721,7 +1720,7 @@ foo bar
1721
1720
  blat: boo
1722
1721
  SASS
1723
1722
 
1724
- assert_scss_to_sass <<SASS, <<SCSS, :indent => " "
1723
+ assert_scss_to_sass <<SASS, <<SCSS, options: {indent: " "}
1725
1724
  foo bar
1726
1725
  baz bang
1727
1726
  baz: bang
@@ -1739,7 +1738,7 @@ foo bar {
1739
1738
  }
1740
1739
  SCSS
1741
1740
 
1742
- assert_scss_to_sass <<SASS, <<SCSS, :indent => "\t"
1741
+ assert_scss_to_sass <<SASS, <<SCSS, options: {indent: "\t"}
1743
1742
  foo bar
1744
1743
  baz bang
1745
1744
  baz: bang
@@ -1759,7 +1758,7 @@ SCSS
1759
1758
  end
1760
1759
 
1761
1760
  def test_extend_with_optional
1762
- assert_renders <<SASS, <<SCSS
1761
+ assert_converts <<SASS, <<SCSS
1763
1762
  foo
1764
1763
  @extend .bar !optional
1765
1764
  SASS
@@ -1770,7 +1769,7 @@ SCSS
1770
1769
  end
1771
1770
 
1772
1771
  def test_mixin_var_args
1773
- assert_renders <<SASS, <<SCSS
1772
+ assert_converts <<SASS, <<SCSS
1774
1773
  =foo($args...)
1775
1774
  a: b
1776
1775
 
@@ -1799,7 +1798,7 @@ SCSS
1799
1798
  end
1800
1799
 
1801
1800
  def test_mixin_var_kwargs
1802
- assert_renders <<SASS, <<SCSS
1801
+ assert_converts <<SASS, <<SCSS
1803
1802
  =foo($a: b, $c: d)
1804
1803
  a: $a
1805
1804
  c: $c
@@ -1823,7 +1822,7 @@ SCSS
1823
1822
  end
1824
1823
 
1825
1824
  def test_function_var_args
1826
- assert_renders <<SASS, <<SCSS
1825
+ assert_converts <<SASS, <<SCSS
1827
1826
  @function foo($args...)
1828
1827
  @return foo
1829
1828
 
@@ -1850,7 +1849,7 @@ SCSS
1850
1849
  end
1851
1850
 
1852
1851
  def test_function_var_kwargs
1853
- assert_renders <<SASS, <<SCSS
1852
+ assert_converts <<SASS, <<SCSS
1854
1853
  @function foo($a: b, $c: d)
1855
1854
  @return foo
1856
1855
 
@@ -1870,7 +1869,7 @@ SCSS
1870
1869
  end
1871
1870
 
1872
1871
  def test_at_root
1873
- assert_renders <<SASS, <<SCSS
1872
+ assert_converts <<SASS, <<SCSS
1874
1873
  .foo
1875
1874
  @at-root
1876
1875
  .bar
@@ -1894,7 +1893,7 @@ SCSS
1894
1893
  end
1895
1894
 
1896
1895
  def test_at_root_with_selector
1897
- assert_renders <<SASS, <<SCSS
1896
+ assert_converts <<SASS, <<SCSS
1898
1897
  .foo
1899
1898
  @at-root .bar
1900
1899
  a: b
@@ -1908,7 +1907,7 @@ SCSS
1908
1907
  end
1909
1908
 
1910
1909
  def test_at_root_without
1911
- assert_renders <<SASS, <<SCSS
1910
+ assert_converts <<SASS, <<SCSS
1912
1911
  .foo
1913
1912
  @at-root (without: media rule)
1914
1913
  a: b
@@ -1922,7 +1921,7 @@ SCSS
1922
1921
  end
1923
1922
 
1924
1923
  def test_at_root_with
1925
- assert_renders <<SASS, <<SCSS
1924
+ assert_converts <<SASS, <<SCSS
1926
1925
  .foo
1927
1926
  @at-root (with: media rule)
1928
1927
  a: b
@@ -1936,7 +1935,7 @@ SCSS
1936
1935
  end
1937
1936
 
1938
1937
  def test_function_var_kwargs_with_list
1939
- assert_renders <<SASS, <<SCSS
1938
+ assert_converts <<SASS, <<SCSS
1940
1939
  @function foo($a: b, $c: d)
1941
1940
  @return $a, $c
1942
1941
 
@@ -1954,7 +1953,7 @@ SCSS
1954
1953
  end
1955
1954
 
1956
1955
  def test_keyframes
1957
- assert_renders(<<SASS, <<SCSS)
1956
+ assert_converts(<<SASS, <<SCSS)
1958
1957
  @keyframes identifier
1959
1958
  0%
1960
1959
  top: 0
@@ -1995,7 +1994,7 @@ SCSS
1995
1994
  ## Regression Tests
1996
1995
 
1997
1996
  def test_list_in_args
1998
- assert_renders(<<SASS, <<SCSS)
1997
+ assert_converts(<<SASS, <<SCSS)
1999
1998
  +mixin((a, b, c))
2000
1999
 
2001
2000
  +mixin($arg: (a, b, c))
@@ -2011,7 +2010,7 @@ SCSS
2011
2010
  end
2012
2011
 
2013
2012
  def test_media_query_with_expr
2014
- assert_renders <<SASS, <<SCSS
2013
+ assert_converts <<SASS, <<SCSS
2015
2014
  @media foo and (bar: baz)
2016
2015
  a: b
2017
2016
  SASS
@@ -2022,7 +2021,7 @@ SCSS
2022
2021
  end
2023
2022
 
2024
2023
  def test_nested_if_statements
2025
- assert_renders(<<SASS, <<SCSS)
2024
+ assert_converts(<<SASS, <<SCSS)
2026
2025
  @if $foo
2027
2026
  one
2028
2027
  a: b
@@ -2055,7 +2054,7 @@ SCSS
2055
2054
  end
2056
2055
 
2057
2056
  def test_comment_indentation
2058
- assert_renders(<<SASS, <<SCSS, :indent => ' ')
2057
+ assert_converts(<<SASS, <<SCSS, options: {indent: ' '})
2059
2058
  foo
2060
2059
  // bar
2061
2060
  /* baz
@@ -2070,27 +2069,27 @@ SCSS
2070
2069
  end
2071
2070
 
2072
2071
  def test_keyword_arguments
2073
- assert_renders(<<SASS, <<SCSS, :dasherize => true)
2072
+ assert_converts(<<SASS, <<SCSS, options: {dasherize: true})
2074
2073
  $foo: foo($dash-ed: 2px)
2075
2074
  SASS
2076
2075
  $foo: foo($dash-ed: 2px);
2077
2076
  SCSS
2078
- assert_scss_to_sass(<<SASS, <<SCSS, :dasherize => true)
2077
+ assert_scss_to_sass(<<SASS, <<SCSS, options: {dasherize: true})
2079
2078
  $foo: foo($dash-ed: 2px)
2080
2079
  SASS
2081
2080
  $foo: foo($dash_ed: 2px);
2082
2081
  SCSS
2083
- assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
2082
+ assert_sass_to_scss(<<SCSS, <<SASS, options: {dasherize: true})
2084
2083
  $foo: foo($dash-ed: 2px);
2085
2084
  SCSS
2086
2085
  $foo: foo($dash_ed: 2px)
2087
2086
  SASS
2088
- assert_renders(<<SASS, <<SCSS)
2087
+ assert_converts(<<SASS, <<SCSS)
2089
2088
  $foo: foo($under_scored: 1px)
2090
2089
  SASS
2091
2090
  $foo: foo($under_scored: 1px);
2092
2091
  SCSS
2093
- assert_renders(<<SASS, <<SCSS)
2092
+ assert_converts(<<SASS, <<SCSS)
2094
2093
  $foo: foo($dash-ed: 2px, $under_scored: 1px)
2095
2094
  SASS
2096
2095
  $foo: foo($dash-ed: 2px, $under_scored: 1px);
@@ -2098,7 +2097,7 @@ SCSS
2098
2097
  end
2099
2098
 
2100
2099
  def test_ambiguous_negation
2101
- assert_renders(<<SASS, <<SCSS, :indent => ' ')
2100
+ assert_converts(<<SASS, <<SCSS, options: {indent: ' '})
2102
2101
  foo
2103
2102
  ok: -$foo
2104
2103
  comma: 10px, -$foo
@@ -2113,7 +2112,7 @@ SCSS
2113
2112
  end
2114
2113
 
2115
2114
  def test_variable_with_global
2116
- assert_renders(<<SASS, <<SCSS)
2115
+ assert_converts(<<SASS, <<SCSS)
2117
2116
  $var: 1
2118
2117
 
2119
2118
  foo
@@ -2130,59 +2129,10 @@ SCSS
2130
2129
  end
2131
2130
 
2132
2131
  def test_import_with_supports_clause
2133
- assert_renders(<<'SASS', <<'SCSS')
2132
+ assert_converts(<<'SASS', <<'SCSS')
2134
2133
  @import url("fallback-layout.css") supports(not (display: #{$display-type}))
2135
2134
  SASS
2136
2135
  @import url("fallback-layout.css") supports(not (display: #{$display-type}));
2137
2136
  SCSS
2138
2137
  end
2139
-
2140
- private
2141
-
2142
- def assert_sass_to_sass(sass, options = {})
2143
- assert_equal(sass.rstrip, to_sass(sass, options).rstrip,
2144
- "Expected Sass to transform to itself")
2145
- end
2146
-
2147
- def assert_scss_to_sass(sass, scss, options = {})
2148
- assert_equal(sass.rstrip, to_sass(scss, options.merge(:syntax => :scss)).rstrip,
2149
- "Expected SCSS to transform to Sass")
2150
- end
2151
-
2152
- def assert_scss_to_scss(scss, in_scss = nil, options = nil)
2153
- if in_scss.is_a?(Hash)
2154
- options = in_scss
2155
- in_scss = nil
2156
- end
2157
-
2158
- in_scss ||= scss
2159
- options ||= {}
2160
-
2161
- assert_equal(scss.rstrip, to_scss(in_scss, options.merge(:syntax => :scss)).rstrip,
2162
- "Expected SCSS to transform to #{scss == in_scss ? 'itself' : 'SCSS'}")
2163
- end
2164
-
2165
- def assert_sass_to_scss(scss, sass, options = {})
2166
- assert_equal(scss.rstrip, to_scss(sass, options).rstrip,
2167
- "Expected Sass to transform to SCSS")
2168
- end
2169
-
2170
- def assert_renders(sass, scss, options = {})
2171
- assert_sass_to_sass(sass, options)
2172
- assert_scss_to_sass(sass, scss, options)
2173
- assert_scss_to_scss(scss, options)
2174
- assert_sass_to_scss(scss, sass, options)
2175
- end
2176
-
2177
- def to_sass(scss, options = {})
2178
- Sass::Util.silence_sass_warnings do
2179
- Sass::Engine.new(scss, options).to_tree.to_sass(options)
2180
- end
2181
- end
2182
-
2183
- def to_scss(sass, options = {})
2184
- Sass::Util.silence_sass_warnings do
2185
- Sass::Engine.new(sass, options).to_tree.to_scss(options)
2186
- end
2187
- end
2188
2138
  end