added spec for sprite mixin

This commit is contained in:
Nico Hagenburger 2010-10-15 00:41:41 +02:00 committed by Chris Eppstein
parent c17fe444b6
commit 6d0315ad77

View File

@ -12,6 +12,8 @@ describe Compass::Sprites do
def render(scss) def render(scss)
scss = %Q(@import "compass"; #{scss}) scss = %Q(@import "compass"; #{scss})
options = Compass.sass_engine_options options = Compass.sass_engine_options
options[:line_comments] = false
options[:style] = :expanded
options[:syntax] = :scss options[:syntax] = :scss
options[:load_paths] << Compass::Sprites.new options[:load_paths] << Compass::Sprites.new
css = Sass::Engine.new(scss, options).render css = Sass::Engine.new(scss, options).render
@ -57,4 +59,34 @@ describe Compass::Sprites do
width: 20px; } width: 20px; }
CSS CSS
end end
it "should provide sprite mixin" do
css = render <<-SCSS
@import "squares/*.png";
.cubicle {
@include squares-sprite("10x10");
}
.large-cube {
@include squares-sprite("20x20", true);
}
SCSS
css.should == <<-CSS
.squares-sprite, .cubicle, .large-cube {
background: url('/squares.png') no-repeat; }
.cubicle {
background-position: 0 0;
}
.large-cube {
background-position: 0 -10px;
height: 20px;
width: 20px;
}
CSS
end
end end