Skip to content
Permalink
Browse files

Added alternate use of deprecated ‘add’ function

Signed-off-by: Niels van Hoorn <nvh@nvh.io>
  • Loading branch information
nvh committed Sep 15, 2016
1 parent ec88f94 commit cc935370c80fcaae8759e529bcb86740b34cadee
Showing with 26 additions and 2 deletions.
  1. +6 −2 framer/LayerStates.coffee
  2. +20 −0 test/tests/LayerStatesTest.coffee
@@ -44,8 +44,12 @@ class exports.LayerStates

## Deprecated methods
deprecatedProperty @, "add", "layer.states = ", stateMachine, (layer) ->
(states) ->
layer.states = states
(states, object={}) ->
if _.isString states
stateName = states
layer.states[stateName] = object
else
layer.states = states
deprecatedProperty @, "remove", "delete layer.states.a", stateMachine, (layer) ->
(stateName) ->
delete layer.states[stateName]
@@ -538,3 +538,23 @@ describe "LayerStates", ->
@layer.states.switchInstant 'a'


describe "Defaults", ->

it "should set defaults", ->

layer = new Layer
layer.states.add "test", {x:123}
animation = layer.states.switch "test"

animation.options.curve.should.equal Framer.Defaults.Animation.curve

Framer.Defaults.Animation =
curve: "spring(1, 2, 3)"

layer = new Layer
layer.states.add "test", {x:456}
animation = layer.states.switch "test"

animation.options.curve.should.equal "spring(1, 2, 3)"

Framer.resetDefaults()

0 comments on commit cc93537

Please sign in to comment.
You can’t perform that action at this time.