sass 3.4.25 → 3.5.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +13 -157
  5. data/VERSION +1 -1
  6. data/VERSION_DATE +1 -1
  7. data/VERSION_NAME +1 -1
  8. data/lib/sass.rb +3 -10
  9. data/lib/sass/cache_stores/filesystem.rb +1 -1
  10. data/lib/sass/css.rb +2 -3
  11. data/lib/sass/engine.rb +46 -32
  12. data/lib/sass/environment.rb +27 -6
  13. data/lib/sass/error.rb +5 -5
  14. data/lib/sass/exec/base.rb +3 -12
  15. data/lib/sass/features.rb +1 -0
  16. data/lib/sass/importers/filesystem.rb +2 -2
  17. data/lib/sass/plugin.rb +1 -1
  18. data/lib/sass/plugin/compiler.rb +21 -51
  19. data/lib/sass/plugin/configuration.rb +1 -1
  20. data/lib/sass/plugin/rack.rb +3 -3
  21. data/lib/sass/plugin/staleness_checker.rb +3 -3
  22. data/lib/sass/railtie.rb +1 -1
  23. data/lib/sass/script.rb +3 -3
  24. data/lib/sass/script/functions.rb +238 -47
  25. data/lib/sass/script/lexer.rb +8 -6
  26. data/lib/sass/script/parser.rb +76 -75
  27. data/lib/sass/script/tree/funcall.rb +35 -30
  28. data/lib/sass/script/tree/list_literal.rb +23 -8
  29. data/lib/sass/script/tree/map_literal.rb +2 -2
  30. data/lib/sass/script/tree/node.rb +2 -10
  31. data/lib/sass/script/tree/operation.rb +16 -50
  32. data/lib/sass/script/value.rb +2 -0
  33. data/lib/sass/script/value/arg_list.rb +1 -1
  34. data/lib/sass/script/value/base.rb +20 -3
  35. data/lib/sass/script/value/callable.rb +25 -0
  36. data/lib/sass/script/value/color.rb +10 -10
  37. data/lib/sass/script/value/function.rb +19 -0
  38. data/lib/sass/script/value/helpers.rb +16 -7
  39. data/lib/sass/script/value/list.rb +33 -12
  40. data/lib/sass/script/value/map.rb +2 -2
  41. data/lib/sass/script/value/number.rb +3 -3
  42. data/lib/sass/script/value/string.rb +12 -5
  43. data/lib/sass/scss/parser.rb +101 -45
  44. data/lib/sass/scss/rx.rb +5 -11
  45. data/lib/sass/scss/static_parser.rb +0 -7
  46. data/lib/sass/selector.rb +4 -0
  47. data/lib/sass/selector/abstract_sequence.rb +5 -5
  48. data/lib/sass/selector/comma_sequence.rb +3 -15
  49. data/lib/sass/selector/pseudo.rb +4 -0
  50. data/lib/sass/selector/sequence.rb +30 -3
  51. data/lib/sass/selector/simple.rb +13 -7
  52. data/lib/sass/selector/simple_sequence.rb +1 -1
  53. data/lib/sass/shared.rb +3 -5
  54. data/lib/sass/source/map.rb +4 -4
  55. data/lib/sass/source/position.rb +4 -4
  56. data/lib/sass/stack.rb +21 -1
  57. data/lib/sass/tree/charset_node.rb +1 -1
  58. data/lib/sass/tree/comment_node.rb +1 -1
  59. data/lib/sass/tree/node.rb +3 -3
  60. data/lib/sass/tree/prop_node.rb +46 -54
  61. data/lib/sass/tree/rule_node.rb +7 -15
  62. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  63. data/lib/sass/tree/visitors/convert.rb +2 -3
  64. data/lib/sass/tree/visitors/cssize.rb +1 -10
  65. data/lib/sass/tree/visitors/deep_copy.rb +2 -2
  66. data/lib/sass/tree/visitors/perform.rb +23 -12
  67. data/lib/sass/tree/visitors/set_options.rb +1 -1
  68. data/lib/sass/tree/visitors/to_css.rb +46 -12
  69. data/lib/sass/util.rb +16 -321
  70. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  71. data/lib/sass/util/normalized_map.rb +1 -8
  72. data/lib/sass/version.rb +2 -2
  73. data/test/sass-spec.yml +1 -1
  74. data/test/sass/compiler_test.rb +4 -14
  75. data/test/sass/conversion_test.rb +113 -162
  76. data/test/sass/css2sass_test.rb +17 -19
  77. data/test/sass/css_variable_test.rb +176 -70
  78. data/test/sass/encoding_test.rb +2 -32
  79. data/test/sass/engine_test.rb +114 -65
  80. data/test/sass/extend_test.rb +37 -51
  81. data/test/sass/functions_test.rb +57 -15
  82. data/test/sass/importer_test.rb +2 -2
  83. data/test/sass/more_templates/more1.sass +10 -10
  84. data/test/sass/more_templates/more_import.sass +2 -2
  85. data/test/sass/plugin_test.rb +9 -12
  86. data/test/sass/script_conversion_test.rb +9 -0
  87. data/test/sass/script_test.rb +38 -48
  88. data/test/sass/scss/css_test.rb +5 -19
  89. data/test/sass/scss/scss_test.rb +58 -39
  90. data/test/sass/source_map_test.rb +26 -28
  91. data/test/sass/templates/_partial.sass +1 -1
  92. data/test/sass/templates/basic.sass +10 -10
  93. data/test/sass/templates/bork1.sass +1 -1
  94. data/test/sass/templates/bork5.sass +1 -1
  95. data/test/sass/templates/compact.sass +10 -10
  96. data/test/sass/templates/complex.sass +187 -187
  97. data/test/sass/templates/compressed.sass +10 -10
  98. data/test/sass/templates/expanded.sass +10 -10
  99. data/test/sass/templates/import.sass +2 -2
  100. data/test/sass/templates/importee.sass +3 -3
  101. data/test/sass/templates/mixins.sass +22 -22
  102. data/test/sass/templates/multiline.sass +4 -4
  103. data/test/sass/templates/nested.sass +13 -13
  104. data/test/sass/templates/parent_ref.sass +12 -12
  105. data/test/sass/templates/script.sass +70 -70
  106. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  107. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  108. data/test/sass/templates/subdir/subdir.sass +3 -3
  109. data/test/sass/templates/units.sass +10 -10
  110. data/test/sass/util/multibyte_string_scanner_test.rb +139 -149
  111. data/test/sass/util_test.rb +0 -36
  112. data/test/test_helper.rb +39 -0
  113. metadata +30 -57
  114. data/extra/sass-spec-ref.sh +0 -32
  115. data/lib/sass/deprecation.rb +0 -55
  116. data/lib/sass/script/css_variable_warning.rb +0 -52
  117. data/lib/sass/util/cross_platform_random.rb +0 -19
  118. data/lib/sass/util/ordered_hash.rb +0 -192
  119. data/test/sass/results/import_charset_1_8.css +0 -5
  120. data/test/sass/templates/import_charset_1_8.sass +0 -6
  121. data/vendor/listen/CHANGELOG.md +0 -1
  122. data/vendor/listen/CONTRIBUTING.md +0 -38
  123. data/vendor/listen/Gemfile +0 -20
  124. data/vendor/listen/Guardfile +0 -8
  125. data/vendor/listen/LICENSE +0 -20
  126. data/vendor/listen/README.md +0 -349
  127. data/vendor/listen/Rakefile +0 -5
  128. data/vendor/listen/Vagrantfile +0 -96
  129. data/vendor/listen/lib/listen.rb +0 -54
  130. data/vendor/listen/lib/listen/adapter.rb +0 -327
  131. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  132. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  133. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  134. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  135. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  136. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  137. data/vendor/listen/lib/listen/listener.rb +0 -323
  138. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  139. data/vendor/listen/lib/listen/version.rb +0 -3
  140. data/vendor/listen/listen.gemspec +0 -28
  141. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  142. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  143. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  144. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  145. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  146. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  147. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  148. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  149. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  150. data/vendor/listen/spec/listen_spec.rb +0 -67
  151. data/vendor/listen/spec/spec_helper.rb +0 -25
  152. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  153. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  154. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  155. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  156. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -288,10 +288,10 @@ ERROR
