sprite test_unit
This commit is contained in:
parent
1c8804386a
commit
5a2967fe51
@ -7,7 +7,7 @@ GIT
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
compass (0.11.1.f4f9d7b)
|
compass (0.11.1.8e2292b)
|
||||||
chunky_png (~> 1.1)
|
chunky_png (~> 1.1)
|
||||||
fssm (>= 0.2.7)
|
fssm (>= 0.2.7)
|
||||||
sass (~> 3.1)
|
sass (~> 3.1)
|
||||||
|
@ -12,7 +12,7 @@ module Compass
|
|||||||
sprites = sprite_map.files.map do |sprite|
|
sprites = sprite_map.files.map do |sprite|
|
||||||
sprite.gsub(Compass.configuration.images_path+"/", "")
|
sprite.gsub(Compass.configuration.images_path+"/", "")
|
||||||
end
|
end
|
||||||
new(sprites, sprite_map.path, sprite_map.name, context, kwargs)
|
new(sprites, sprite_map, context, kwargs)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Loads the sprite engine
|
# Loads the sprite engine
|
||||||
@ -24,17 +24,18 @@ module Compass
|
|||||||
# We should do so only when the packing algorithm changes
|
# We should do so only when the packing algorithm changes
|
||||||
SPRITE_VERSION = "1"
|
SPRITE_VERSION = "1"
|
||||||
|
|
||||||
attr_accessor :image_names, :path, :name, :options
|
attr_accessor :image_names, :path, :name, :options, :map
|
||||||
attr_accessor :images, :width, :height
|
attr_accessor :images, :width, :height
|
||||||
|
|
||||||
|
|
||||||
def initialize(image_names, path, name, context, options)
|
def initialize(image_names, map, context, options)
|
||||||
require_engine!
|
require_engine!
|
||||||
@image_names, @path, @name, @options = image_names, path, name, options
|
@image_names, @path, @name, @options = image_names, map.path, map.name, options
|
||||||
@images = nil
|
@images = nil
|
||||||
@width = nil
|
@width = nil
|
||||||
@height = nil
|
@height = nil
|
||||||
@evaluation_context = context
|
@evaluation_context = context
|
||||||
|
@map = map
|
||||||
validate!
|
validate!
|
||||||
compute_image_metadata!
|
compute_image_metadata!
|
||||||
end
|
end
|
||||||
|
@ -20,6 +20,10 @@ module Compass
|
|||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
||||||
|
def let(method, &block)
|
||||||
|
define_method method, &block
|
||||||
|
end
|
||||||
|
|
||||||
def it(name, &block)
|
def it(name, &block)
|
||||||
test(name, &block)
|
test(name, &block)
|
||||||
end
|
end
|
||||||
|
@ -12,7 +12,7 @@ class SpritesBaseTest < Test::Unit::TestCase
|
|||||||
Compass.configure_sass_plugin!
|
Compass.configure_sass_plugin!
|
||||||
options = Compass.sass_engine_options.extend Compass::SassExtensions::Functions::Sprites::VariableReader
|
options = Compass.sass_engine_options.extend Compass::SassExtensions::Functions::Sprites::VariableReader
|
||||||
@map = Compass::SpriteMap.new("selectors/*.png", options)
|
@map = Compass::SpriteMap.new("selectors/*.png", options)
|
||||||
@base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map.path, 'selectors', @map.sass_engine, @map.options)
|
@base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map, @map.sass_engine, @map.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
Loading…
Reference in New Issue
Block a user