Skip to content

Commit

Permalink
Renamed switchTo to switchInstant
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Sep 15, 2016
1 parent 44253ef commit 209fec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion framer/Layer.coffee
Expand Up @@ -942,7 +942,7 @@ class exports.Layer extends BaseClass
animationFinished()
animation

switchTo: (properties,options={}) ->
switchInstant: (properties,options={}) ->
options = _.defaults({instant:true},options)
@animate properties, options

Expand Down
10 changes: 5 additions & 5 deletions test/tests/LayerStatesTest.coffee
Expand Up @@ -69,7 +69,7 @@ describe "LayerStates", ->
it "should reset the previous and current states", ->
layer = new Layer
layer.states.test = x: 100
layer.switchTo 'test'
layer.switchInstant 'test'
layer.states =
stateA: x:200
stateB: scale: 0.5
Expand All @@ -92,11 +92,11 @@ describe "LayerStates", ->
options:
instant: true

layer.switchTo "stateA"
layer.switchInstant "stateA"
layer.states.currentName.should.equal "stateA"
layer.x.should.equal 123

layer.switchTo "stateB"
layer.switchInstant "stateB"
layer.states.currentName.should.equal "stateB"
layer.y.should.equal 123

Expand Down Expand Up @@ -140,14 +140,14 @@ describe "LayerStates", ->
it "should be a no-op to change to the current state", ->
layer = new Layer
layer.states.stateA = {x: 100}
layer.switchTo 'stateA'
layer.switchInstant 'stateA'
animation = layer.animate 'stateA', time: 0.05
assert.equal(animation,null)

it "should change to a state when the properties defined are not the current", (done) ->
layer = new Layer
layer.states.stateA = {x: 100}
layer.switchTo 'stateA'
layer.switchInstant 'stateA'
layer.x = 150
layer.onStateDidSwitch ->
layer.x.should.equal 100
Expand Down

0 comments on commit 209fec6

Please sign in to comment.