Sha256: 831d390d3c3e081026bf759bb442168f8f3b10872ad13d84313251d22976f0a6

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

describe "Gradient" do
  tests GradientController

  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 == 1
    @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 == 1
  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 == 1
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teacup-1.3.4 spec/gradient_spec.rb
teacup-1.3.3 spec/gradient_spec.rb
teacup-1.3.2 spec/gradient_spec.rb
teacup-1.3.1 spec/gradient_spec.rb
teacup-1.3.0 spec/gradient_spec.rb
teacup-1.2.9 spec/gradient_spec.rb