Sha256: fadac622b9568e941e51afa1c6ee6bfd71f2139af8e70fc14c29fb07cb8fe896
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
class FakeModel include MotionBindable::Bindable attr_accessor :nested attr_accessor :attribute def attribute @attribute end end describe 'MotionBindable::Strategies::UILabel' do before do MotionBindable::Strategy.register_strategy( MotionBindable::Strategies::UILabel, UILabel ) @label = UILabel.alloc.initWithFrame [[110, 60], [100, 26]] @label2 = UILabel.alloc.initWithFrame [[110, 60], [100, 26]] @object = FakeModel.new @object.nested = FakeModel.new end context 'attribute is not set yet' do before do @object.bind_attributes({ attribute: @label, nested: { attribute: @label2 } }) end it 'should update the label on change' do @object.attribute = 'one' @object.nested.attribute = 'two' @label.text.should.equal 'one' @label2.text.should.equal'two' end end context 'attribute is set first' do before do @object.attribute = 'test' @object.nested.attribute = 'test2' @object.bind_attributes({ attribute: @label, nested: { attribute: @label2 } }) end it 'should set the label on bind' do @label.text.should.equal 'test' @label2.text.should.equal 'test2' end it 'should change the label when the attribute changes' do @object.attribute = 'changed' @object.nested.attribute = 'changed2' @label.text.should.equal 'changed' @label2.text.should.equal 'changed2' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motion_bindable-0.2.3 | spec/strategies/ui_label_spec.rb |