Sha256: 2f4699c03b1d2a14312fb57f4b70e5887ded5d61851081009fb3cf173ce64701

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

describe 'UIControl' do
  tests UIControlController

  before do
    controller.reset
  end

  it 'should have two buttons' do
    UIButton.should === controller.button1
    UIButton.should === controller.button2
  end

  it 'button1 should respond to touches' do
    controller.button1.sendActionsForControlEvents(:touch.uicontrolevent)
    controller.touched.should == controller.button1
    controller.touched_1.should == true
    controller.touched_count.should == 1
  end

  it 'button1 should respond to touches using `trigger`' do
    controller.button1.trigger(:touch)
    controller.touched.should == controller.button1
    controller.touched_1.should == true
    controller.touched_count.should == 1
  end

  it 'button2 should respond to touches' do
    controller.button2.sendActionsForControlEvents(:touch.uicontrolevent)
    controller.touched.should == controller.button2
    controller.touched_2.should == true
    controller.touched_count.should == 1
  end

  it 'should be able to share handlers with arity 1 (sender)' do
    controller.button1.sendActionsForControlEvents(:touch.uicontrolevent)
    controller.button2.sendActionsForControlEvents(:touch.uicontrolevent)
    controller.touched.should == controller.button2
    controller.touched_1.should == true
    controller.touched_2.should == true
    controller.touched_count.should == 2
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sugarcube-0.20.20 spec/uicontrol_spec.rb
sugarcube-0.20.19 spec/uicontrol_spec.rb
sugarcube-0.20.18 spec/uicontrol_spec.rb
sugarcube-0.20.17 spec/uicontrol_spec.rb
sugarcube-0.20.16 spec/uicontrol_spec.rb
sugarcube-0.20.15 spec/uicontrol_spec.rb
sugarcube-0.20.13 spec/uicontrol_spec.rb