288
288
  def test_exception_line
289
289
  to_render = <<SASS
290
290
  rule
291
- prop: val
291
+ :prop val
292
292
  // comment!
293
293
 
294
- broken:
294
+ :broken
295
295
  SASS
296
296
  begin
297
297
  Sass::Engine.new(to_render).render
@@ -305,10 +305,10 @@ SASS
305
305
  def test_exception_location
306
306
  to_render = <<SASS
307
307
  rule
308
- prop: val
308
+ :prop val
309
309
  // comment!
310
310
 
311
- broken:
311
+ :broken
312
312
  SASS
313
313
  begin
314
314
  Sass::Engine.new(to_render, :filename => FAKE_FILE_NAME, :line => (__LINE__-7)).render
@@ -749,22 +749,22 @@ SASS
749
749
 
750
750
  def test_basic_multiline_selector
751
751
  assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
752
- render("#foo #bar,\n#baz #boom\n foo: bar"))
752
+ render("#foo #bar,\n#baz #boom\n :foo bar"))
753
753
  assert_equal("#foo #bar,\n#foo #baz {\n foo: bar; }\n",
754
- render("#foo\n #bar,\n #baz\n foo: bar"))
754
+ render("#foo\n #bar,\n #baz\n :foo bar"))
755
755
  assert_equal("#foo,\n#bar {\n foo: bar; }\n #foo #baz,\n #bar #baz {\n foo: bar; }\n",
756
- render("#foo,\n#bar\n foo: bar\n #baz\n foo: bar"))
756
+ render("#foo,\n#bar\n :foo bar\n #baz\n :foo bar"))
757
757
  assert_equal("#foo #bar, #baz #boom { foo: bar; }\n",
758
- render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compact))
758
+ render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compact))
759
759
 
