haml-edge 2.3.217 → 2.3.218

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.217
1
+ 2.3.218
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.217
1
+ 2.3.218
@@ -75,10 +75,15 @@ module Sass
75
75
  # this exception will only ever be raised as a result of programmer error
76
76
  def unify(sels)
77
77
  return sels if sels.any? {|sel2| eql?(sel2)}
78
- if sels.last.is_a?(Pseudo) && sels.last.type == :element
79
- return sels[0...-1] + [self, sels.last]
80
- end
81
- sels + [self]
78
+ sels_with_ix = Haml::Util.enum_with_index(sels)
79
+ _, i =
80
+ if self.is_a?(Pseudo) || self.is_a?(Negation)
81
+ sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && sels.last.type == :element}
82
+ else
83
+ sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) || sel.is_a?(Negation)}
84
+ end
85
+ return sels + [self] unless i
86
+ return sels[0...i] + [self] + sels[i..-1]
82
87
  end
83
88
 
84
89
  protected
@@ -770,6 +770,70 @@ a.foo::bar {a: b}
770
770
  SCSS
771
771
  end
772
772
 
773
+ def test_pseudoclass_remains_at_end_of_selector
774
+ assert_equal <<CSS, render(<<SCSS)
775
+ .foo:bar, .baz:bar {
776
+ a: b; }
777
+ CSS
778
+ .foo:bar {a: b}
779
+ .baz {@extend .foo}
780
+ SCSS
781
+
782
+ assert_equal <<CSS, render(<<SCSS)
783
+ a.foo:bar, a.baz:bar {
784
+ a: b; }
785
+ CSS
786
+ a.foo:bar {a: b}
787
+ .baz {@extend .foo}
788
+ SCSS
789
+ end
790
+
791
+ def test_not_remains_at_end_of_selector
792
+ assert_equal <<CSS, render(<<SCSS)
793
+ .foo:not(.bar), .baz:not(.bar) {
794
+ a: b; }
795
+ CSS
796
+ .foo:not(.bar) {a: b}
797
+ .baz {@extend .foo}
798
+ SCSS
799
+ end
800
+
801
+ def test_pseudoelement_goes_lefter_than_pseudoclass
802
+ assert_equal <<CSS, render(<<SCSS)
803
+ .foo::bar, .baz:bang::bar {
804
+ a: b; }
805
+ CSS
806
+ .foo::bar {a: b}
807
+ .baz:bang {@extend .foo}
808
+ SCSS
809
+
810
+ assert_equal <<CSS, render(<<SCSS)
811
+ .foo:bar, .baz:bar::bang {
812
+ a: b; }
813
+ CSS
814
+ .foo:bar {a: b}
815
+ .baz::bang {@extend .foo}
816
+ SCSS
817
+ end
818
+
819
+ def test_pseudoelement_goes_lefter_than_not
820
+ assert_equal <<CSS, render(<<SCSS)
821
+ .foo::bar, .baz:not(.bang)::bar {
822
+ a: b; }
823
+ CSS
824
+ .foo::bar {a: b}
825
+ .baz:not(.bang) {@extend .foo}
826
+ SCSS
827
+
828
+ assert_equal <<CSS, render(<<SCSS)
829
+ .foo:not(.bang), .baz:not(.bang)::bar {
830
+ a: b; }
831
+ CSS
832
+ .foo:not(.bang) {a: b}
833
+ .baz::bar {@extend .foo}
834
+ SCSS
835
+ end
836
+
773
837
  def test_negation_unification
774
838
  assert_equal <<CSS, render(<<SCSS)
775
839
  :not(.foo).baz, :not(.foo):not(.bar) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.217
4
+ version: 2.3.218
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum