sass 3.4.0 → 3.4.25

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/CONTRIBUTING.md +148 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +26 -20
  7. data/Rakefile +103 -20
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/extra/sass-spec-ref.sh +32 -0
  11. data/extra/update_watch.rb +1 -1
  12. data/lib/sass/cache_stores/filesystem.rb +7 -7
  13. data/lib/sass/cache_stores/memory.rb +4 -5
  14. data/lib/sass/callbacks.rb +2 -2
  15. data/lib/sass/css.rb +11 -10
  16. data/lib/sass/deprecation.rb +55 -0
  17. data/lib/sass/engine.rb +83 -38
  18. data/lib/sass/environment.rb +26 -2
  19. data/lib/sass/error.rb +12 -12
  20. data/lib/sass/exec/base.rb +15 -3
  21. data/lib/sass/exec/sass_convert.rb +34 -15
  22. data/lib/sass/exec/sass_scss.rb +23 -7
  23. data/lib/sass/features.rb +2 -2
  24. data/lib/sass/importers/base.rb +1 -1
  25. data/lib/sass/importers/deprecated_path.rb +51 -0
  26. data/lib/sass/importers/filesystem.rb +24 -16
  27. data/lib/sass/importers.rb +1 -0
  28. data/lib/sass/logger/base.rb +8 -2
  29. data/lib/sass/logger/delayed.rb +50 -0
  30. data/lib/sass/logger.rb +8 -3
  31. data/lib/sass/plugin/compiler.rb +42 -25
  32. data/lib/sass/plugin/configuration.rb +38 -22
  33. data/lib/sass/plugin/merb.rb +2 -2
  34. data/lib/sass/plugin/rack.rb +3 -3
  35. data/lib/sass/plugin/rails.rb +1 -1
  36. data/lib/sass/plugin/staleness_checker.rb +3 -3
  37. data/lib/sass/plugin.rb +3 -2
  38. data/lib/sass/script/css_parser.rb +2 -3
  39. data/lib/sass/script/css_variable_warning.rb +52 -0
  40. data/lib/sass/script/functions.rb +140 -73
  41. data/lib/sass/script/lexer.rb +37 -22
  42. data/lib/sass/script/parser.rb +235 -40
  43. data/lib/sass/script/tree/funcall.rb +12 -5
  44. data/lib/sass/script/tree/interpolation.rb +109 -4
  45. data/lib/sass/script/tree/list_literal.rb +31 -4
  46. data/lib/sass/script/tree/literal.rb +4 -0
  47. data/lib/sass/script/tree/node.rb +21 -3
  48. data/lib/sass/script/tree/operation.rb +54 -1
  49. data/lib/sass/script/tree/string_interpolation.rb +58 -37
  50. data/lib/sass/script/tree/variable.rb +1 -1
  51. data/lib/sass/script/value/base.rb +10 -9
  52. data/lib/sass/script/value/color.rb +42 -24
  53. data/lib/sass/script/value/helpers.rb +16 -6
  54. data/lib/sass/script/value/map.rb +1 -1
  55. data/lib/sass/script/value/number.rb +52 -19
  56. data/lib/sass/script/value/string.rb +46 -5
  57. data/lib/sass/script.rb +3 -3
  58. data/lib/sass/scss/css_parser.rb +16 -2
  59. data/lib/sass/scss/parser.rb +120 -75
  60. data/lib/sass/scss/rx.rb +9 -10
  61. data/lib/sass/scss/static_parser.rb +19 -14
  62. data/lib/sass/scss.rb +0 -2
  63. data/lib/sass/selector/abstract_sequence.rb +8 -6
  64. data/lib/sass/selector/comma_sequence.rb +25 -9
  65. data/lib/sass/selector/pseudo.rb +45 -35
  66. data/lib/sass/selector/sequence.rb +54 -18
  67. data/lib/sass/selector/simple.rb +11 -11
  68. data/lib/sass/selector/simple_sequence.rb +34 -15
  69. data/lib/sass/selector.rb +7 -10
  70. data/lib/sass/shared.rb +1 -1
  71. data/lib/sass/source/map.rb +7 -4
  72. data/lib/sass/source/position.rb +4 -4
  73. data/lib/sass/stack.rb +2 -2
  74. data/lib/sass/supports.rb +8 -10
  75. data/lib/sass/tree/comment_node.rb +1 -1
  76. data/lib/sass/tree/css_import_node.rb +9 -1
  77. data/lib/sass/tree/function_node.rb +8 -3
  78. data/lib/sass/tree/import_node.rb +6 -5
  79. data/lib/sass/tree/node.rb +5 -3
  80. data/lib/sass/tree/prop_node.rb +5 -6
  81. data/lib/sass/tree/rule_node.rb +14 -4
  82. data/lib/sass/tree/visitors/check_nesting.rb +18 -22
  83. data/lib/sass/tree/visitors/convert.rb +43 -26
  84. data/lib/sass/tree/visitors/cssize.rb +5 -1
  85. data/lib/sass/tree/visitors/deep_copy.rb +1 -1
  86. data/lib/sass/tree/visitors/extend.rb +15 -13
  87. data/lib/sass/tree/visitors/perform.rb +42 -17
  88. data/lib/sass/tree/visitors/set_options.rb +1 -1
  89. data/lib/sass/tree/visitors/to_css.rb +58 -30
  90. data/lib/sass/util/multibyte_string_scanner.rb +0 -2
  91. data/lib/sass/util/normalized_map.rb +0 -1
  92. data/lib/sass/util/subset_map.rb +1 -2
  93. data/lib/sass/util.rb +125 -68
  94. data/lib/sass/version.rb +2 -2
  95. data/lib/sass.rb +10 -3
  96. data/test/sass/compiler_test.rb +6 -2
  97. data/test/sass/conversion_test.rb +187 -53
  98. data/test/sass/css2sass_test.rb +50 -1
  99. data/test/sass/css_variable_test.rb +132 -0
  100. data/test/sass/engine_test.rb +207 -61
  101. data/test/sass/exec_test.rb +10 -0
  102. data/test/sass/extend_test.rb +101 -29
  103. data/test/sass/functions_test.rb +60 -9
  104. data/test/sass/importer_test.rb +9 -0
  105. data/test/sass/more_templates/more1.sass +10 -10
  106. data/test/sass/more_templates/more_import.sass +2 -2
  107. data/test/sass/plugin_test.rb +10 -8
  108. data/test/sass/results/script.css +3 -3
  109. data/test/sass/script_conversion_test.rb +58 -29
  110. data/test/sass/script_test.rb +430 -53
  111. data/test/sass/scss/css_test.rb +73 -7
  112. data/test/sass/scss/rx_test.rb +4 -0
  113. data/test/sass/scss/scss_test.rb +309 -4
  114. data/test/sass/source_map_test.rb +152 -74
  115. data/test/sass/superselector_test.rb +19 -0
  116. data/test/sass/templates/_partial.sass +1 -1
  117. data/test/sass/templates/basic.sass +10 -10
  118. data/test/sass/templates/bork1.sass +1 -1
  119. data/test/sass/templates/bork5.sass +1 -1
  120. data/test/sass/templates/compact.sass +10 -10
  121. data/test/sass/templates/complex.sass +187 -187
  122. data/test/sass/templates/compressed.sass +10 -10
  123. data/test/sass/templates/expanded.sass +10 -10
  124. data/test/sass/templates/import.sass +2 -2
  125. data/test/sass/templates/importee.sass +3 -3
  126. data/test/sass/templates/mixins.sass +22 -22
  127. data/test/sass/templates/multiline.sass +4 -4
  128. data/test/sass/templates/nested.sass +13 -13
  129. data/test/sass/templates/parent_ref.sass +12 -12
  130. data/test/sass/templates/script.sass +70 -70
  131. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  132. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  133. data/test/sass/templates/subdir/subdir.sass +3 -3
  134. data/test/sass/templates/units.sass +10 -10
  135. data/test/sass/util/multibyte_string_scanner_test.rb +10 -2
  136. data/test/sass/util_test.rb +15 -44
  137. data/test/sass-spec.yml +3 -0
  138. data/test/test_helper.rb +5 -4
  139. metadata +302 -295
  140. data/CONTRIBUTING +0 -3
  141. data/lib/sass/scss/script_lexer.rb +0 -15
  142. data/lib/sass/scss/script_parser.rb +0 -25
