Sha256: 9fe9789aa33cc139396332c6f90ac3ad851c1209222efeef49574e0171bf03ae

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

describe 'Remove views' do
  before do
    @subject = TestRemoveLayout.new.build
  end

  it 'should remove the #label view' do
    @subject.get(:label).should.be.kind_of(UILabel)
    @subject.remove_label
    @subject.get(:label).should.be.nil
  end

  it 'should remove the first label view' do 
    labels = @subject.all(:multi_label)
    labels.count.should == 2
    @subject.remove_first_multi_label
    @subject.all(:multi_label).count.should == 1
    @subject.get(:multi_label).should == labels.last
  end

  it 'should remove the last label view' do 
    labels = @subject.all(:multi_label)
    labels.count.should == 2
    @subject.remove_last_multi_label
    @subject.all(:multi_label).count.should == 1
    @subject.get(:multi_label).should == labels.first
  end


  it 'should forget the #image view' do
    image = @subject.get(:image)
    image.should.be.kind_of(UIImageView)
    @subject.forget_image
    @subject.get(:image).should.be.nil
    image.superview.should.not.be.nil
  end

  it 'should forget the first label view' do 
    labels = @subject.all(:multi_label)
    labels.count.should == 2
    @subject.forget_first_multi_label
    @subject.all(:multi_label).count.should == 1
    @subject.get(:multi_label).should == labels.last
    labels.first.superview.should.not.be.nil
  end


  it 'should remove the #view from the hierarchy' do
    view = @subject.get(:view)
    view.should.be.kind_of(UIView)
    @subject.remove_main_view
    @subject.get(:view).should.be.nil
    view.superview.should.be.nil
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
motion-kit-1.1.1 spec/ios/remove_layout_spec.rb
motion-kit-1.1.0 spec/ios/remove_layout_spec.rb
motion-kit-1.0.3 spec/ios/remove_layout_spec.rb
motion-kit-1.0.2 spec/ios/remove_layout_spec.rb
motion-kit-1.0.1 spec/ios/remove_layout_spec.rb