Sha256: d4650e6ed6bd1bee5f8441405a105c211aa4221216c23dd18f29fbb30eb4a86b

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 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
    @helper.container.should.is_a?(UIView)
    @helper.label.should.is_a?(UILabel)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
teacup-3.0.1 spec/ios/layout_module_spec.rb
teacup-3.0.0 spec/ios/layout_module_spec.rb
teacup-2.3.0 spec/ios/layout_module_spec.rb
teacup-2.2.2 spec/ios/layout_module_spec.rb
teacup-2.2.0 spec/ios/layout_module_spec.rb
teacup-2.1.16 spec/ios/layout_module_spec.rb
teacup-2.1.15 spec/ios/layout_module_spec.rb
teacup-2.1.14 spec/ios/layout_module_spec.rb