@@ -634,14 +634,14 @@ SCSS
634
634
 
635
635
  def test_supports
636
636
  assert_equal <<CSS, render(<<SCSS)
637
- @supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
637
+ @supports (((a: b) and (c: d)) or (not (d: e))) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
638
638
  .foo {
639
639
  a: b; } }
640
640
  @supports (a: b) {
641
641
  .foo {
642
642
  a: b; } }
643
643
  CSS
644
- @supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
644
+ @supports (((a: b) and (c: d)) or (not (d: e))) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
645
645
  .foo {
646
646
  a: b;
647
647
  }
@@ -653,13 +653,38 @@ CSS
653
653
  }
654
654
  }
655
655
  SCSS
656
+ end
657
+
658
+ def test_supports_with_prefix
659
+ assert_equal <<CSS, render(<<SCSS)
660
+ @-prefix-supports (((a: b) and (c: d)) or (not (d: e))) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
661
+ .foo {
662
+ a: b; } }
663
+ CSS
664
+ @-prefix-supports (((a: b) and (c: d)) or (not (d: e))) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
665
+ .foo {
666
+ a: b;
667
+ }
668
+ }
669
+ SCSS
670
+ end
656
671
 
672
+ def test_supports_allows_similar_operators_without_parens
657
673
  assert_equal <<CSS, render(<<SCSS)
