Sha256: 3e8027b5284f0e7f91f6d3ac3c4f3445cf1cd823bcdb3cdffe0e2f6722a83ff9

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

describe "Gradient" do
  tests FirstController

  before do
    @root_view = window.subviews[0]
  end

  it "should insert gradient layer when gradient style is set" do
    @root_view.style(gradient: { colors: [UIColor.redColor, UIColor.yellowColor] })
    @root_view.layer.sublayers.size.should == 2
    @root_view.layer.sublayers.first.class.should == CAGradientLayer
  end

  it "should not insert another gradient layer when gradient style is changed" do
    @root_view.style(gradient: { colors: [UIColor.redColor, UIColor.yellowColor] })
    @root_view.style(gradient: { colors: [UIColor.greenColor, UIColor.whiteColor] })
    @root_view.layer.sublayers.size.should == 2
  end

  it "should change gradient layer when gradient style is changed" do
    @root_view.style(gradient: { colors: [UIColor.redColor, UIColor.yellowColor] })
    before = @root_view.layer.sublayers.first.colors.first
    @root_view.style(gradient: { colors: [UIColor.greenColor, UIColor.whiteColor] })
    after = @root_view.layer.sublayers.first.colors.first
    before.should != after
  end

  it "should accept CGColors" do
    @root_view.style(gradient: { colors: [UIColor.redColor.CGColor, UIColor.yellowColor.CGColor] })
    @root_view.layer.sublayers.size.should == 2
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teacup-1.2.8 spec/gradient_spec.rb
teacup-1.2.7 spec/gradient_spec.rb
teacup-1.2.5 spec/gradient_spec.rb
teacup-1.2.4 spec/gradient_spec.rb