760
760
  assert_equal("#foo #bar,#baz #boom{foo:bar}\n",
761
- render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compressed))
761
+ render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compressed))
762
762
 
763
763
  assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
764
- render("#foo #bar,,\n,#baz #boom,\n foo: bar"))
764
+ render("#foo #bar,,\n,#baz #boom,\n :foo bar"))
765
765
 
766
766
  assert_equal("#bip #bop {\n foo: bar; }\n",
767
- render("#bip #bop,, ,\n foo: bar"))
767
+ render("#bip #bop,, ,\n :foo bar"))
768
768
  end
769
769
 
770
770
  def test_complex_multiline_selector
@@ -783,7 +783,7 @@ SASS
783
783
  end
784
784
 
785
785
  begin
786
- silence_warnings {render("a\n :b c", :property_syntax => :new)}
786
+ render("a\n :b c", :property_syntax => :new)
787
787
  assert_equal(2, e.sass_line)
788
788
  rescue Sass::SyntaxError => e
789
789
  assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
@@ -806,53 +806,53 @@ SASS
806
806
  def test_directive
807
807
  assert_equal("@a b;\n", render("@a b"))
808
808
 
809
- assert_equal("@a {\n b: c; }\n", render("@a\n b: c"))
810
- assert_equal("@a { b: c; }\n", render("@a\n b: c", :style => :compact))
811
- assert_equal("@a {\n b: c;\n}\n", render("@a\n b: c", :style => :expanded))
812
- assert_equal("@a{b:c}\n", render("@a\n b: c", :style => :compressed))
809
+ assert_equal("@a {\n b: c; }\n", render("@a\n :b c"))
810
+ assert_equal("@a { b: c; }\n", render("@a\n :b c", :style => :compact))
811
+ assert_equal("@a {\n b: c;\n}\n", render("@a\n :b c", :style => :expanded))
812
+ assert_equal("@a{b:c}\n", render("@a\n :b c", :style => :compressed))
813
813
 
814
814
  assert_equal("@a {\n b: c;\n d: e; }\n",
815
- render("@a\n b: c\n d: e"))
815
+ render("@a\n :b c\n :d e"))
816
816
  assert_equal("@a { b: c; d: e; }\n",
817
- render("@a\n b: c\n d: e", :style => :compact))
817
+ render("@a\n :b c\n :d e", :style => :compact))
818
818
  assert_equal("@a {\n b: c;\n d: e;\n}\n",
819
- render("@a\n b: c\n d: e", :style => :expanded))
819
+ render("@a\n :b c\n :d e", :style => :expanded))
820
820
  assert_equal("@a{b:c;d:e}\n",
821
- render("@a\n b: c\n d: e", :style => :compressed))
821
+ render("@a\n :b c\n :d e", :style => :compressed))
822
822
 