658
- @-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
674
+ @supports (a: b) and (c: d) and (e: f) {
675
+ .foo {
676
+ a: b; } }
677
+ @supports (a: b) or (c: d) or (e: f) {
659
678
  .foo {
660
679
  a: b; } }
661
680
  CSS
662
- @-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
681
+ @supports (a: b) and (c: d) and (e: f) {
682
+ .foo {
683
+ a: b;
684
+ }
685
+ }
686
+
687
+ @supports (a: b) or (c: d) or (e: f) {
663
688
  .foo {
664
689
  a: b;
665
690
  }
@@ -687,6 +712,41 @@ CSS
687
712
  68%, 72% {left: 50px}
688
713
  100% {top: 100px; left: 100%}
689
714
  }
715
+ SCSS
716
+ end
717
+
718
+ def test_keyframes_with_empty_rules
719
+ assert_equal <<CSS, render(<<SCSS)
720
+ @keyframes identifier {
721
+ 50% {
722
+ background-color: black; } }
723
+ CSS
724
+ @keyframes identifier {
725
+ 0% {}
726
+ 50% {background-color: black}
727
+ 100% {}
728
+ }
729
+ SCSS
730
+ end
731
+
732
+ def test_keyframes_with_custom_identifiers
733
+ assert_equal <<CSS, render(<<SCSS)
734
+ @-skrollr-keyframes identifier {
735
+ center-top {
736
+ left: 100%; }
737
+ top-bottom {
738
+ left: 0%; } }
739
+ CSS
740
+ @-skrollr-keyframes identifier {
741
+ center-top {
742
+ left: 100%;
743
+ }
744
+
745
+ top-bottom {
746
+ left: 0%;
747
+ }
748
+ }
749
+
690
750
  SCSS
691
751
  end
692
752
 
@@ -759,10 +819,10 @@ SCSS
759
819
  assert_selector_parses('E > F')
760
820
  assert_selector_parses('E + F')
761
821
  assert_selector_parses('E ~ F')
762
- assert_selector_parses('E /foo/ F')
822
+ silence_warnings {assert_selector_parses('E /foo/ F')}
763
823
  silence_warnings {assert_selector_parses('E! > F')}
764
824
 
765
- assert_selector_parses('E /ns|foo/ F')
825
+ silence_warnings {assert_selector_parses('E /ns|foo/ F')}
766
826
 
767
827
  # From http://dev.w3.org/csswg/css-scoping-1/
768
828
  assert_selector_parses('E:host(s)')
@@ -978,6 +1038,12 @@ SCSS
978
1038
  assert_equal "E + F {\n a: b; }\n", render("E+F { a: b;} ")
