Browse files

Adds currentPath to Ember.StateManager

This is a shorthand so you don't have to type
router.get('currentState.path') all the time.
  • Loading branch information...
Tom Dale
Tom Dale committed Aug 28, 2012
1 parent bad5379 commit 9ecb57019f0ba705bcc67aa59d01a3816e7bbfa4
Showing with 21 additions and 0 deletions.
  1. +11 −0 packages/ember-states/lib/state_manager.js
  2. +10 −0 packages/ember-states/tests/state_manager_test.js
@@ -585,6 +585,17 @@ Ember.StateManager = Ember.State.extend(
currentState: null,
The path of the current state. Returns a string representation of the current
@type String
currentPath: Ember.computed('currentState', function() {
return get(this, 'currentState.path');
The name of transitionEvent that this stateManager will dispatch
@@ -77,6 +77,16 @@ test("it reports its current state", function() {
ok(get(stateManager, 'currentState') === loadedState, "currentState can change to a sibling state");
test("it reports its current state path", function() {
strictEqual(get(stateManager, 'currentPath'), null, "currentPath defaults to null if no state is specified");
equal(get(stateManager, 'currentPath'), 'loadingState', "currentPath changes after transitionTo() is called");
equal(get(stateManager, 'currentPath'), 'loadedState', "currentPath can change to a sibling state");
test("it sends enter and exit events during state transitions", function() {

0 comments on commit 9ecb570

Please sign in to comment.