Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Ensure custom Router can be passed to Ember.Application. #10528

Merged
merged 1 commit into from
Feb 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ember-application/lib/system/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ var Application = Namespace.extend(DeferredMixin, {
// This is to ensure that someone reopening `App.Router` does not
// tamper with the default `Ember.Router`.
// 2.0TODO: Can we move this into a globals-mode-only library?
this.Router = Router.extend();
this.Router = (this.Router || Router).extend();
this.waitForDOMReady(this.buildDefaultInstance());
}
} else {
this.Router = Router.extend();
this.Router = (this.Router || Router).extend();
this.waitForDOMReady(this.buildDefaultInstance());
}
},
Expand Down
12 changes: 12 additions & 0 deletions packages/ember-application/tests/system/application_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ QUnit.test("can resolve custom router", function() {
ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router');
});

QUnit.test("can specify custom router", function() {
var CustomRouter = Router.extend();

app = run(function() {
return Application.create({
Router: CustomRouter
});
});

ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router');
});

QUnit.test("throws helpful error if `app.then` is used", function() {
run(function() {
app = Application.create({
Expand Down