979
1039
  end
980
1040
 
1041
+ def test_escapes_in_selectors
1042
+ assert_selector_parses('.\!foo')
1043
+ assert_selector_parses('.\66 foo')
1044
+ assert_selector_parses('.\21 foo')
1045
+ end
1046
+
981
1047
  def test_subject_selector_deprecation
982
1048
  assert_warning(<<WARNING) {render(".foo .bar! .baz {a: b}")}
983
1049
  DEPRECATION WARNING on line 1, column 1:
@@ -1202,7 +1268,7 @@ SCSS
1202
1268
 
1203
1269
  def assert_directive_parses(param)
1204
1270
  assert_parses <<SCSS
1205
- @keyframes #{param} {
1271
+ @unknown #{param} {
1206
1272
  a: b; }
1207
1273
  SCSS
1208
1274
  end
@@ -141,6 +141,10 @@ class ScssRxTest < MiniTest::Test
141
141
  assert_equal "foo\\00007fbar", Sass::SCSS::RX.escape_ident("foo\177bar")
142
142
  end
143
143
 
144
+ def test_no_static_hyphenated_units
145
+ assert_no_match STATIC_VALUE, "20px-20px"
146
+ end
147
+
144
148
  private
145
149
 
146
150
  def assert_match(rx, str)
