Skip to content

Commit

Permalink
Fix: passing some query params via router service
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX committed Aug 30, 2017
1 parent 19ae330 commit 1c8c6ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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 @@ -976,7 +976,7 @@ const EmberRouter = EmberObject.extend(Evented, {
return true;
}

if (_fromRouterService) {
if (_fromRouterService && presentProp !== false) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ if (EMBER_ROUTING_ROUTER_SERVICE) {
});
}

['@test RouterService#transitionTo with unspecified query params'](assert) {
assert.expect(1);

this.add('controller:parent.child', Controller.extend({
queryParams: ['sort', 'page', 'category', 'extra'],
sort: 'ASC',
page: null,
category: undefined
}));

let queryParams = this.buildQueryParams({ sort: 'ASC' });

return this.visit('/').then(() => {
return this.routerService.transitionTo('parent.child', queryParams);
})
.then(() => {
assert.equal(this.routerService.get('currentURL'), '/child?sort=ASC');
});
}

['@test RouterService#transitionTo with aliased query params uses the original provided key'](assert) {
assert.expect(1);

Expand Down

0 comments on commit 1c8c6ec

Please sign in to comment.