File tree 1 file changed +41
-0
lines changed
packages/ember/tests/routing/router_service_test
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,47 @@ 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
+ return { } ;
325
+ }
326
+ } ) ) ;
327
+
328
+ this . add ( 'controller:parent.child' , Controller . extend ( {
329
+ queryParams : [ 'childParam' ]
330
+ } ) ) ;
331
+
332
+ let queryParams = this . buildQueryParams ( { childParam : 'other' } )
333
+
334
+ return this . visit ( '/child' )
335
+ . then ( ( ) => {
336
+ console . log ( 'Second' ) ;
337
+ assert . equal ( modelCalled , 1 , "Model called from first load" ) ;
338
+ return this . routerService . transitionTo ( queryParams ) ;
339
+ } )
340
+ . then ( ( ) => {
341
+ console . log ( 'Third' ) ;
342
+ assert . equal ( modelCalled , 1 , "Model should not be called again" ) ;
343
+ } ) ;
344
+ }
345
+
305
346
[ '@test RouterService#transitionTo with aliased query params uses the original provided key' ] ( assert ) {
306
347
assert . expect ( 1 ) ;
307
348
You can’t perform that action at this time.
0 commit comments