@@ -457,6 +457,15 @@ foo {a: 1 + // flang }
457
457
  SCSS
458
458
  end
459
459
 
460
+ def test_static_hyphenated_unit
461
+ assert_equal <<CSS, render(<<SCSS)
462
+ foo {
463
+ a: 0px; }
464
+ CSS
465
+ foo {a: 10px-10px }
466
+ SCSS
467
+ end
468
+
460
469
  ## Nested Rules
461
470
 
462
471
  def test_nested_rules
@@ -715,6 +724,26 @@ CSS
715
724
  SCSS
716
725
  end
717
726
 
727
+ def test_keyframe_bubbling
728
+ assert_equal(<<CSS, render(<<SCSS, :style => :nested))
729
+ @keyframes spin {
730
+ 0% {
731
+ transform: rotate(0deg); } }
732
+ @-webkit-keyframes spin {
733
+ 0% {
734
+ transform: rotate(0deg); } }
735
+ CSS
736
+ .foo {
737
+ @keyframes spin {
738
+ 0% {transform: rotate(0deg)}
739
+ }
740
+ @-webkit-keyframes spin {
741
+ 0% {transform: rotate(0deg)}
742
+ }
743
+ }
744
+ SCSS
745
+ end
746
+
718
747
  ## Namespace Properties
719
748
 
720
749
  def test_namespace_properties
@@ -985,6 +1014,78 @@ bar {
985
1014
  SASS
986
1015
  end
987
1016
 
1017
+ def test_disallowed_function_names
1018
+ Sass::Deprecation.allow_double_warnings do
1019
+ assert_warning(<<WARNING) {render(<<SCSS)}
1020
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1021
+ Naming a function "calc" is disallowed and will be an error in future versions of Sass.
1022
+ This name conflicts with an existing CSS function with special parse rules.
1023
+ WARNING
1024
+ @function calc() {}
1025
+ SCSS
1026
+
1027
+ assert_warning(<<WARNING) {render(<<SCSS)}
1028
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1029
+ Naming a function "-my-calc" is disallowed and will be an error in future versions of Sass.
1030
+ This name conflicts with an existing CSS function with special parse rules.
1031
+ WARNING
1032
+ @function -my-calc() {}
1033
+ SCSS
1034
+
1035
+ assert_warning(<<WARNING) {render(<<SCSS)}
1036
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1037
+ Naming a function "element" is disallowed and will be an error in future versions of Sass.
1038
+ This name conflicts with an existing CSS function with special parse rules.
1039
+ WARNING
1040
+ @function element() {}
1041
+ SCSS
1042
+
1043
+ assert_warning(<<WARNING) {render(<<SCSS)}
1044
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1045
+ Naming a function "-my-element" is disallowed and will be an error in future versions of Sass.
1046
+ This name conflicts with an existing CSS function with special parse rules.
1047
+ WARNING
1048
+ @function -my-element() {}
1049
+ SCSS
1050
+
1051
+ assert_warning(<<WARNING) {render(<<SCSS)}
1052
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1053
+ Naming a function "expression" is disallowed and will be an error in future versions of Sass.
1054
+ This name conflicts with an existing CSS function with special parse rules.
1055
+ WARNING
1056
+ @function expression() {}
1057
+ SCSS
1058
+
1059
+ assert_warning(<<WARNING) {render(<<SCSS)}
1060
+ DEPRECATION WARNING on line 1 of test_disallowed_function_names_inline.scss:
1061
+ Naming a function "url" is disallowed and will be an error in future versions of Sass.
1062
+ This name conflicts with an existing CSS function with special parse rules.
1063
+ WARNING
1064
+ @function url() {}
1065
+ SCSS
1066
+ end
1067
+ end
1068
+
1069
+ def test_allowed_function_names
1070
+ assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1071
+ .a {
1072
+ b: c; }
1073
+ CSS
1074
+ @function -my-expression() {@return c}
1075
+
1076
+ .a {b: -my-expression()}
1077
+ SCSS
1078
+
1079
+ assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1080
+ .a {
1081
+ b: c; }
1082
+ CSS
1083
+ @function -my-url() {@return c}
1084
+
1085
+ .a {b: -my-url()}
1086
+ SCSS
1087
+ end
1088
+
988
1089
  ## Var Args
989
1090
 
990
1091
  def test_mixin_var_args
@@ -1509,6 +1610,17 @@ SCSS
1509
1610
  SCSS
1510
1611
  end
1511
1612
 
1613
+ def test_mixin_splat_too_many_args
1614
+ assert_warning(<<WARNING) {render <<SCSS}
1615
+ WARNING: Mixin foo takes 2 arguments but 4 were passed.
1616
+ on line 2 of #{filename_for_test(:scss)}
1617
+ This will be an error in future versions of Sass.
1618
+ WARNING
1619
+ @mixin foo($a, $b) {}
1620
+ @include foo((1, 2, 3, 4)...);
1621
+ SCSS
1622
+ end
1623
+
1512
1624
  def test_function_var_args
1513
1625
  assert_equal <<CSS, render(<<SCSS)
1514
1626
  .foo {
@@ -1930,6 +2042,17 @@ MESSAGE
1930
2042
  SCSS
1931
2043
  end
1932
2044
 
2045
+ def test_function_splat_too_many_args
2046
+ assert_warning(<<WARNING) {render <<SCSS}
2047
+ WARNING: Function foo takes 2 arguments but 4 were passed.
2048
+ on line 2 of #{filename_for_test(:scss)}
2049
+ This will be an error in future versions of Sass.
2050
+ WARNING
2051
+ @function foo($a, $b) {@return null}
2052
+ $var: foo((1, 2, 3, 4)...);
2053
+ SCSS
2054
+ end
2055
+
1933
2056
  ## Interpolation
1934
2057
 
1935
2058
  def test_basic_selector_interpolation
@@ -2051,7 +2174,7 @@ SCSS
2051
2174
  end
2052
2175
 
2053
2176
  def test_selector_interpolation_in_reference_combinator
2054
- assert_equal <<CSS, render(<<SCSS)
2177
+ silence_warnings {assert_equal <<CSS, render(<<SCSS)}
2055
2178
  .foo /a/ .bar /b|c/ .baz {
2056
2179
  a: b; }
2057
2180
  CSS
@@ -2184,14 +2307,14 @@ SCSS
2184
2307
 
2185
2308
  def test_supports_with_expressions
2186
2309
  assert_equal <<CSS, render(<<SCSS)
2187
- @supports (feature1: val) and (feature2: val) or (not (feature23: val4)) {
2310
+ @supports ((feature1: val) and (feature2: val)) or (not (feature23: val4)) {
2188
2311
  foo {
2189
2312
  a: b; } }
2190
2313
  CSS
2191
2314
  $query: "(feature1: val)";
2192
2315
  $feature: feature2;
2193
2316
  $val: val;
2194
- @supports \#{$query} and ($feature: $val) or (not ($feature + 3: $val + 4)) {
2317
+ @supports (\#{$query} and ($feature: $val)) or (not ($feature + 3: $val + 4)) {
2195
2318
  foo {a: b}
2196
2319
  }
2197
2320
  SCSS
@@ -3528,6 +3651,131 @@ SCSS
3528
3651
 
3529
3652
  # Regression
3530
3653
 
3654
+ # Regression test for #2031.
3655
+ def test_no_interpolation_warning_in_nested_selector
3656
+ assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
3657
+ z a:b(n+1) {
3658
+ x: y; }
3659
+ CSS
3660
+ z {
3661
+ a:b(n+\#{1}) {
3662
+ x: y;
3663
+ }
3664
+ }
3665
+ SCSS
3666
+ end
3667
+
3668
+ # Ensures that the fix for #2031 doesn't hide legitimate warnings.
3669
+ def test_interpolation_warning_in_selector_like_property
3670
+ assert_warning(<<WARNING) {assert_equal(<<CSS, render(<<SCSS))}
3671
+ DEPRECATION WARNING on line 2 of #{filename_for_test :scss}:
3672
+ \#{} interpolation near operators will be simplified in a future version of Sass.
3673
+ To preserve the current behavior, use quotes:
3674
+
3675
+ unquote("n+1")
3676
+
3677
+ You can use the sass-convert command to automatically fix most cases.
3678
+ WARNING
3679
+ z {
3680
+ a: b(n+1); }
3681
+ CSS
3682
+ z {
3683
+ a:b(n+\#{1});
3684
+ }
3685
+ SCSS
3686
+ end
3687
+
3688
+ def test_escape_in_selector
3689
+ assert_equal(<<CSS, render(".\\!foo {a: b}"))
3690
+ .\\!foo {
3691
+ a: b; }
3692
+ CSS
3693
+ end
3694
+
3695
+ def test_for_directive_with_float_bounds
3696
+ assert_equal(<<CSS, render(<<SCSS))
3697
+ .a {
3698
+ b: 0;
3699
+ b: 1;
3700
+ b: 2;
3701
+ b: 3;
3702
+ b: 4;
3703
+ b: 5; }
3704
+ CSS
3705
+ .a {
3706
+ @for $i from 0.0 through 5.0 {b: $i}
3707
+ }
3708
+ SCSS
3709
+
3710
+ assert_raise_message(Sass::SyntaxError, "0.5 is not an integer.") {render(<<SCSS)}
3711
+ .a {
3712
+ @for $i from 0.5 through 5.0 {b: $i}
3713
+ }
3714
+ SCSS
3715
+
3716
+ assert_raise_message(Sass::SyntaxError, "5.5 is not an integer.") {render(<<SCSS)}
3717
+ .a {
3718
+ @for $i from 0.0 through 5.5 {b: $i}
3719
+ }
3720
+ SCSS
3721
+ end
3722
+
3723
+ def test_parent_selector_in_function_pseudo_selector
3724
+ assert_equal <<CSS, render(<<SCSS)
3725
+ .bar:not(.foo) {
3726
+ a: b; }
3727
+
3728
+ .qux:nth-child(2n of .baz .bang) {
3729
+ c: d; }
3730
+ CSS
3731
+ .foo {
3732
+ .bar:not(&) {a: b}
3733
+ }
3734
+
3735
+ .baz .bang {
3736
+ .qux:nth-child(2n of &) {c: d}
3737
+ }
3738
+ SCSS
3739
+ end
3740
+
3741
+ def test_parent_selector_in_and_out_of_function_pseudo_selector
3742
+ # Regression test for https://github.com/sass/sass/issues/1464#issuecomment-70352288
3743
+ assert_equal(<<CSS, render(<<SCSS))
3744
+ .a:not(.a-b) {
3745
+ x: y; }
3746
+ CSS
3747
+ .a {
3748
+ &:not(&-b) {
3749
+ x: y;
3750
+ }
3751
+ }
3752
+ SCSS
3753
+
3754
+ assert_equal(<<CSS, render(<<SCSS))
3755
+ .a:nth-child(2n of .a-b) {
3756
+ x: y; }
3757
+ CSS
3758
+ .a {
3759
+ &:nth-child(2n of &-b) {
3760
+ x: y;
3761
+ }
3762
+ }
3763
+ SCSS
3764
+ end
3765
+
3766
+ def test_attribute_selector_in_selector_pseudoclass
3767
+ # Even though this is plain CSS, it only failed when given to the SCSS
3768
+ # parser.
3769
+ assert_equal(<<CSS, render(<<SCSS))
3770
+ [href^='http://'] {
3771
+ color: red; }
3772
+ CSS
3773
+ [href^='http://'] {
3774
+ color: red;
3775
+ }
3776
+ SCSS
3777
+ end
3778
+
3531
3779
  def test_top_level_unknown_directive_in_at_root
3532
3780
  assert_equal(<<CSS, render(<<SCSS))
3533
3781
  @fblthp {
@@ -3612,7 +3860,19 @@ SCSS
3612
3860
  end
3613
3861
 
3614
3862
  def test_reference_combinator_with_parent_ref
3615
- assert_equal <<CSS, render(<<SCSS)
3863
+ silence_warnings {assert_equal <<CSS, render(<<SCSS)}
3864
+ a /foo/ b {
3865
+ c: d; }
3866
+ CSS
3867
+ a {& /foo/ b {c: d}}
3868
+ SCSS
3869
+ end
3870
+
3871
+ def test_reference_combinator_warning
3872
+ assert_warning(<<WARNING) {assert_equal <<CSS, render(<<SCSS)}
3873
+ DEPRECATION WARNING on line 1, column 8 of test_reference_combinator_warning_inline.scss:
3874
+ The reference combinator /foo/ is deprecated and will be removed in a future release.
3875
+ WARNING
3616
3876
  a /foo/ b {
3617
3877
  c: d; }
3618
3878
  CSS
@@ -3722,6 +3982,22 @@ CSS
3722
3982
  SCSS
3723
3983
  end
3724
3984
 
3985
+ def test_keyword_arg_scope
3986
+ assert_equal <<CSS, render(<<SCSS)
3987
+ .mixed {
3988
+ arg1: default;
3989
+ arg2: non-default; }
3990
+ CSS
3991
+ $arg1: default;
3992
+ $arg2: default;
3993
+ @mixin a-mixin($arg1: $arg1, $arg2: $arg2) {
3994
+ arg1: $arg1;
3995
+ arg2: $arg2;
3996
+ }
3997
+ .mixed { @include a-mixin($arg2: non-default); }
3998
+ SCSS
3999
+ end
4000
+
3725
4001
  def test_passing_required_args_as_a_keyword_arg
3726
4002
  assert_equal <<CSS, render(<<SCSS)
3727
4003
  .mixed {
@@ -3897,4 +4173,33 @@ CSS
3897
4173
  }
3898
4174
  SCSS
3899
4175
  end
4176
+
4177
+ def test_import_with_supports_clause_interp
4178
+ assert_equal(<<CSS, render(<<'SASS', :style => :compressed))
4179
+ @import url("fallback-layout.css") supports(not (display: flex))
4180
+ CSS
4181
+ $display-type: flex;
4182
+ @import url("fallback-layout.css") supports(not (display: #{$display-type}));
4183
+ SASS
4184
+ end
4185
+
4186
+ def test_import_with_supports_clause
4187
+ assert_equal(<<CSS, render(<<SASS, :style => :compressed))
4188
+ @import url("fallback-layout.css") supports(not (display: flex));.foo{bar:baz}
4189
+ CSS
4190
+ @import url("fallback-layout.css") supports(not (display: flex));
4191
+ .foo { bar: baz; }
4192
+ SASS
4193
+ end
4194
+
4195
+ def test_crlf
4196
+ # Attempt to reproduce https://github.com/sass/sass/issues/1985
4197
+ assert_equal(<<CSS, render(<<SCSS))
4198
+ p {
4199
+ margin: 0; }
4200
+ CSS
4201
+ p {\r\n margin: 0;\r\n}
4202
+ SCSS
4203
+ end
4204
+
3900
4205
  end