Sha256: 26692ad2b80e088af87a8f861780d71abae6e3ef253b2217cb6e7a14aa1a2fcd

Contents?: true

Size: 1.32 KB

Versions: 28

Compression:

Stored size: 1.32 KB

Contents

describe "Layouts" do

  it "Should be applied to UIView" do
    subject = UIView.new
    subject.respond_to?(:subview).should == true
    subject.respond_to?(:layout).should == true
  end

  it "Should be applied to UIViewController" do
    subject = UIViewController.new
    subject.respond_to?(:subview).should == true
    subject.respond_to?(:layout).should == true
  end

  it "Should add a subview to a UIView" do
    subject = UIView.new
    subject.subviews.length.should == 0
    subject.subview(UIView)
    subject.subviews.length.should == 1
  end

  it "Should add a subview to a UIViewController" do
    subject = UIViewController.new
    subject.view.subviews.length.should == 0
    subject.subview(UIView)
    subject.view.subviews.length.should == 1
  end

  it "Should apply styles" do
    subject = UIView.new
    view = subject.subview(UIView, tag: 1)
    view.tag.should == 1
  end

  it "Should allow multiple calls" do
    subject = UIView.new
    view = subject.subview(UIView, tag: 1)
    subject.layout(view, tag: 2)
    view.tag.should == 2
  end

  it "Should merge hashes, like a stylesheet does" do
    subject = UIView.new
    view = subject.subview(UIView, layer: { opacity: 0.5 })
    subject.layout(view, layer: { shadowRadius: 3 })
    view.layer.opacity.should == 0.5
    view.layer.shadowRadius.should == 3
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
teacup-2.1.1 spec/ios/layout_spec.rb
teacup-2.1.0 spec/ios/layout_spec.rb
teacup-2.0.6 spec/ios/layout_spec.rb
teacup-2.0.5 spec/ios/layout_spec.rb
teacup-2.0.4 spec/ios/layout_spec.rb
teacup-2.0.3 spec/ios/layout_spec.rb
teacup-2.0.2 spec/ios/layout_spec.rb
teacup-2.0.0 spec/ios/layout_spec.rb