Sha256: a59c469dd321ab25f46a0e20c5752583d5ec2d6e284a2a4f5521e2d3a25e41c5

Contents?: true

Size: 1.7 KB

Versions: 16

Compression:

Stored size: 1.7 KB

Contents

describe 'Child Layouts' do

  before do
    @layout = TestChildrenLayout.new.build
  end

  it 'should have 3 child layouts' do
    @layout.child_layouts.length.should == 3
  end

  it 'should have a layout named :child_button' do
    @layout.get(:child_button).should.be.kind_of(ChildButtonLayout)
  end

  it ':child_button layout should have a view named :button' do
    @layout.get(:child_button).get(:button).should.be.kind_of(UIButton)
  end

  it 'should have a layout named :child_image' do
    @layout.get(:child_image).should.be.kind_of(ChildImageLayout)
  end

  it ':child_image layout should have a view named :image' do
    @layout.get(:child_image).get(:image).should.be.kind_of(UIImageView)
  end

    it 'should have initial styles on :label' do
      @layout.get(:label).text.should == 'root foo'
    end

    it 'should apply tag on :label' do
      @layout.get(:label).tag.should == 100
    end

  describe 'Calling reapply! on parent layout' do

    before do
      @layout.reapply!
    end

    it 'should reapply :label on root' do
      @layout.get(:label).text.should == 'root reapplied'
    end

    it 'should apply tag on :label' do
      @layout.get(:label).tag.should == 100
    end

    it 'should reapply :label on child layout' do
      @layout.child_layouts[0].get(:label).text.should == 'reapplied'
    end

    it 'should reapply :button on child layout' do
      @layout.get(:child_button).reapply!
      @layout.get(:child_button).get(:button).currentTitle.should == 'reapplied'
    end

    it 'should reapply :image on child layout' do
      reapplied_image = @layout.get(:child_image).reapplied_image
      @layout.get(:child_image).get(:image).image.should == reapplied_image
    end

  end

end

Version data entries

16 entries across 10 versions & 1 rubygems

Version Path
motion-kit-1.1.1 spec/tvos/child_layouts_spec.rb
motion-kit-1.1.1 spec/ios/child_layouts_spec.rb
motion-kit-1.1.0 spec/tvos/child_layouts_spec.rb
motion-kit-1.1.0 spec/ios/child_layouts_spec.rb
motion-kit-1.0.3 spec/ios/child_layouts_spec.rb
motion-kit-1.0.3 spec/tvos/child_layouts_spec.rb
motion-kit-1.0.2 spec/ios/child_layouts_spec.rb
motion-kit-1.0.2 spec/tvos/child_layouts_spec.rb
motion-kit-1.0.1 spec/ios/child_layouts_spec.rb
motion-kit-1.0.1 spec/tvos/child_layouts_spec.rb
motion-kit-1.0.0 spec/ios/child_layouts_spec.rb
motion-kit-1.0.0 spec/tvos/child_layouts_spec.rb
motion-kit-0.18.0 spec/ios/child_layouts_spec.rb
motion-kit-0.17.0 spec/ios/child_layouts_spec.rb
motion-kit-0.16.0 spec/ios/child_layouts_spec.rb
motion-kit-0.15.0 spec/ios/child_layouts_spec.rb