From f458519e01726a28874629a9842283ebd514b2ca Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Fri, 4 Nov 2011 09:19:37 -0400 Subject: [PATCH] fixes issue #602 --- Gemfile.lock | 2 +- lib/compass/sass_extensions/functions/sprites.rb | 10 +++++++--- test/integrations/sprites_test.rb | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d0e4b152..2c80ced4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - compass (0.12.alpha.0.a00044c) + compass (0.12.alpha.0.eb10566) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) diff --git a/lib/compass/sass_extensions/functions/sprites.rb b/lib/compass/sass_extensions/functions/sprites.rb index e6506a66..e029cdab 100644 --- a/lib/compass/sass_extensions/functions/sprites.rb +++ b/lib/compass/sass_extensions/functions/sprites.rb @@ -153,10 +153,14 @@ module Compass::SassExtensions::Functions::Sprites protected def convert_sprite_name(sprite) - if sprite.is_a?(Sass::Script::Color) - return Sass::Script::String.new(Sass::Script::Color::HTML4_COLORS_REVERSE[sprite.rgb]) + case sprite + when Sass::Script::Color + Sass::Script::String.new(Sass::Script::Color::HTML4_COLORS_REVERSE[sprite.rgb]) + when Sass::Script::Bool + Sass::Script::String.new(sprite.to_s) + else + sprite end - sprite end def verify_map(map, error = "sprite") diff --git a/test/integrations/sprites_test.rb b/test/integrations/sprites_test.rb index 659f3c6e..7effd1f2 100644 --- a/test/integrations/sprites_test.rb +++ b/test/integrations/sprites_test.rb @@ -664,6 +664,20 @@ class SpritesTest < Test::Unit::TestCase assert_equal 2, map_files('selectors-s*.png').size, "File was removed" end + it "should generate a sprite if the sprite is a bool" do + css = render <<-SCSS + @import "bool/*.png"; + a { + @include bool-sprite(false); + } + a { + @include bool-sprite(true); + } + SCSS + assert !css.empty? + end + + it "should generate a sprite if the sprite is a colorname" do css = render <<-SCSS @import "colors/*.png";