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-3.0.1 spec/ios/layout_spec.rb
teacup-3.0.0 spec/ios/layout_spec.rb
teacup-2.3.0 spec/ios/layout_spec.rb
teacup-2.2.2 spec/ios/layout_spec.rb
teacup-2.2.0 spec/ios/layout_spec.rb
teacup-2.1.16 spec/ios/layout_spec.rb
teacup-2.1.15 spec/ios/layout_spec.rb
teacup-2.1.14 spec/ios/layout_spec.rb
teacup-2.1.13 spec/ios/layout_spec.rb
teacup-2.1.12 spec/ios/layout_spec.rb
teacup-2.1.11 spec/ios/layout_spec.rb
teacup-2.1.10 spec/ios/layout_spec.rb
teacup-2.1.9 spec/ios/layout_spec.rb
teacup-2.1.8 spec/ios/layout_spec.rb
teacup-2.1.7 spec/ios/layout_spec.rb
teacup-2.1.6 spec/ios/layout_spec.rb
teacup-2.1.5 spec/ios/layout_spec.rb
teacup-2.1.4 spec/ios/layout_spec.rb
teacup-2.1.3 spec/ios/layout_spec.rb
teacup-2.1.2 spec/ios/layout_spec.rb