Sha256: a691cc95b7d4ddb369cdf1783866f20d1d6ab26d391d42677d7ec195728e9495

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

describe "Element animation methods" do
  html <<-HTML
    <div id="animate-foo"></div>
  HTML

  describe "#animate" do
    ### HACKY
    # jQUery's animate method doesn't *always* finish on time
    # so the values are being compared using greater than

    it "should animate a set of properties and values" do
      foo = Element.find "#animate-foo"
      foo.animate :width => "200px"

      set_timeout 400 do
        (foo.css("width").to_f > 199).should eq(true)
      end
    end

    async "should allow you to set a speed in the params" do
      foo = Element.find "#animate-foo"
      foo.animate :width => "200px", :speed => 100

      run_async {
        set_timeout 150 do
          (foo.css("width").to_f > 199).should eq(true)
        end
      }
    end

    async "should accept a block as a callback" do
      foo = Element.find "#animate-foo"
      foo.animate :width => "200px", :speed => 100 do
        foo.add_class "finished"
      end

      run_async {
        set_timeout 405 do
          foo.class_name.should eq("finished")
        end
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-jquery-0.3.0.beta1 spec/element/animations_spec.rb