@@ -1284,7 +1284,7 @@ describe('StackRouter', () => {
12841284 screen : FooScreen ,
12851285 } ,
12861286 } ,
1287- { initialRouteName : 'Bar ' , initialRouteParams : { foo : 'bar' } }
1287+ { initialRouteName : 'Foo ' , initialRouteParams : { foo : 'bar' } }
12881288 ) ;
12891289 const state = router . getStateForAction ( { type : NavigationActions . INIT } ) ;
12901290 expect ( state ) . toEqual ( {
@@ -1294,13 +1294,39 @@ describe('StackRouter', () => {
12941294 routes : [
12951295 {
12961296 key : state && state . routes [ 0 ] . key ,
1297- routeName : 'Bar ' ,
1297+ routeName : 'Foo ' ,
12981298 params : { foo : 'bar' } ,
12991299 } ,
13001300 ] ,
13011301 } ) ;
13021302 } ) ;
13031303
1304+ test ( 'params in route config are merged with initialRouteParams' , ( ) => {
1305+ const FooScreen = ( ) => < div /> ;
1306+ const router = StackRouter (
1307+ {
1308+ Foo : {
1309+ screen : FooScreen ,
1310+ params : { foo : 'not-bar' , meaning : 42 }
1311+ } ,
1312+ } ,
1313+ { initialRouteName : 'Foo' , initialRouteParams : { foo : 'bar' } }
1314+ ) ;
1315+ const state = router . getStateForAction ( { type : NavigationActions . INIT } ) ;
1316+ expect ( state ) . toEqual ( {
1317+ index : 0 ,
1318+ isTransitioning : false ,
1319+ key : 'StackRouterRoot' ,
1320+ routes : [
1321+ {
1322+ key : state && state . routes [ 0 ] . key ,
1323+ routeName : 'Foo' ,
1324+ params : { foo : 'bar' , meaning : 42 } ,
1325+ } ,
1326+ ] ,
1327+ } ) ;
1328+ } ) ;
1329+
13041330 test ( 'Action params appear in nav state' , ( ) => {
13051331 const FooScreen = ( ) => < div /> ;
13061332 const BarScreen = ( ) => < div /> ;
0 commit comments