Permalink
Browse files

Fix sprite_image mixin and add specs file for mixins

  • Loading branch information...
1 parent 88f08e4 commit 0d6286623c12830bd4c0c633cfd51952cfe84a26 @ai ai committed Oct 6, 2010
Showing with 31 additions and 2 deletions.
  1. +29 −0 spec/sass_mixins_spec.rb
  2. +2 −2 stylesheets/lemonade.scss
View
@@ -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,7 +4,7 @@
}
@mixin sprite-image($file) {
- background: sprite-image($file) $repeat;
+ background: sprite-image($file);
}
@mixin sized-sprite-image($file) {
@@ -35,4 +35,4 @@
@mixin sized-sprite-folder($folder) {
@include sprite-folder($folder, true);
-}
+}

0 comments on commit 0d62866

Please sign in to comment.