Permalink
Browse files

Changing to current state is no-op

  • Loading branch information...
nvh committed Aug 1, 2016
1 parent 4936620 commit e6df5ebe03ac231b665db18139e7adeb0633a9a9
Showing with 9 additions and 0 deletions.
  1. +2 −0 framer/Layer.coffee
  2. +7 −0 test/tests/LayerStatesTest.coffee
View
@@ -893,6 +893,8 @@ class exports.Layer extends BaseClass
animateToState: (stateName, options={}) ->
properties = @_stateMachine.switchTo stateName
if @_stateMachine.previousName is @_stateMachine.currentName
return null
finished = options.completion
options.completion = =>
# If we changed the state, we send the event that we did
@@ -137,6 +137,13 @@ describe "LayerStates", ->
layer.x.should.equal 0
layer.style.fontFamily.should.equal "Helvetica"
it "should be a no-op to change to the current state", ->
layer = new Layer
layer.states.stateA = {x: 100}
layer.switchTo 'stateA'
animation = layer.animateTo 'stateA', time: 0.05
assert.equal(animation,null)
describe "Properties", ->
it "should bring back the 'initial' state values when using 'animateToNext'", (done) ->

0 comments on commit e6df5eb

Please sign in to comment.