Permalink
Browse files

Add Layer.image type check

  • Loading branch information...
koenbok committed Nov 2, 2014
1 parent d147a23 commit af57e3de00c8f37d1f3369a6fd8ab4c0bcde03b3
Showing with 19 additions and 6 deletions.
  1. +3 −0 framer/Layer.coffee
  2. +16 −6 test/tests/LayerTest.coffee
@@ -479,6 +479,9 @@ class exports.Layer extends BaseClass
@_getPropertyValue "image"
set: (value) ->
if not (_.isString(value) or value is null)
layerValueTypeError("image", value)
currentValue = @_getPropertyValue "image"
if currentValue == value
@@ -129,15 +129,25 @@ describe "Layer", ->
layer.properties.image.should.equal imagePath
it "should set image", ->
imagePath = "static/test.png"
layer = new Layer image:imagePath
layer.image.should.equal imagePath
layer = new Layer y:0, \
x:0, y:0,
width:100, height:100,
image:imagePath
it "should unset image with null", ->
layer = new Layer image:"static/test.png"
layer.image = null
layer.image.should.equal ""
layer.image.should.equal imagePath
it "should unset image with empty string", ->
layer = new Layer image:"static/test.png"
layer.image = ""
layer.image.should.equal ""
it "should test image property type", ->
f = ->
layer = new Layer
layer.image = {}
f.should.throw()
it "should set name on create", ->
layer = new Layer name:"Test"

0 comments on commit af57e3d

Please sign in to comment.