test/sass/engine_test.rb in sass-3.1.0.alpha.25 vs test/sass/engine_test.rb in sass-3.1.0.alpha.26
- old
+ new
@@ -2239,9 +2239,141 @@
foo
a: "bip \#{$foo} bap", bar
SASS
end
+ def test_media_bubbling
+ assert_equal <<CSS, render(<<SASS)
+.foo {
+ a: b; }
+ @media bar {
+ .foo {
+ c: d; } }
+ .foo .baz {
+ e: f; }
+ @media bip {
+ .foo .baz {
+ g: h; } }
+
+.other {
+ i: j; }
+CSS
+.foo
+ a: b
+ @media bar
+ c: d
+ .baz
+ e: f
+ @media bip
+ g: h
+
+.other
+ i: j
+SASS
+
+ assert_equal <<CSS, render(<<SASS, :style => :compact)
+.foo { a: b; }
+@media bar { .foo { c: d; } }
+.foo .baz { e: f; }
+@media bip { .foo .baz { g: h; } }
+
+.other { i: j; }
+CSS
+.foo
+ a: b
+ @media bar
+ c: d
+ .baz
+ e: f
+ @media bip
+ g: h
+
+.other
+ i: j
+SASS
+
+ assert_equal <<CSS, render(<<SASS, :style => :expanded)
+.foo {
+ a: b;
+}
+@media bar {
+ .foo {
+ c: d;
+ }
+}
+.foo .baz {
+ e: f;
+}
+@media bip {
+ .foo .baz {
+ g: h;
+ }
+}
+
+.other {
+ i: j;
+}
+CSS
+.foo
+ a: b
+ @media bar
+ c: d
+ .baz
+ e: f
+ @media bip
+ g: h
+
+.other
+ i: j
+SASS
+ end
+
+ def test_double_media_bubbling
+ assert_equal <<CSS, render(<<SASS)
+@media bar and baz {
+ .foo {
+ c: d; } }
+CSS
+@media bar
+ @media baz
+ .foo
+ c: d
+SASS
+
+ assert_equal <<CSS, render(<<SASS)
+@media bar {
+ .foo {
+ a: b; } }
+ @media bar and baz {
+ .foo {
+ c: d; } }
+CSS
+.foo
+ @media bar
+ a: b
+ @media baz
+ c: d
+SASS
+ end
+
+ def test_rule_media_rule_bubbling
+ assert_equal <<CSS, render(<<SASS)
+@media bar {
+ .foo {
+ a: b;
+ e: f; }
+ .foo .baz {
+ c: d; } }
+CSS
+.foo
+ @media bar
+ a: b
+ .baz
+ c: d
+ e: f
+SASS
+ end
+
# Encodings
unless Sass::Util.ruby1_8?
def test_encoding_error
render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))