Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix sprite_image mixin and add specs file for mixins
  • Loading branch information
ai committed Oct 6, 2010
1 parent 88f08e4 commit 0d62866
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
29 changes: 29 additions & 0 deletions spec/sass_mixins_spec.rb
@@ -0,0 +1,29 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "lemonade.scss" do

before :each do
Lemonade.reset
FileUtils.cp_r File.dirname(__FILE__) + '/images', IMAGES_TMP_PATH
end

after :each do
FileUtils.rm_r IMAGES_TMP_PATH
end

def evaluate(*values)
sass = '@import "lemonade"' + "\n" +
"div" + values.map{ |value| "\n #{value}" }.join
path = File.expand_path(File.dirname(__FILE__) + '/../stylesheets')
css = Sass::Engine.new(sass, :syntax => :sass, :load_paths => [path]).render
# find rendered CSS values strip selectors hitespace
css = css.gsub(/div \{\s*(.+?);\s*\}\s*/m, '\\1')
css = css.first if css.length == 1
return css
end

it "should have `sprite_image` mixin" do
evaluate('+sprite-image("sprites/30x30.png")').should == "background: url('/sprites.png')"
end

end
4 changes: 2 additions & 2 deletions stylesheets/lemonade.scss
Expand Up @@ -4,7 +4,7 @@
} }


@mixin sprite-image($file) { @mixin sprite-image($file) {
background: sprite-image($file) $repeat; background: sprite-image($file);
} }


@mixin sized-sprite-image($file) { @mixin sized-sprite-image($file) {
Expand Down Expand Up @@ -35,4 +35,4 @@


@mixin sized-sprite-folder($folder) { @mixin sized-sprite-folder($folder) {
@include sprite-folder($folder, true); @include sprite-folder($folder, true);
} }

0 comments on commit 0d62866

Please sign in to comment.