Permalink
Browse files

Update Tests

  • Loading branch information...
Benjamin den Boer
Benjamin den Boer committed Mar 7, 2017
1 parent 3778d6e commit b9be679d9209667a706edae503e28b20a48175b1
Showing with 13 additions and 5 deletions.
  1. +13 −5 test/tests/TextLayerTest.coffee
@@ -18,7 +18,6 @@ describe "TextLayer", ->
text.fontWeight.should.equal 400
text.lineHeight.should.equal 1.25
text.fontStyle.should.equal "normal"
text.size.should.eql width: 161, height: 50
text.style.fontFamily.should.equal "-apple-system, 'SF UI Text', 'Helvetica Neue'"
it "should not set the default fontFamily default if the fontFamily property is set", ->
@@ -35,61 +34,70 @@ describe "TextLayer", ->
it "should auto size the layer the size of the text", ->
text = new TextLayer
fontFamily: "Arial"
text: shortText
text.size.should.eql width: 267, height: 50
text.size.should.eql width: 249, height: 50
it "should auto size the layer based on the Screen width", ->
text = new TextLayer
fontFamily: "Arial"
text: mediumText
text.width.should.equal Screen.width
text.height.should.equal 150
it "should auto size the layer if the width is set explicitly", ->
text = new TextLayer
fontFamily: "Arial"
text: mediumText
width: 100
text.width.should.equal 100
text.height.should.equal 550
it "should not auto size the layer the size the layer if it is explictly set", ->
text = new TextLayer
fontFamily: "Arial"
text: mediumText
width: 123
height: 456
text.size.should.eql width: 123, height: 456
it "should not auto size the layer when changing text after explictly setting width", ->
text = new TextLayer
fontFamily: "Arial"
text.width = 123
text.text = longText
text.width.should.equal 123
it "should not auto size the layer when changing text after explictly setting height", ->
text = new TextLayer
fontFamily: "Arial"
text.height = 456
text.text = longText
text.height.should.equal 456
it "should auto size the layer based on it's parent", ->
layer = new Layer width: 150
text = new TextLayer
fontFamily: "Arial"
text: mediumText
parent: layer
text.width.should.equal 150
text.height.should.equal 550
text.height.should.equal 500
it "should auto size the layer when its parent is set afterwards", ->
layer = new Layer width: 150
text = new TextLayer
fontFamily: "Arial"
text: mediumText
text.parent = layer
text.width.should.equal 150
text.height.should.equal 550
text.height.should.equal 500
it "should adjust its size on when a new text is set", (done) ->
text = new TextLayer
fontFamily: "Arial"
text.on "change:height", ->
text.size.should.eql width: 400, height: 2750
text.size.should.eql width: 400, height: 2600
done()
text.text = longText

0 comments on commit b9be679

Please sign in to comment.