Sha256: e80dae785f627936540456352de0e0792b8c83c9ddf2e9b16ff454a5c6d88900

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 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 = Document.id "animate-foo"
      foo.animate :width => "200px"

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

    it "should allow you to set a speed in the params" do
      foo = Document.id "animate-foo"
      foo.animate :width => "200px", :speed => 100

      set_timeout 105 do
        (foo.css("width").to_f > 199).should be_true
      end
    end

    it "should accept a block as a callback" do
      foo = Document.id "animate-foo"
      foo.animate :width => "200px" do
        foo.add_class "finished"
      end

      set_timeout 405 do
        foo.class_name.should equal("finished")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-jquery-0.0.6 spec/element/animations_spec.rb
opal-jquery-0.0.5 spec/element/animations_spec.rb
opal-jquery-0.0.4 spec/element/animations_spec.rb
opal-jquery-0.0.3 spec/element/animations_spec.rb
opal-jquery-0.0.2 spec/element/animations_spec.rb