Skip to content

Commit

Permalink
Add test and fix for when curveOptions are explicitly set to undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Sep 27, 2016
1 parent ec784c9 commit 3220f92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions framer/Animation.coffee
Expand Up @@ -317,6 +317,7 @@ class exports.Animation extends BaseClass
# This is for compatibility with the direct Animation.time argument. This should
# ideally also be passed as a curveOption

@options.curveOptions ?= {}
if animatorClass in [LinearAnimator, BezierCurveAnimator]
if _.isString(@options.curveOptions) or _.isArray(@options.curveOptions)
@options.curveOptions =
Expand Down
14 changes: 14 additions & 0 deletions test/tests/LayerAnimationTest.coffee
Expand Up @@ -661,6 +661,20 @@ describe "LayerAnimation", ->
layer.x.should.equal 10
done()

it "should support properties with options that have undefined curveOptions as object", (done) ->
layer = new Layer
layer.animationOptions = time: AnimationTime
animation = layer.animate
x: 10
options:
curve: "linear"
curveOptions: undefined

animation.options.curve.should.equal "linear"
animation.on Events.AnimationEnd, ->
layer.x.should.equal 10
done()

it "should support states", (done) ->
layer = new Layer
layer.animationOptions = time: AnimationTime
Expand Down

0 comments on commit 3220f92

Please sign in to comment.