sprite base spec selector methods

This commit is contained in:
Scott Davis 2011-03-23 01:09:41 -04:00
parent 03b0ee2660
commit f78744171d
3 changed files with 30 additions and 1 deletions

View File

@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
compass (0.11.beta.3.a5e2795)
compass (0.11.beta.3.03b0ee2)
chunky_png (~> 1.1.0)
sass (>= 3.1.0.alpha.249)

View File

@ -55,6 +55,30 @@ module Compass
File.mtime(file)
end
def hover?
base.has_hover?(name)
end
def hover
base.image_for("#{name}_hover")
end
def target?
base.has_target?(name)
end
def target
base.image_for("#{name}_target")
end
def active?
base.has_active?(name)
end
def active
base.image_for("#{name}_active")
end
private
def dimensions
@dimensions ||= Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size

View File

@ -38,6 +38,11 @@ describe Compass::SassExtensions::Sprites::Base do
it "should have a #{selector}" do
subject.send(:"has_#{selector}?", 'ten-by-ten').should be_true
end
it "should return #{selector} image class" do
subject.image_for('ten-by-ten').send(:"#{selector}").name.should == "ten-by-ten_#{selector}"
end
end
context "#generate" do
before { @base.generate }