fixes issue #602

This commit is contained in:
Scott Davis 2011-11-04 09:19:37 -04:00
parent eb10566e02
commit f458519e01
3 changed files with 22 additions and 4 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
compass (0.12.alpha.0.a00044c) compass (0.12.alpha.0.eb10566)
chunky_png (~> 1.2) chunky_png (~> 1.2)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)

View File

@ -153,11 +153,15 @@ module Compass::SassExtensions::Functions::Sprites
protected protected
def convert_sprite_name(sprite) def convert_sprite_name(sprite)
if sprite.is_a?(Sass::Script::Color) case sprite
return Sass::Script::String.new(Sass::Script::Color::HTML4_COLORS_REVERSE[sprite.rgb]) when Sass::Script::Color
end 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 sprite
end end
end
def verify_map(map, error = "sprite") def verify_map(map, error = "sprite")
unless map.is_a?(Compass::SassExtensions::Sprites::SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::SpriteMap)

View File

@ -664,6 +664,20 @@ class SpritesTest < Test::Unit::TestCase
assert_equal 2, map_files('selectors-s*.png').size, "File was removed" assert_equal 2, map_files('selectors-s*.png').size, "File was removed"
end 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 it "should generate a sprite if the sprite is a colorname" do
css = render <<-SCSS css = render <<-SCSS
@import "colors/*.png"; @import "colors/*.png";