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] QP routes named after Obj.prototype props should work #11878

Merged
merged 1 commit into from
Jul 24, 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/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ export default EmberObject.extend({
resolveTemplate(parsedName) {
var templateName = parsedName.fullNameWithoutType.replace(/\./g, '/');

if (Ember.TEMPLATES[templateName]) {
if (Ember.TEMPLATES.hasOwnProperty(templateName)) {
return Ember.TEMPLATES[templateName];
}

templateName = decamelize(templateName);
if (Ember.TEMPLATES[templateName]) {
if (Ember.TEMPLATES.hasOwnProperty(templateName)) {
return Ember.TEMPLATES[templateName];
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var EmberRouter = EmberObject.extend(Evented, {

init() {
this._activeViews = {};
this._qpCache = {};
this._qpCache = Object.create(null);
this._resetQueuedQueryParameterChanges();
},

Expand Down
25 changes: 25 additions & 0 deletions packages/ember/tests/routing/query_params_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3079,3 +3079,28 @@ QUnit.test('warn user that routes query params configuration must be an Object,
bootApplication();
}, 'You passed in `[{"commitBy":{"replace":true}}]` as the value for `queryParams` but `queryParams` cannot be an Array');
});

QUnit.test('handle routes names that class with Object.prototype properties', function() {
expect(1);

Router.map(function() {
this.route('constructor');
});

App.ConstructorRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
}
}
});

bootApplication();

Ember.run(router, 'transitionTo', 'constructor', { queryParams: { foo: '999' } });

var controller = container.lookup('controller:constructor');
equal(get(controller, 'foo'), '999');
});