Sha256: 8d5edcda9866feabe241a82803750234f8c0967e7b5b1fceeb36ab081dba9f9c

Contents?: true

Size: 1.14 KB

Versions: 20

Compression:

Stored size: 1.14 KB

Contents

class SomeHelperClass
  include Teacup::Layout

  attr :container, :label

  stylesheet :helper_stylesheet

  def create_views
    @container = layout(UIView) do
      @label = layout(UILabel)
    end
  end

end


Teacup::Stylesheet.new :helper_stylesheet do
end

Teacup::Stylesheet.new :custom_stylesheet do
end

describe 'Layout module' do

  before do
    @helper = SomeHelperClass.new
    @stylesheet = Teacup::Stylesheet[:helper_stylesheet]
    @custom_stylesheet = Teacup::Stylesheet[:custom_stylesheet]
  end

  it 'should return class stylesheet method' do
    @helper.stylesheet.should == @stylesheet
  end

  it 'should allow custom stylesheet' do
    @helper.stylesheet = :custom_stylesheet
    @helper.stylesheet.should == @custom_stylesheet
  end

  it 'should custom and class stylesheets' do
    another_helper = SomeHelperClass.new
    another_helper.stylesheet = :custom_stylesheet

    @helper.stylesheet.should == @stylesheet
    another_helper.stylesheet.should == @custom_stylesheet
  end

  it 'should have view-creation methods' do
    @helper.create_views
    UIView.should === @helper.container
    UILabel.should === @helper.label
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
teacup-2.1.13 spec/ios/layout_module_spec.rb
teacup-2.1.12 spec/ios/layout_module_spec.rb
teacup-2.1.11 spec/ios/layout_module_spec.rb
teacup-2.1.10 spec/ios/layout_module_spec.rb
teacup-2.1.9 spec/ios/layout_module_spec.rb
teacup-2.1.8 spec/ios/layout_module_spec.rb
teacup-2.1.7 spec/ios/layout_module_spec.rb
teacup-2.1.6 spec/ios/layout_module_spec.rb
teacup-2.1.5 spec/ios/layout_module_spec.rb
teacup-2.1.4 spec/ios/layout_module_spec.rb
teacup-2.1.3 spec/ios/layout_module_spec.rb
teacup-2.1.2 spec/ios/layout_module_spec.rb
teacup-2.1.1 spec/ios/layout_module_spec.rb
teacup-2.1.0 spec/ios/layout_module_spec.rb
teacup-2.0.6 spec/ios/layout_module_spec.rb
teacup-2.0.5 spec/ios/layout_module_spec.rb
teacup-2.0.4 spec/ios/layout_module_spec.rb
teacup-2.0.3 spec/ios/layout_module_spec.rb
teacup-2.0.2 spec/ios/layout_module_spec.rb
teacup-2.0.0 spec/ios/layout_module_spec.rb