Sha256: 5da10535ac7b705c51bca1824d22b49ed66f06e05ac9342be3f4ef040625f73d

Contents?: true

Size: 1.58 KB

Versions: 11

Compression:

Stored size: 1.58 KB

Contents

describe "SugarCube::AnimationChain" do
  tests SugarCube::AnimationChainController

  it "should have a view" do
    controller.view.should != nil
  end

  it "should support chains" do
    SugarCube::AnimationChain.chains.length.should == 0
    @variable_a = nil
    @variable_b = nil
    UIView.animation_chain(duration:0.1){
      @variable_a = 'a'
    }.and_then(duration: 0.1){
      @variable_b = 'b'
    }.start
    SugarCube::AnimationChain.chains.length.should == 1

    wait 0.3 {
      @variable_a.should == 'a'
      @variable_b.should == 'b'
      SugarCube::AnimationChain.chains.length.should == 0
    }
  end

  it "should support multiple chains" do
    SugarCube::AnimationChain.chains.length.should == 0
    @variable_a = nil
    @variable_b = nil
    UIView.animation_chain(duration:0.1, delay:0.1){
      @variable_a = 'a'
    }.start
    UIView.animation_chain(duration:0.1, delay:0.1){
      @variable_b = 'b'
    }.start
    SugarCube::AnimationChain.chains.length.should == 2

    wait 0.3 {
      @variable_a.should == 'a'
      @variable_b.should == 'b'
      SugarCube::AnimationChain.chains.length.should == 0
    }
  end

  it "should support << syntax" do
    SugarCube::AnimationChain.chains.length.should == 0
    @variable_a = nil
    @variable_b = nil
    chain = UIView.animation_chain
    chain << proc { @variable_a = 'a' } << proc { @variable_b = 'b' }
    chain.start
    SugarCube::AnimationChain.chains.length.should == 1

    wait 0.3 {
      @variable_a.should == 'a'
      @variable_b.should == 'b'
      SugarCube::AnimationChain.chains.length.should == 0
    }
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sugarcube-0.18.10 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.9 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.8 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.7 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.6 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.5 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.4 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.3 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.2 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.1 spec/uiview_animation_chain_spec.rb
sugarcube-0.18.0 spec/uiview_animation_chain_spec.rb