Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix sprite image mixin #13

Closed
wants to merge 1 commit into from

2 participants

@ai
ai commented

I add spec file for mixin and fix hagenburger/lemonade#11.

Spec file isn’t very pretty, but I didn’t brave to refactoring your project :). I think before and after filters must be move to some function in spec_helper.rb.

Also, I didn’t wrte specs for all mixins, because have problems. As I understand image-width is a Compass function and I didn’t know how to enable it in specs.

@hagenburger
Owner

I’m closing this because of some deprecation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 6, 2010
  1. @ai
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 2 deletions.
  1. +29 −0 spec/sass_mixins_spec.rb
  2. +2 −2 stylesheets/lemonade.scss
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);
-}
+}
Something went wrong with that request. Please try again.