Skip to content

Commit

Permalink
Made properties an instance variable instead of static
Browse files Browse the repository at this point in the history
Fixes mixing use of old and new API
  • Loading branch information
nvh committed Sep 15, 2016
1 parent 4500db2 commit fab4a97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions framer/LayerStateMachine.coffee
Expand Up @@ -10,6 +10,7 @@ class exports.LayerStateMachine extends BaseClass
constructor: (layer) ->
super
@_layer = layer
@properties = {}
@initial = LayerStates.filterStateProperties(layer.props)
@reset()

Expand Down Expand Up @@ -48,5 +49,3 @@ class exports.LayerStateMachine extends BaseClass
super
# Also emit this to the layer with self as argument
@_layer.emit args...

properties: {}
20 changes: 20 additions & 0 deletions test/tests/LayerStatesTest.coffee
Expand Up @@ -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.