Sha256: 2b163cdb6f99a84f01a603f89070cee5e04d51cb58bb9938be7ce9e63349543d

Contents?: true

Size: 1.21 KB

Versions: 29

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'
require 'compass/sass_extensions/sprites/images'

class ImagesTest < Test::Unit::TestCase

  def setup
    @images = Compass::SassExtensions::Sprites::Images.new
    @images << OpenStruct.new(:foo => 1, :name => 'bob', :size => 1200, :width => 10)
    @images << OpenStruct.new(:foo => 2, :name => 'bob', :size => 300, :width => 100)
    @images << OpenStruct.new(:foo => 3, :name => 'aob', :size => 120, :width => 50)
    @images << OpenStruct.new(:foo => 4, :name => 'zbob', :size => 600, :width => 55)
  end


  test "sort by size" do
    @images.sort_by! :size
    assert_equal [3, 2, 4, 1], @images.map(&:foo)
  end

  test "sort by !size" do
    @images.sort_by! '!size'
    assert_equal [3, 2, 4, 1].reverse, @images.map(&:foo)
  end

  test "sort by name" do
    @images.sort_by! :name
    assert_equal [3, 2, 1, 4], @images.map(&:foo)
  end

  test "sort by !name" do
    @images.sort_by! '!name'
    assert_equal [3, 2, 1, 4].reverse, @images.map(&:foo)
  end

  test "sort by width" do
    @images.sort_by! :width
    assert_equal [1, 3, 4, 2], @images.map(&:foo)
  end

    test "sort by !width" do
    @images.sort_by! '!width'
    assert_equal [1, 3, 4, 2].reverse, @images.map(&:foo)
  end

end
  

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/compass-1.0.3/test/units/sprites/images_test.rb
compass-1.0.3 test/units/sprites/images_test.rb
compass-1.1.0.alpha.3 test/units/sprites/images_test.rb
compass-1.1.0.alpha.2 test/units/sprites/images_test.rb
compass-1.1.0.alpha.1 test/units/sprites/images_test.rb
compass-1.1.0.alpha.0 test/units/sprites/images_test.rb
compass-1.0.1 test/units/sprites/images_test.rb
compass-1.0.0 test/units/sprites/images_test.rb
compass-1.0.0.rc.1 test/units/sprites/images_test.rb
compass-1.0.0.rc.0 test/units/sprites/images_test.rb
compass-1.0.0.alpha.21 test/units/sprites/images_test.rb
compass-1.0.0.alpha.20 test/units/sprites/images_test.rb
compass-1.0.0.alpha.19 test/units/sprites/images_test.rb
compass-1.0.0.alpha.18 test/units/sprites/images_test.rb
compass-1.0.0.alpha.17 test/units/sprites/images_test.rb
compass-1.0.0.alpha.16 test/units/sprites/images_test.rb
compass-1.0.0.alpha.15 test/units/sprites/images_test.rb
compass-1.0.0.alpha.14 test/units/sprites/images_test.rb
compass-1.0.0.alpha.13 test/units/sprites/images_test.rb
compass-0.13.alpha.12 test/units/sprites/images_test.rb