Skip to content

Commit

Permalink
[BUGFIX release] Query params refreshModel
Browse files Browse the repository at this point in the history
Issue: emberjs#15801

Reproduces the case of a refresh due to a queryParam transition in
a child route. *Still requires actual fix.*
  • Loading branch information
Boudewijn van Groos committed Nov 8, 2017
1 parent f5d0ded commit a14572a
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,44 @@ if (EMBER_ROUTING_ROUTER_SERVICE) {
});
}

['@test RouterService#transitionTo with refreshModel on parent route'](assert) {
assert.expect(2);

this.add('controller:parent', Controller.extend({
queryParams: ['parentParam'],
parentParam: null
}));

let modelCalled = 0;

this.add('route:parent', Route.extend({
queryParams: {
parentParam: {
refreshModel: true
}
},

model() {
modelCalled++;
}
}));

this.add('controller:parent.child', Controller.extend({
queryParams: ['childParam']
}));

let queryParams = this.buildQueryParams({ childParam: 'other' })

return this.visit('/child')
.then(() => {
assert.equal(modelCalled, 1, "Model called from first load");
return this.routerService.transitionTo(queryParams);
})
.then(() => {
assert.equal(modelCalled, 1, "Model should not be called again");
});
}

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

Expand Down

0 comments on commit a14572a

Please sign in to comment.