1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] [SCSS] Add tests for mixins.

This commit is contained in:
Nathan Weizenbaum 2009-12-31 16:09:05 -08:00
parent 4628d6c647
commit 220edd6773

View file

@ -179,6 +179,96 @@ CSS
foo { foo {
&:hover {a: b} &:hover {a: b}
bar &.baz {c: d}} bar &.baz {c: d}}
SCSS
end
def test_basic_mixins
assert_equal <<CSS, render(<<SCSS)
.foo {
a: b; }
CSS
@mixin foo {
.foo {a: b}}
@include foo;
SCSS
assert_equal <<CSS, render(<<SCSS)
bar {
c: d; }
bar .foo {
a: b; }
CSS
@mixin foo {
.foo {a: b}}
bar {
@include foo;
c: d; }
SCSS
assert_equal <<CSS, render(<<SCSS)
bar {
a: b;
c: d; }
CSS
@mixin foo {a: b}
bar {
@include foo;
c: d; }
SCSS
end
def test_mixins_with_empty_args
assert_equal <<CSS, render(<<SCSS)
.foo {
a: b; }
CSS
@mixin foo() {a: b}
.foo {@include foo();}
SCSS
assert_equal <<CSS, render(<<SCSS)
.foo {
a: b; }
CSS
@mixin foo() {a: b}
.foo {@include foo;}
SCSS
assert_equal <<CSS, render(<<SCSS)
.foo {
a: b; }
CSS
@mixin foo {a: b}
.foo {@include foo();}
SCSS
end
def test_mixins_with_args
assert_equal <<CSS, render(<<SCSS)
.foo {
a: bar; }
CSS
@mixin foo(!a) {a = !a}
.foo {@include foo("bar")}
SCSS
assert_equal <<CSS, render(<<SCSS)
.foo {
a: bar;
b: 12px; }
CSS
@mixin foo(!a, !b) {
a = !a;
b = !b; }
.foo {@include foo("bar", 12px)}
SCSS SCSS
end end
end end