diff --git a/lib/compass/sass_extensions/sprites/sprite_map.rb b/lib/compass/sass_extensions/sprites/sprite_map.rb index e8c2e2e8..3ea296c1 100644 --- a/lib/compass/sass_extensions/sprites/sprite_map.rb +++ b/lib/compass/sass_extensions/sprites/sprite_map.rb @@ -14,7 +14,7 @@ module Compass # the path is relative to the images_path confguration option def self.from_uri(uri, context, kwargs) uri = uri.value - name, path = Compass::SpriteImporter.path_and_name(uri) + path, name = Compass::SpriteImporter.path_and_name(uri) files = Compass::SpriteImporter.files(uri) sprites = files.map do |sprite| relative_name(sprite) diff --git a/test/test_helper.rb b/test/test_helper.rb index 43981842..de3fa125 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -44,11 +44,11 @@ module SpriteHelper @images_tmp_path = File.join(File.dirname(__FILE__), 'fixtures', 'sprites', 'public', 'images-tmp') end - def sprite_map_test(options) + def sprite_map_test(options, uri = URI) importer = Compass::SpriteImporter.new - path, name = Compass::SpriteImporter.path_and_name(URI) - sprite_names = Compass::SpriteImporter.sprite_names(URI) - sass_engine = Compass::SpriteImporter.sass_engine(URI, name, importer, options) + path, name = Compass::SpriteImporter.path_and_name(uri) + sprite_names = Compass::SpriteImporter.sprite_names(uri) + sass_engine = Compass::SpriteImporter.sass_engine(uri, name, importer, options) Compass::SassExtensions::Sprites::SpriteMap.new(sprite_names.map{|n| "selectors/#{n}.png"}, path, name, sass_engine, options) end diff --git a/test/units/sprites/sprite_map_test.rb b/test/units/sprites/sprite_map_test.rb index 4adb7622..a70157fc 100644 --- a/test/units/sprites/sprite_map_test.rb +++ b/test/units/sprites/sprite_map_test.rb @@ -192,5 +192,11 @@ class SpriteMapTest < Test::Unit::TestCase FileUtils.rm_rf other_folder end + test "should create map for nested" do + base = Compass::SassExtensions::Sprites::SpriteMap.from_uri OpenStruct.new(:value => 'nested/squares/*.png'), @base.instance_variable_get(:@evaluation_context), @options + assert_equal 'squares', base.name + assert_equal 'nested/squares', base.path + end + end \ No newline at end of file