823
823
  assert_equal("@a {\n #b {\n c: d; } }\n",
824
- render("@a\n #b\n c: d"))
824
+ render("@a\n #b\n :c d"))
825
825
  assert_equal("@a { #b { c: d; } }\n",
826
- render("@a\n #b\n c: d", :style => :compact))
826
+ render("@a\n #b\n :c d", :style => :compact))
827
827
  assert_equal("@a {\n #b {\n c: d;\n }\n}\n",
828
- render("@a\n #b\n c: d", :style => :expanded))
828
+ render("@a\n #b\n :c d", :style => :expanded))
829
829
  assert_equal("@a{#b{c:d}}\n",
830
- render("@a\n #b\n c: d", :style => :compressed))
830
+ render("@a\n #b\n :c d", :style => :compressed))
831
831
 
832
832
  assert_equal("@a {\n #b {\n a: b; }\n #b #c {\n d: e; } }\n",
833
- render("@a\n #b\n a: b\n #c\n d: e"))
833
+ render("@a\n #b\n :a b\n #c\n :d e"))
834
834
  assert_equal("@a { #b { a: b; }\n #b #c { d: e; } }\n",
835
- render("@a\n #b\n a: b\n #c\n d: e", :style => :compact))
835
+ render("@a\n #b\n :a b\n #c\n :d e", :style => :compact))
836
836
  assert_equal("@a {\n #b {\n a: b;\n }\n #b #c {\n d: e;\n }\n}\n",
837
- render("@a\n #b\n a: b\n #c\n d: e", :style => :expanded))
837
+ render("@a\n #b\n :a b\n #c\n :d e", :style => :expanded))
838
838
  assert_equal("@a{#b{a:b}#b #c{d:e}}\n",
839
- render("@a\n #b\n a: b\n #c\n d: e", :style => :compressed))
839
+ render("@a\n #b\n :a b\n #c\n :d e", :style => :compressed))
840
840
 
841
841
  assert_equal("@a {\n #foo,\n #bar {\n b: c; } }\n",
842
- render("@a\n #foo, \n #bar\n b: c"))
842
+ render("@a\n #foo, \n #bar\n :b c"))
843
843
  assert_equal("@a { #foo, #bar { b: c; } }\n",
844
- render("@a\n #foo, \n #bar\n b: c", :style => :compact))
844
+ render("@a\n #foo, \n #bar\n :b c", :style => :compact))
845
845
  assert_equal("@a {\n #foo,\n #bar {\n b: c;\n }\n}\n",
846
- render("@a\n #foo, \n #bar\n b: c", :style => :expanded))
846
+ render("@a\n #foo, \n #bar\n :b c", :style => :expanded))
847
847
  assert_equal("@a{#foo,#bar{b:c}}\n",
848
- render("@a\n #foo, \n #bar\n b: c", :style => :compressed))
848
+ render("@a\n #foo, \n #bar\n :b c", :style => :compressed))
849
849
 
850
850
  to_render = <<END
851
851
  @a
852
- b: c
852
+ :b c
853
853
  #d
854
- e: f
855
- g: h
854
+ :e f
855
+ :g h
856
856
  END
857
857
  rendered = <<END
