Sha256: 00c2c11f1a4b61ca150de0babab5e18e0de3d3e7cbf8ef3adc9ee7a5c3fc08dd

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

describe 'Custom Root Layouts' do
  before do
    @view = NSView.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 NSButton
    @subject.view.subviews.first.subviews.first.should.be.kind_of NSTextField
  end

  it "should call style method" do
    @subject.view.backgroundColor.should == NSColor.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 == NSColor.purpleColor
    @subject.view.subviews.first.should.be.kind_of TestNestedView
    @subject.view.subviews.first.backgroundColor.should == NSColor.yellowColor
    @subject.view.subviews.first.subviews.first.should.be.kind_of NSButton
    @subject.view.subviews.first.subviews.first.backgroundColor.should == NSColor.blackColor
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
motion-kit-0.15.0 spec/osx/custom_root_layout_spec.rb
motion-kit-0.14.2 spec/osx/custom_root_layout_spec.rb
motion-kit-0.14.1 spec/osx/custom_root_layout_spec.rb
motion-kit-0.14.0 spec/osx/custom_root_layout_spec.rb
motion-kit-0.13.0 spec/osx/custom_root_layout_spec.rb
motion-kit-0.12.0 spec/osx/custom_root_layout_spec.rb
motion-kit-0.11.2 spec/osx/custom_root_layout_spec.rb
motion-kit-0.11.1 spec/osx/custom_root_layout_spec.rb
motion-kit-0.11.0 spec/osx/custom_root_layout_spec.rb