Skip to content

Commit

Permalink
Change app.stateManager to app.router
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomhuda Katzdale committed Jun 19, 2012
1 parent 88be9ee commit d23ea3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/ember-application/lib/system/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Ember.Application = Ember.Namespace.extend(
}

if (router) {
set(this, 'stateManager', router);
set(this, 'router', router);
}

// By default, the router's namespace is the current application.
Expand Down
32 changes: 9 additions & 23 deletions packages/ember-application/tests/system/application_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,7 @@ test('initialized application go to initial route', function() {
});

app.initialize(app.stateManager);
equal(app.getPath('stateManager.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("initialize application with non routable stateManager", function() {
Ember.run(function() {
app = Ember.Application.create({
rootElement: '#qunit-fixture'
});

app.stateManager = Ember.StateManager.create({
start: Ember.State.extend()
});
});

equal(app.getPath('stateManager.currentState.path'), 'start', "Application sucessfuly started");
equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("initialize application with stateManager via initialize call", function() {
Expand All @@ -178,9 +164,9 @@ test("initialize application with stateManager via initialize call", function()
app.initialize(app.Router.create());
});

equal(app.getPath('stateManager') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('stateManager.location') instanceof Ember.NoneLocation, true, "Location was set from location implementation name");
equal(app.getPath('stateManager.currentState.path'), 'root.index', "The router moved the state into the right place");
equal(app.getPath('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('router.location') instanceof Ember.NoneLocation, true, "Location was set from location implementation name");
equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("initialize application with stateManager via initialize call from Router class", function() {
Expand All @@ -202,8 +188,8 @@ test("initialize application with stateManager via initialize call from Router c
app.initialize();
});

equal(app.getPath('stateManager') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('stateManager.currentState.path'), 'root.index', "The router moved the state into the right place");
equal(app.getPath('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("injections can be registered in a specified order", function() {
Expand Down Expand Up @@ -295,7 +281,7 @@ test("ControllerObject class can be initialized with target, controllers and vie
stateManager.get('postController').set('view', Ember.View.create());
});

equal(app.getPath('stateManager.postController.target') instanceof Ember.StateManager, true, "controller has target");
equal(app.getPath('stateManager.postController.controllers') instanceof Ember.StateManager, true, "controller has controllers");
equal(app.getPath('stateManager.postController.view') instanceof Ember.View, true, "controller has view");
equal(app.getPath('router.postController.target') instanceof Ember.StateManager, true, "controller has target");
equal(app.getPath('router.postController.controllers') instanceof Ember.StateManager, true, "controller has controllers");
equal(app.getPath('router.postController.view') instanceof Ember.View, true, "controller has view");
});

0 comments on commit d23ea3a

Please sign in to comment.