Permalink
Browse files

Made properties an instance variable instead of static

Fixes mixing use of old and new API
  • Loading branch information...
nvh committed Sep 14, 2016
1 parent 4500db2 commit fab4a97c94ba261de2a6fc683eb7f4bc2f56d77f
Showing with 21 additions and 2 deletions.
  1. +1 −2 framer/LayerStateMachine.coffee
  2. +20 −0 test/tests/LayerStatesTest.coffee
@@ -10,6 +10,7 @@ class exports.LayerStateMachine extends BaseClass
constructor: (layer) ->
super
@_layer = layer
@properties = {}
@initial = LayerStates.filterStateProperties(layer.props)
@reset()
@@ -48,5 +49,3 @@ class exports.LayerStateMachine extends BaseClass
super
# Also emit this to the layer with self as argument
@_layer.emit args...
properties: {}
@@ -487,3 +487,23 @@ describe "LayerStates", ->
layer.animate "add", instant: true
assert.equal layer.states.add.x, 200
assert.equal layer.x, 200
it "should work when mixing old and new API's", ->
layerA = new Layer
layerA.states =
add: y: 100
next: x: 200
layerB = new Layer
layerB.states.add
a: y: 300
b: x: 400
layerA.animate "next", instant: true
layerA.animate "add", instant: true
assert.equal layerA.states.next.x, 200
assert.equal layerA.x, 200
assert.equal layerA.states.add.y, 100
assert.equal layerA.y, 100
layerB.states.next(instant: true)
layerB.states.next(instant: true)
assert.equal layerB.y, 300
assert.equal layerB.x, 400

0 comments on commit fab4a97

Please sign in to comment.