Fix sprite image mixin #13

Closed
wants to merge 1 commit into
from
View
29 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
View
4 stylesheets/lemonade.scss
@@ -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);
-}
+}