File tree 1 file changed +38
-0
lines changed
packages/ember/tests/routing/router_service_test
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,44 @@ if (EMBER_ROUTING_ROUTER_SERVICE) {
302
302
} ) ;
303
303
}
304
304
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 ( '/child' )
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
+
305
343
[ '@test RouterService#transitionTo with aliased query params uses the original provided key' ] ( assert ) {
306
344
assert . expect ( 1 ) ;
307
345
You can’t perform that action at this time.
0 commit comments