File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ const Router = React.createClass({
62
62
if ( error ) {
63
63
this . handleError ( error )
64
64
} else {
65
+ router . location = state . location
66
+ router . params = state . params
65
67
this . setState ( state , this . props . onUpdate )
66
68
}
67
69
} )
@@ -82,7 +84,10 @@ const Router = React.createClass({
82
84
history ,
83
85
createRoutes ( routes || children )
84
86
)
87
+
85
88
const router = createRouterObject ( history , transitionManager )
89
+ router . location = null
90
+ router . params = null
86
91
87
92
return { transitionManager, router }
88
93
} ,
Original file line number Diff line number Diff line change @@ -297,6 +297,12 @@ describe('Router', function () {
297
297
const assertProps = ( props ) => {
298
298
expect ( props . routes ) . toEqual ( [ route ] )
299
299
expect ( props . components ) . toEqual ( [ MyComponent ] )
300
+
301
+ expect ( props . params ) . toEqual ( { } )
302
+ expect ( props . location . pathname ) . toEqual ( '/' )
303
+ expect ( props . router . params ) . toEqual ( { } )
304
+ expect ( props . router . location . pathname ) . toEqual ( '/' )
305
+
300
306
expect ( props . foo ) . toBe ( 'bar' )
301
307
expect ( props . render ) . toNotExist ( )
302
308
done ( )
You can’t perform that action at this time.
0 commit comments