Permalink
Browse files

Throw error on ScrollComponent.wrap() with nonexisting layer

  • Loading branch information...
Koen Bok
Koen Bok committed Jan 7, 2016
1 parent f797a36 commit 3ee6d07eaec9999da30214628c99a9582f43b8f1
Showing with 7 additions and 0 deletions.
  1. +3 −0 framer/Components/ScrollComponent.coffee
  2. +4 −0 test/tests/ScrollComponentTest.coffee
@@ -391,6 +391,9 @@ class exports.ScrollComponent extends Layer
wrapComponent = (instance, layer, options = {correct:true}) ->
if not (layer instanceof Layer)
throw new Error("ScrollComponent.wrap expects a layer, not #{layer}. Are you sure the layer exists?")
# This function wraps the given layer into a scroll or page component. This is
# great for importing from Sketch or Photoshop.
@@ -77,3 +77,7 @@ describe "ScrollComponent", ->
delete layerA._properties.backgroundColor
scroll = ScrollComponent.wrap(layerA)
it "should throw a warning on no layer", ->
f = -> ScrollComponent.wrap()
f.should.throw()

0 comments on commit 3ee6d07

Please sign in to comment.