Sha256: 2923e1b45013b69f2a21714f4f2c2d44c9d82ea21a943667f1f5a3612a99431e

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

describe MotionKit::Layout do
  before do
    @view = UIView.new
    @subject = TestCustomRootLayout.new(root: @view)
  end

  it "should set the root view to the @view instance" do
    @subject.view.should == @view
  end

  it "should still create subviews" do
    @subject.view.subviews.first.should.be.kind_of UIButton
    @subject.view.subviews.first.subviews.first.should.be.kind_of UILabel
  end

  it "should call style method" do
    @subject.view.backgroundColor.should == UIColor.blueColor
  end

  it "should raise exception if you try to specify a root inside the layout too" do
    -> do
      subject = TestCustomDuplicateRootLayout.new(root: @view)
      subject.view
    end.should.raise(MotionKit::ContextConflictError)
  end

  it "should allow multiple nested layouts" do
    @subject = TestMultipleNestedLayout.new
    @subject.view.backgroundColor.should == UIColor.purpleColor
    @subject.view.subviews.first.should.be.kind_of TestNestedView
    @subject.view.subviews.first.backgroundColor.should == UIColor.yellowColor
    @subject.view.subviews.first.subviews.first.should.be.kind_of UIButton
    @subject.view.subviews.first.subviews.first.backgroundColor.should == UIColor.blackColor
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-kit-0.10.0 spec/ios/custom_root_layout_spec.rb