Skip to content

Commit 04b66a8

Browse files
author
Boudewijn van Groos
committed
[BUGFIX release] Query params refreshModel
Issue: #15801 Reproduces the case of a refresh due to a queryParam transition in a child route. *Still requires actual fix.*
1 parent f5d0ded commit 04b66a8

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/ember/tests/routing/router_service_test/transitionTo_test.js

+38
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,44 @@ if (EMBER_ROUTING_ROUTER_SERVICE) {
302302
});
303303
}
304304

305+
['@test RouterService#transitionTo with refreshModel on parent route'](assert) {
306+
assert.expect(2);
307+
308+
this.add('controller:parent', Controller.extend({
309+
queryParams: ['parentParam'],
310+
parentParam: null
311+
}));
312+
313+
let modelCalled = 0;
314+
315+
this.add('route:parent', Route.extend({
316+
queryParams: {
317+
parentParam: {
318+
refreshModel: true
319+
}
320+
},
321+
322+
model() {
323+
modelCalled++;
324+
}
325+
}));
326+
327+
this.add('controller:parent.child', Controller.extend({
328+
queryParams: ['childParam']
329+
}));
330+
331+
let queryParams = this.buildQueryParams({ childParam: 'other' })
332+
333+
return this.visit('/')
334+
.then(() => {
335+
assert.equal(modelCalled, 1, "Model called from first load");
336+
return this.routerService.transitionTo(queryParams);
337+
})
338+
.then(() => {
339+
assert.equal(modelCalled, 1, "Model should not be called again");
340+
});
341+
}
342+
305343
['@test RouterService#transitionTo with aliased query params uses the original provided key'](assert) {
306344
assert.expect(1);
307345

0 commit comments

Comments
 (0)