Permalink
Browse files

Change app.stateManager to app.router

  • Loading branch information...
Tomhuda Katzdale
Tomhuda Katzdale committed Jun 19, 2012
1 parent 88be9ee commit d23ea3ab501fc0e8f591a793b927f572436647a1
@@ -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.
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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.