858
858
  @a { b: c;
@@ -1141,7 +1141,7 @@ black {
1141
1141
  color: #000; }
1142
1142
  CSS
1143
1143
  =foo($a: #FFF)
1144
- color: $a
1144
+ :color $a
1145
1145
  white
1146
1146
  +foo
1147
1147
  black
@@ -1165,9 +1165,9 @@ three {
1165
1165
  CSS
1166
1166
  $a: 5px
1167
1167
  =foo($a, $b: 1px, $c: 3px + $b)
1168
- color: $a
1169
- padding: $b
1170
- margin: $c
1168
+ :color $a
1169
+ :padding $b
1170
+ :margin $c
1171
1171
  one
1172
1172
  +foo(#fff)
1173
1173
  two
@@ -2598,29 +2598,29 @@ SASS
2598
2598
  border-style: solid; }
2599
2599
  RESULT
2600
2600
  .box
2601
- border:
2602
- //color: black
2603
- style: solid
2601
+ :border
2602
+ //:color black
2603
+ :style solid
2604
2604
  SOURCE
2605
2605
 
2606
2606
  assert_equal(<<RESULT, render(<<SOURCE))
2607
2607
  .box {
2608
- /* color: black */
2608
+ /* :color black */
2609
2609
  border-style: solid; }
2610
2610
  RESULT
2611
2611
  .box
2612
- border:
2613
- /* color: black
2614
- style: solid
2612
+ :border
2613
+ /* :color black
2614
+ :style solid
2615
2615
  SOURCE
2616
2616
 
2617
2617
  assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
2618
2618
  .box{border-style:solid}
2619
2619
  RESULT
2620
2620
  .box
2621
- border:
2622
- /*color: black
2623
- style: solid
2621
+ :border
2622
+ /*:color black
2623
+ :style solid
2624
2624
  SOURCE
2625
2625
  end
2626
2626
 
@@ -2700,15 +2700,6 @@ a
2700
2700
  SASS
2701
2701
  end
2702
2702
 
2703
- def test_mixin_no_arg_error
2704
- assert_raise_message(Sass::SyntaxError, 'Invalid CSS after "($bar,": expected variable (e.g. $foo), was ")"') do
2705
- render(<<SASS)
2706
- =foo($bar,)
2707
- bip: bap
2708
- SASS
2709
- end
2710
- end
2711
-
2712
2703
  def test_import_with_commas_in_url
2713
2704
  assert_equal <<CSS, render(<<SASS)
2714
2705
  @import url(foo.css?bar,baz);
@@ -3391,16 +3382,74 @@ CSS
3391
3382
  SASS
3392
3383
  end
3393
3384
 
3385
+ def test_trailing_commas_in_arglists
3386
+ assert_equal(<<CSS, render(<<SASS, :style => :nested))
3387
+ .includes {
3388
+ one-positional-arg: positional 1 a;
3389
+ two-positional-args: positional 2 a b;
3390
+ one-keyword-arg: keyword 1 z;
3391
+ two-keyword-args: keyword 2 y z;
3392
+ mixed-args: mixed 2 y z; }
3393
+
3394
+ .calls {
3395
+ one-positional-arg: positional 1 a;
3396
+ two-positional-args: positional 2 a b;
3397
+ one-keyword-arg: keyword 1 z;
3398
+ two-keyword-args: keyword 2 y z;
3399
+ mixed-args: mixed 2 y z; }
3400
+ CSS
3401
+ =one-positional-arg($a,)
3402
+ one-positional-arg: positional 1 $a
3403
+
3404
+ =two-positional-args($a, $b,)
3405
+ two-positional-args: positional 2 $a $b
3406
+
3407
+ =one-keyword-arg($a: a,)
3408
+ one-keyword-arg: keyword 1 $a
3409
+
3410
+ =two-keyword-args($a: a, $b: b,)
3411
+ two-keyword-args: keyword 2 $a $b
3412
+
3413
+ =mixed-args($a, $b: b,)
3414
+ mixed-args: mixed 2 $a $b
3415
+
3416
+ @function one-positional-arg($a)
3417
+ @return positional 1 $a
3418
+
3419
+ @function two-positional-args($a, $b)
3420
+ @return positional 2 $a $b
3421
+
3422
+ @function one-keyword-arg($a: a)
3423
+ @return keyword 1 $a
3424
+
3425
+ @function two-keyword-args($a: a, $b: b)
3426
+ @return keyword 2 $a $b
3427
+
3428
+ @function mixed-args($a, $b: b)
3429
+ @return mixed 2 $a $b
3430
+
3431
+
3432
+ .includes
3433
+ +one-positional-arg(a,)
3434
+ +two-positional-args(a, b,)
3435
+ +one-keyword-arg($a: z,)
3436
+ +two-keyword-args($a: y, $b: z,)
3437
+ +mixed-args(y, $b: z,)
3438
+
3439
+
3440
+ .calls
3441
+ one-positional-arg: one-positional-arg(a)
3442
+ two-positional-args: two-positional-args(a, b)
3443
+ one-keyword-arg: one-keyword-arg($a: z)
3444
+ two-keyword-args: two-keyword-args($a: y, $b: z)
3445
+ mixed-args: mixed-args(y, $b: z)
3446
+ SASS
3447
+ end
3448
+
3394
3449
  private
3395
3450
 
3396
3451
  def assert_hash_has(hash, expected)
3397
- expected.each do |k, v|
3398
- if v.nil?
3399
- assert_nil(hash[k])
3400
- else
3401
- assert_equal(v, hash[k])
3402
- end
3403
- end
3452
+ expected.each {|k, v| assert_equal(v, hash[k])}
3404
3453
  end
3405
3454
 
3406
3455
  def assert_renders_encoded(css, sass)
@@ -167,52 +167,42 @@ SCSS
167
167
  end
168
168
 
169
169
  def test_universal_unification_with_namespaceless_universal_target
170
- assert_extend_doesnt_match('ns|*', '.foo', :failed_to_unify, 2) do
171
- render_unification '*.foo', 'ns|* {@extend .foo}'
172
- end
173
-
174
170
  assert_unification '*.foo', '* {@extend .foo}', '*'
175
171
  assert_unification '*.foo', '*|* {@extend .foo}', '*'
176
172
  assert_unification '*|*.foo', '* {@extend .foo}', '*|*.foo, *'
177
173
  assert_unification '*|*.foo', '*|* {@extend .foo}', '*|*'
174
+ assert_unification '*.foo', 'ns|* {@extend .foo}', '*.foo, ns|*'
178
175
  assert_unification '*|*.foo', 'ns|* {@extend .foo}', '*|*.foo, ns|*'
179
176
  end
180
177
 
181
178
  def test_universal_unification_with_namespaced_universal_target
182
- assert_extend_doesnt_match('*', '.foo', :failed_to_unify, 2) do
183
- render_unification 'ns|*.foo', '* {@extend .foo}'
184
- end
179
+ assert_unification 'ns|*.foo', '* {@extend .foo}', 'ns|*'
180
+ assert_unification 'ns|*.foo', '*|* {@extend .foo}', 'ns|*'
185
181
 
186
182
  assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
187
183
  render_unification 'ns1|*.foo', 'ns2|* {@extend .foo}'
188
184
  end
189
185
 
190
- assert_unification 'ns|*.foo', '*|* {@extend .foo}', 'ns|*'
191
186
  assert_unification 'ns|*.foo', 'ns|* {@extend .foo}', 'ns|*'
192
187
  end
193
188
 
194
189
  def test_universal_unification_with_namespaceless_element_target
195
- assert_extend_doesnt_match('ns|*', '.foo', :failed_to_unify, 2) do
196
- render_unification 'a.foo', 'ns|* {@extend .foo}'
197
- end
198
-
199
190
  assert_unification 'a.foo', '* {@extend .foo}', 'a'
200
191
  assert_unification 'a.foo', '*|* {@extend .foo}', 'a'
201
192
  assert_unification '*|a.foo', '* {@extend .foo}', '*|a.foo, a'
202
193
  assert_unification '*|a.foo', '*|* {@extend .foo}', '*|a'
194
+ assert_unification 'a.foo', 'ns|* {@extend .foo}', 'a.foo, ns|a'
203
195
  assert_unification '*|a.foo', 'ns|* {@extend .foo}', '*|a.foo, ns|a'
204
196
  end
205
197
 
206
198
  def test_universal_unification_with_namespaced_element_target
207
- assert_extend_doesnt_match('*', '.foo', :failed_to_unify, 2) do
208
- render_unification 'ns|a.foo', '* {@extend .foo}'
209
- end
199
+ assert_unification 'ns|a.foo', '* {@extend .foo}', 'ns|a'
200
+ assert_unification 'ns|a.foo', '*|* {@extend .foo}', 'ns|a'
210
201
 
211
202
  assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
212
203
  render_unification 'ns1|a.foo', 'ns2|* {@extend .foo}'
213
204
  end
214
205
 
215
- assert_unification 'ns|a.foo', '*|* {@extend .foo}', 'ns|a'
216
206
  assert_unification 'ns|a.foo', 'ns|* {@extend .foo}', 'ns|a'
217
207
  end
218
208
 
@@ -224,56 +214,46 @@ SCSS
224
214
  end
225
215
 
226
216
  def test_element_unification_with_namespaceless_universal_target
227
- assert_extend_doesnt_match('ns|a', '.foo', :failed_to_unify, 2) do
228
- render_unification '*.foo', 'ns|a {@extend .foo}'
229
- end
230
-
231
217
  assert_unification '*.foo', 'a {@extend .foo}', '*.foo, a'
232
218
  assert_unification '*.foo', '*|a {@extend .foo}', '*.foo, a'
233
219
  assert_unification '*|*.foo', 'a {@extend .foo}', '*|*.foo, a'
234
220
  assert_unification '*|*.foo', '*|a {@extend .foo}', '*|*.foo, *|a'
221
+ assert_unification '*.foo', 'ns|a {@extend .foo}', '*.foo, ns|a'
235
222
  assert_unification '*|*.foo', 'ns|a {@extend .foo}', '*|*.foo, ns|a'
236
223
  end
237
224
 
238
225
  def test_element_unification_with_namespaced_universal_target
239
- assert_extend_doesnt_match('a', '.foo', :failed_to_unify, 2) do
240
- render_unification 'ns|*.foo', 'a {@extend .foo}'
241
- end
226
+ assert_unification 'ns|*.foo', 'a {@extend .foo}', 'ns|*.foo, ns|a'
227
+ assert_unification 'ns|*.foo', '*|a {@extend .foo}', 'ns|*.foo, ns|a'
242
228
 
243
229
  assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
244
230
  render_unification 'ns1|*.foo', 'ns2|a {@extend .foo}'
245
231
  end
246
232
 
247
- assert_unification 'ns|*.foo', '*|a {@extend .foo}', 'ns|*.foo, ns|a'
248
233
  assert_unification 'ns|*.foo', 'ns|a {@extend .foo}', 'ns|*.foo, ns|a'
249
234
  end
250
235
 
251
236
  def test_element_unification_with_namespaceless_element_target
252
- assert_extend_doesnt_match('ns|a', '.foo', :failed_to_unify, 2) do
253
- render_unification 'a.foo', 'ns|a {@extend .foo}'
254
- end
255
-
256
- assert_extend_doesnt_match('h1', '.foo', :failed_to_unify, 2) do
257
- render_unification 'a.foo', 'h1 {@extend .foo}'
258
- end
259
-
260
237
  assert_unification 'a.foo', 'a {@extend .foo}', 'a'
261
238
  assert_unification 'a.foo', '*|a {@extend .foo}', 'a'
262
239
  assert_unification '*|a.foo', 'a {@extend .foo}', '*|a.foo, a'
263
240
  assert_unification '*|a.foo', '*|a {@extend .foo}', '*|a'
241
+ assert_unification 'a.foo', 'ns|a {@extend .foo}', 'a.foo, ns|a'
264
242
  assert_unification '*|a.foo', 'ns|a {@extend .foo}', '*|a.foo, ns|a'
243
+
244
+ assert_extend_doesnt_match('h1', '.foo', :failed_to_unify, 2) do
245
+ render_unification 'a.foo', 'h1 {@extend .foo}'
246
+ end
265
247
  end
266
248
 
267
249
  def test_element_unification_with_namespaced_element_target
268
- assert_extend_doesnt_match('a', '.foo', :failed_to_unify, 2) do
269
- render_unification 'ns|a.foo', 'a {@extend .foo}'
270
- end
250
+ assert_unification 'ns|a.foo', 'a {@extend .foo}', 'ns|a'
251
+ assert_unification 'ns|a.foo', '*|a {@extend .foo}', 'ns|a'
271
252
 
272
253
  assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
273
254
  render_unification 'ns1|a.foo', 'ns2|a {@extend .foo}'
274
255
  end
275
256
 
276
- assert_unification 'ns|a.foo', '*|a {@extend .foo}', 'ns|a'
277
257
  assert_unification 'ns|a.foo', 'ns|a {@extend .foo}', 'ns|a'
278
258
  end
279
259
 
@@ -315,6 +295,18 @@ SCSS
315
295
  assert_extends 'a.foo:bar', '.baz {@extend .foo}', 'a.foo:bar, a.baz:bar'
316
296
  end
317
297
 
298
+ def test_id_unification_again
299
+ assert_unification('#id.foo .bar', '#id.baz .qux {@extend .bar}',
300
+ '#id.foo .bar, #id.baz.foo .qux')
301
+ end
302
+
303
+ def test_root_unification
304
+ assert_extends(
305
+ ".foo:root .bar",
306
+ ".baz:root .qux {@extend .bar}",
307
+ ".foo:root .bar, .baz.foo:root .qux")
308
+ end
309
+
318
310
  def test_not_remains_at_end_of_selector
319
311
  assert_extends '.foo:not(.bar)', '.baz {@extend .foo}', '.foo:not(.bar), .baz:not(.bar)'
320
312
  end
@@ -573,27 +565,21 @@ SCSS
573
565
  ## Long Extendees
574
566
 
575
567
  def test_long_extendee
576
- assert_warning(<<WARNING) {assert_extends '.foo.bar', '.baz {@extend .foo.bar}', '.foo.bar, .baz'}
577
- DEPRECATION WARNING on line 2 of test_long_extendee_inline.scss:
578
- Extending a compound selector, .foo.bar, is deprecated and will not be supported in a future release.
579
- See https://github.com/sass/sass/issues/1599 for details.
580
- WARNING
568
+ assert_extends '.foo.bar', '.baz {@extend .foo.bar}', '.foo.bar, .baz'
581
569
  end
582
570
 
583
571
  def test_long_extendee_requires_all_selectors
584
- silence_warnings do
585
- assert_extend_doesnt_match('.baz', '.foo.bar', :not_found, 2) do
586
- render_extends '.foo', '.baz {@extend .foo.bar}'
587
- end
572
+ assert_extend_doesnt_match('.baz', '.foo.bar', :not_found, 2) do
573
+ render_extends '.foo', '.baz {@extend .foo.bar}'
588
574
  end
589
575
  end
590
576
 
591
577
  def test_long_extendee_matches_supersets
592
- silence_warnings {assert_extends '.foo.bar.bap', '.baz {@extend .foo.bar}', '.foo.bar.bap, .bap.baz'}
578
+ assert_extends '.foo.bar.bap', '.baz {@extend .foo.bar}', '.foo.bar.bap, .bap.baz'
593
579
  end
594
580
 
595
581
  def test_long_extendee_runs_unification
596
- silence_warnings {assert_extends 'ns|*.foo.bar', '*|a.baz {@extend .foo.bar}', 'ns|*.foo.bar, ns|a.baz'}
582
+ assert_extends 'ns|*.foo.bar', 'a.baz {@extend .foo.bar}', 'ns|*.foo.bar, ns|a.baz'
597
583
  end
598
584
 
599
585
  ## Long Extenders
@@ -603,7 +589,7 @@ WARNING
603
589
  end
604
590
 
605
591
  def test_long_extender_runs_unification
606
- assert_extends 'ns|*.foo.bar', '*|a.baz {@extend .foo}', 'ns|*.foo.bar, ns|a.bar.baz'
592
+ assert_extends 'ns|*.foo.bar', 'a.baz {@extend .foo}', 'ns|*.foo.bar, ns|a.bar.baz'
607
593
  end
608
594
 
609
595
  def test_long_extender_aborts_unification
@@ -689,9 +675,9 @@ WARNING
689
675
  end
690
676
 
691
677
  def test_nested_extender_doesnt_find_common_selectors_around_reference_selector
692
- silence_warnings {assert_extends 'a /for/ b c .c1', 'a c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b a c .c2, a a /for/ b c .c2'}
693
- silence_warnings {assert_extends 'a /for/ b c .c1', 'a b .c2 {@extend .c1}', 'a /for/ b c .c1, a a /for/ b c .c2'}
694
- silence_warnings {assert_extends 'a /for/ b c .c1', 'b c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b c .c2'}
678
+ assert_extends 'a /for/ b c .c1', 'a c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b a c .c2, a a /for/ b c .c2'
679
+ assert_extends 'a /for/ b c .c1', 'a b .c2 {@extend .c1}', 'a /for/ b c .c1, a a /for/ b c .c2'
680
+ assert_extends 'a /for/ b c .c1', 'b c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b c .c2'
695
681
  end
696
682
 
697
683
  def test_nested_extender_with_early_child_selectors_doesnt_subseq_them