Fixes sprites file names with sprockets, modifies tests accordingly to new structure.
This commit is contained in:
parent
4461f1be5f
commit
333240de35
@ -96,7 +96,7 @@ module Compass::SassExtensions::Functions::Sprites
|
|||||||
def sprite_url(map)
|
def sprite_url(map)
|
||||||
verify_map(map, "sprite-url")
|
verify_map(map, "sprite-url")
|
||||||
map.generate
|
map.generate
|
||||||
image_url(Sass::Script::String.new("#{map.path}-#{map.uniqueness_hash}.png"),
|
image_url(Sass::Script::String.new("#{map.path}-s#{map.uniqueness_hash}.png"),
|
||||||
Sass::Script::Bool.new(false),
|
Sass::Script::Bool.new(false),
|
||||||
Sass::Script::Bool.new(false))
|
Sass::Script::Bool.new(false))
|
||||||
end
|
end
|
||||||
|
@ -114,7 +114,7 @@ module Compass
|
|||||||
|
|
||||||
# The on-the-disk filename of the sprite
|
# The on-the-disk filename of the sprite
|
||||||
def filename
|
def filename
|
||||||
File.join(Compass.configuration.images_path, "#{path}-#{uniqueness_hash}.png")
|
File.join(Compass.configuration.images_path, "#{path}-s#{uniqueness_hash}.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate a sprite image if necessary
|
# Generate a sprite image if necessary
|
||||||
|
@ -27,7 +27,7 @@ describe Compass::SassExtensions::Sprites::Base do
|
|||||||
its(:generation_required?) { should be_true }
|
its(:generation_required?) { should be_true }
|
||||||
its(:uniqueness_hash) { should == 'ef52c5c63a'}
|
its(:uniqueness_hash) { should == 'ef52c5c63a'}
|
||||||
its(:outdated?) { should be_true }
|
its(:outdated?) { should be_true }
|
||||||
its(:filename) { should == File.join(@images_tmp_path, "#{@base.path}-#{@base.uniqueness_hash}.png")}
|
its(:filename) { should == File.join(@images_tmp_path, "#{@base.path}-s#{@base.uniqueness_hash}.png")}
|
||||||
|
|
||||||
it "should return the 'ten-by-ten' image" do
|
it "should return the 'ten-by-ten' image" do
|
||||||
subject.image_for('ten-by-ten').name.should == 'ten-by-ten'
|
subject.image_for('ten-by-ten').name.should == 'ten-by-ten'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.flag-sprite, #flags .us, #flags .au, #flags .ca, #flags .es, #flags .eg, #flags .ly, .flag-ad, .flag-ae, .flag-af, .flag-ag, .flag-ai, .flag-al, .flag-am, .flag-an, .flag-ao, .flag-ar, .flag-as, .flag-at, .flag-au, .flag-aw, .flag-ax, .flag-az, .flag-ba, .flag-bb, .flag-bd, .flag-be, .flag-bf, .flag-bg, .flag-bh, .flag-bi, .flag-bj, .flag-bm, .flag-bn, .flag-bo, .flag-br, .flag-bs, .flag-bt, .flag-bv, .flag-bw, .flag-by, .flag-bz, .flag-ca, .flag-catalonia, .flag-cc, .flag-cd, .flag-cf, .flag-cg, .flag-ch, .flag-ci, .flag-ck, .flag-cl, .flag-cm, .flag-cn, .flag-co, .flag-cr, .flag-cs, .flag-cu, .flag-cv, .flag-cx, .flag-cy, .flag-cz, .flag-de, .flag-dj, .flag-dk, .flag-dm, .flag-do, .flag-dz, .flag-ec, .flag-ee, .flag-eg, .flag-eh, .flag-england, .flag-er, .flag-es, .flag-et, .flag-europeanunion, .flag-fam, .flag-fi, .flag-fj, .flag-fk, .flag-fm, .flag-fo, .flag-fr, .flag-ga, .flag-gb, .flag-gd, .flag-ge, .flag-gf, .flag-gh, .flag-gi, .flag-gl, .flag-gm, .flag-gn, .flag-gp, .flag-gq, .flag-gr, .flag-gs, .flag-gt, .flag-gu, .flag-gw, .flag-gy, .flag-hk, .flag-hm, .flag-hn, .flag-hr, .flag-ht, .flag-hu, .flag-id-2, .flag-ie, .flag-il, .flag-in, .flag-io, .flag-iq, .flag-ir, .flag-is, .flag-it, .flag-jm, .flag-jo, .flag-jp, .flag-ke, .flag-kg, .flag-kh, .flag-ki, .flag-km, .flag-kn, .flag-kp, .flag-kr, .flag-kw, .flag-ky, .flag-kz, .flag-la, .flag-lb, .flag-lc, .flag-li, .flag-lk, .flag-lr, .flag-ls, .flag-lt, .flag-lu, .flag-lv, .flag-ly, .flag-ma, .flag-mc, .flag-md, .flag-me, .flag-mg, .flag-mh, .flag-mk, .flag-ml, .flag-mm, .flag-mn, .flag-mo, .flag-mp, .flag-mq, .flag-mr, .flag-ms, .flag-mt, .flag-mu, .flag-mv, .flag-mw, .flag-mx, .flag-my, .flag-mz, .flag-na, .flag-nc, .flag-ne, .flag-nf, .flag-ng, .flag-ni, .flag-nl, .flag-no, .flag-np, .flag-nr, .flag-nu, .flag-nz, .flag-om, .flag-pa, .flag-pe, .flag-pf, .flag-pg, .flag-ph, .flag-pk, .flag-pl, .flag-pm, .flag-pn, .flag-pr, .flag-ps, .flag-pt, .flag-pw, .flag-py, .flag-qa, .flag-re, .flag-ro, .flag-rs, .flag-ru, .flag-rw, .flag-sa, .flag-sb, .flag-sc, .flag-scotland, .flag-sd, .flag-se, .flag-sg, .flag-sh, .flag-si, .flag-sj, .flag-sk, .flag-sl, .flag-sm, .flag-sn, .flag-so, .flag-sr, .flag-st, .flag-sv, .flag-sy, .flag-sz, .flag-tc, .flag-td, .flag-tf, .flag-tg, .flag-th, .flag-tj, .flag-tk, .flag-tl, .flag-tm, .flag-tn, .flag-to, .flag-tr, .flag-tt, .flag-tv, .flag-tw, .flag-tz, .flag-ua, .flag-ug, .flag-um, .flag-us, .flag-uy, .flag-uz, .flag-va, .flag-vc, .flag-ve, .flag-vg, .flag-vi, .flag-vn, .flag-vu, .flag-wales, .flag-wf, .flag-ws, .flag-ye, .flag-yt, .flag-za, .flag-zm, .flag-zw {
|
.flag-sprite, #flags .us, #flags .au, #flags .ca, #flags .es, #flags .eg, #flags .ly, .flag-ad, .flag-ae, .flag-af, .flag-ag, .flag-ai, .flag-al, .flag-am, .flag-an, .flag-ao, .flag-ar, .flag-as, .flag-at, .flag-au, .flag-aw, .flag-ax, .flag-az, .flag-ba, .flag-bb, .flag-bd, .flag-be, .flag-bf, .flag-bg, .flag-bh, .flag-bi, .flag-bj, .flag-bm, .flag-bn, .flag-bo, .flag-br, .flag-bs, .flag-bt, .flag-bv, .flag-bw, .flag-by, .flag-bz, .flag-ca, .flag-catalonia, .flag-cc, .flag-cd, .flag-cf, .flag-cg, .flag-ch, .flag-ci, .flag-ck, .flag-cl, .flag-cm, .flag-cn, .flag-co, .flag-cr, .flag-cs, .flag-cu, .flag-cv, .flag-cx, .flag-cy, .flag-cz, .flag-de, .flag-dj, .flag-dk, .flag-dm, .flag-do, .flag-dz, .flag-ec, .flag-ee, .flag-eg, .flag-eh, .flag-england, .flag-er, .flag-es, .flag-et, .flag-europeanunion, .flag-fam, .flag-fi, .flag-fj, .flag-fk, .flag-fm, .flag-fo, .flag-fr, .flag-ga, .flag-gb, .flag-gd, .flag-ge, .flag-gf, .flag-gh, .flag-gi, .flag-gl, .flag-gm, .flag-gn, .flag-gp, .flag-gq, .flag-gr, .flag-gs, .flag-gt, .flag-gu, .flag-gw, .flag-gy, .flag-hk, .flag-hm, .flag-hn, .flag-hr, .flag-ht, .flag-hu, .flag-id-2, .flag-ie, .flag-il, .flag-in, .flag-io, .flag-iq, .flag-ir, .flag-is, .flag-it, .flag-jm, .flag-jo, .flag-jp, .flag-ke, .flag-kg, .flag-kh, .flag-ki, .flag-km, .flag-kn, .flag-kp, .flag-kr, .flag-kw, .flag-ky, .flag-kz, .flag-la, .flag-lb, .flag-lc, .flag-li, .flag-lk, .flag-lr, .flag-ls, .flag-lt, .flag-lu, .flag-lv, .flag-ly, .flag-ma, .flag-mc, .flag-md, .flag-me, .flag-mg, .flag-mh, .flag-mk, .flag-ml, .flag-mm, .flag-mn, .flag-mo, .flag-mp, .flag-mq, .flag-mr, .flag-ms, .flag-mt, .flag-mu, .flag-mv, .flag-mw, .flag-mx, .flag-my, .flag-mz, .flag-na, .flag-nc, .flag-ne, .flag-nf, .flag-ng, .flag-ni, .flag-nl, .flag-no, .flag-np, .flag-nr, .flag-nu, .flag-nz, .flag-om, .flag-pa, .flag-pe, .flag-pf, .flag-pg, .flag-ph, .flag-pk, .flag-pl, .flag-pm, .flag-pn, .flag-pr, .flag-ps, .flag-pt, .flag-pw, .flag-py, .flag-qa, .flag-re, .flag-ro, .flag-rs, .flag-ru, .flag-rw, .flag-sa, .flag-sb, .flag-sc, .flag-scotland, .flag-sd, .flag-se, .flag-sg, .flag-sh, .flag-si, .flag-sj, .flag-sk, .flag-sl, .flag-sm, .flag-sn, .flag-so, .flag-sr, .flag-st, .flag-sv, .flag-sy, .flag-sz, .flag-tc, .flag-td, .flag-tf, .flag-tg, .flag-th, .flag-tj, .flag-tk, .flag-tl, .flag-tm, .flag-tn, .flag-to, .flag-tr, .flag-tt, .flag-tv, .flag-tw, .flag-tz, .flag-ua, .flag-ug, .flag-um, .flag-us, .flag-uy, .flag-uz, .flag-va, .flag-vc, .flag-ve, .flag-vg, .flag-vi, .flag-vn, .flag-vu, .flag-wales, .flag-wf, .flag-ws, .flag-ye, .flag-yt, .flag-za, .flag-zm, .flag-zw {
|
||||||
background: url('/images/flag-03c3b29b35.png') no-repeat; }
|
background: url('/images/flag-s03c3b29b35.png') no-repeat; }
|
||||||
|
|
||||||
#flags .us {
|
#flags .us {
|
||||||
background-position: 0 -2520px;
|
background-position: 0 -2520px;
|
||||||
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
@ -59,7 +59,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-161c60ad78.png') no-repeat;
|
background: url('/squares-s161c60ad78.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -70,8 +70,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -10px;
|
background-position: 0 -10px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
assert_equal image_md5('squares-*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1'
|
assert_equal image_md5('squares-s*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should generate sprite classes with dimensions" do
|
it "should generate sprite classes with dimensions" do
|
||||||
@ -82,7 +82,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-161c60ad78.png') no-repeat;
|
background: url('/squares-s161c60ad78.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -97,7 +97,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
width: 20px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide sprite mixin" do
|
it "should provide sprite mixin" do
|
||||||
@ -114,7 +114,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .cubicle, .large-cube {
|
.squares-sprite, .cubicle, .large-cube {
|
||||||
background: url('/squares-161c60ad78.png') no-repeat;
|
background: url('/squares-s161c60ad78.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cubicle {
|
.cubicle {
|
||||||
@ -127,7 +127,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
width: 20px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
end
|
end
|
||||||
|
|
||||||
# CUSTOMIZATIONS:
|
# CUSTOMIZATIONS:
|
||||||
@ -139,10 +139,10 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.circles {
|
.circles {
|
||||||
background: url('/squares-161c60ad78.png') no-repeat;
|
background: url('/squares-s161c60ad78.png') no-repeat;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should calculate the spacing between images but not before first image" do
|
it "should calculate the spacing between images but not before first image" do
|
||||||
@ -153,7 +153,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-89450808af.png') no-repeat;
|
background: url('/squares-s89450808af.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -164,7 +164,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -43px;
|
background-position: 0 -43px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 63]
|
assert_equal image_size('squares-s*.png'), [20, 63]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should calculate the spacing between images" do
|
it "should calculate the spacing between images" do
|
||||||
@ -175,7 +175,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-673837183a.png') no-repeat;
|
background: url('/squares-s673837183a.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -186,7 +186,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -43px;
|
background-position: 0 -43px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 63]
|
assert_equal image_size('squares-s*.png'), [20, 63]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should calculate the maximum spacing between images" do
|
it "should calculate the maximum spacing between images" do
|
||||||
@ -198,7 +198,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-1cd84c9068.png') no-repeat;
|
background: url('/squares-s1cd84c9068.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -209,7 +209,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -54px;
|
background-position: 0 -54px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 74]
|
assert_equal image_size('squares-s*.png'), [20, 74]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should calculate the maximum spacing between images in reversed order" do
|
it "should calculate the maximum spacing between images in reversed order" do
|
||||||
@ -221,7 +221,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-f25b7090ca.png') no-repeat;
|
background: url('/squares-sf25b7090ca.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -232,7 +232,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -54px;
|
background-position: 0 -54px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 74]
|
assert_equal image_size('squares-s*.png'), [20, 74]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should calculate the default spacing between images" do
|
it "should calculate the default spacing between images" do
|
||||||
@ -243,7 +243,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-d66bf24bab.png') no-repeat;
|
background: url('/squares-sd66bf24bab.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -254,7 +254,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -32px;
|
background-position: 0 -32px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 52]
|
assert_equal image_size('squares-s*.png'), [20, 52]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use position adjustments in functions" do
|
it "should use position adjustments in functions" do
|
||||||
@ -278,7 +278,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite {
|
.squares-sprite {
|
||||||
background: url('/squares-8e490168dd.png') no-repeat;
|
background: url('/squares-s8e490168dd.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.adjusted-percentage {
|
.adjusted-percentage {
|
||||||
@ -293,8 +293,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: -3px -8px;
|
background-position: -3px -8px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012'
|
assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use position adjustments in mixins" do
|
it "should use position adjustments in mixins" do
|
||||||
@ -316,7 +316,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
|
.squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
|
||||||
background: url('/squares-8e490168dd.png') no-repeat;
|
background: url('/squares-s8e490168dd.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.adjusted-percentage {
|
.adjusted-percentage {
|
||||||
@ -331,8 +331,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: -3px -8px;
|
background-position: -3px -8px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012'
|
assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should repeat the image" do
|
it "should repeat the image" do
|
||||||
@ -343,7 +343,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-a5550fd132.png') no-repeat;
|
background: url('/squares-sa5550fd132.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -354,8 +354,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: 0 -10px;
|
background-position: 0 -10px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 30]
|
assert_equal image_size('squares-s*.png'), [20, 30]
|
||||||
assert_equal image_md5('squares-*.png'), '94abae8440f1b58617f52920b70aaed2'
|
assert_equal image_md5('squares-s*.png'), '94abae8440f1b58617f52920b70aaed2'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should allow the position of a sprite to be specified in absolute pixels" do
|
it "should allow the position of a sprite to be specified in absolute pixels" do
|
||||||
@ -367,7 +367,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
||||||
background: url('/squares-89a274044e.png') no-repeat;
|
background: url('/squares-s89a274044e.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squares-ten-by-ten {
|
.squares-ten-by-ten {
|
||||||
@ -378,8 +378,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
background-position: -10px -10px;
|
background-position: -10px -10px;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
assert_equal image_size('squares-*.png'), [30, 30]
|
assert_equal image_size('squares-s*.png'), [30, 30]
|
||||||
assert_equal image_md5('squares-*.png'), '2fb19ef9c83018c93c6f147af3a56cb2'
|
assert_equal image_md5('squares-s*.png'), '2fb19ef9c83018c93c6f147af3a56cb2'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide a nice errors for lemonade's old users" do
|
it "should provide a nice errors for lemonade's old users" do
|
||||||
@ -416,7 +416,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares {
|
.squares {
|
||||||
background: url('/squares-145869726f.png') 0 -10px no-repeat;
|
background: url('/squares-s145869726f.png') 0 -10px no-repeat;
|
||||||
}
|
}
|
||||||
CSS
|
CSS
|
||||||
end
|
end
|
||||||
@ -432,10 +432,10 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
||||||
}
|
}
|
||||||
SCSS
|
SCSS
|
||||||
assert_equal image_size('squares-*.png'), [20, 40]
|
assert_equal image_size('squares-s*.png'), [20, 40]
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.squares-sprite {
|
.squares-sprite {
|
||||||
background: url('/squares-e3c68372d9.png') no-repeat;
|
background: url('/squares-se3c68372d9.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.foo {
|
.foo {
|
||||||
@ -455,7 +455,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.selectors-sprite, .selectors-ten-by-ten {
|
.selectors-sprite, .selectors-ten-by-ten {
|
||||||
background: url('/selectors-edfef809e2.png') no-repeat;
|
background: url('/selectors-sedfef809e2.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectors-ten-by-ten {
|
.selectors-ten-by-ten {
|
||||||
@ -482,7 +482,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.selectors-sprite, a {
|
.selectors-sprite, a {
|
||||||
background: url('/selectors-edfef809e2.png') no-repeat;
|
background: url('/selectors-sedfef809e2.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@ -510,7 +510,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.selectors-sprite, a {
|
.selectors-sprite, a {
|
||||||
background: url('/selectors-edfef809e2.png') no-repeat;
|
background: url('/selectors-sedfef809e2.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@ -538,7 +538,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.ko-sprite, .ko-default_background, .ko-starbg26x27 {
|
.ko-sprite, .ko-default_background, .ko-starbg26x27 {
|
||||||
background: url('/ko-cc3f80660d.png') no-repeat;
|
background: url('/ko-scc3f80660d.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ko-default_background {
|
.ko-default_background {
|
||||||
@ -552,8 +552,8 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should generate a sprite and remove the old file" do
|
it "should generate a sprite and remove the old file" do
|
||||||
FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Fdd.png")
|
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png")
|
||||||
assert_equal 1, map_files('selectors-*.png').size
|
assert_equal 1, map_files('selectors-s*.png').size
|
||||||
css = render <<-SCSS
|
css = render <<-SCSS
|
||||||
@import "selectors/*.png";
|
@import "selectors/*.png";
|
||||||
a {
|
a {
|
||||||
@ -561,12 +561,12 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
@include selectors-sprite(ten-by-ten)
|
@include selectors-sprite(ten-by-ten)
|
||||||
}
|
}
|
||||||
SCSS
|
SCSS
|
||||||
assert_equal 1, map_files('selectors-*.png').size, "File was not removed"
|
assert_equal 1, map_files('selectors-s*.png').size, "File was not removed"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should generate a sprite and NOT remove the old file" do
|
it "should generate a sprite and NOT remove the old file" do
|
||||||
FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Ftest.png")
|
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png")
|
||||||
assert_equal 1, map_files('selectors-*.png').size
|
assert_equal 1, map_files('selectors-s*.png').size
|
||||||
css = render <<-SCSS
|
css = render <<-SCSS
|
||||||
$selectors-clean-up: false;
|
$selectors-clean-up: false;
|
||||||
@import "selectors/*.png";
|
@import "selectors/*.png";
|
||||||
@ -575,7 +575,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
@include selectors-sprite(ten-by-ten)
|
@include selectors-sprite(ten-by-ten)
|
||||||
}
|
}
|
||||||
SCSS
|
SCSS
|
||||||
assert_equal 2, map_files('selectors-*.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 colorname" do
|
it "should generate a sprite if the sprite is a colorname" do
|
||||||
@ -595,7 +595,7 @@ class SpritesTest < Test::Unit::TestCase
|
|||||||
SCSS
|
SCSS
|
||||||
assert_correct css, <<-CSS
|
assert_correct css, <<-CSS
|
||||||
.nested-sprite, .nested-ten-by-ten {
|
.nested-sprite, .nested-ten-by-ten {
|
||||||
background: url('/nested-55a8935544.png') no-repeat;
|
background: url('/nested-s55a8935544.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nested-ten-by-ten {
|
.nested-ten-by-ten {
|
||||||
|
@ -49,7 +49,7 @@ class SpriteMapTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should have correct filename' do
|
it 'should have correct filename' do
|
||||||
assert_equal File.join(@images_tmp_path, "#{@base.path}-#{@base.uniqueness_hash}.png"), @base.filename
|
assert_equal File.join(@images_tmp_path, "#{@base.path}-s#{@base.uniqueness_hash}.png"), @base.filename
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return the 'ten-by-ten' image" do
|
it "should return the 'ten-by-ten' image" do
|
||||||
|
Loading…
Reference in New Issue
Block a user