File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -15,16 +15,19 @@ function createRoute(spec, defaults) {
1515 var handler = spec . handler ;
1616 var path = spec . path ;
1717 var ref = spec . ref ;
18+ var matchKeys = spec . matchKeys ;
1819 var props = merge ( { } , spec ) ;
1920
2021 delete props . path ;
2122 delete props . handler ;
2223 delete props . ref ;
24+ delete props . matchKeys ;
2325
2426 var route = {
2527 path : path ,
2628 handler : handler ,
2729 props : props ,
30+ matchKeys : matchKeys ,
2831 ref : ref
2932 } ;
3033
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ describe('react-router-component (on server)', function() {
2121 path : / \/ y ( .* ) / ,
2222 handler : function ( props ) { return React . DOM . div ( null , props . _ [ 0 ] ) ; }
2323 } ) ,
24+ Router . Location ( {
25+ path : / \/ z \/ ( .* ) \/ ( .* ) / ,
26+ matchKeys : [ 'match1' , 'match2' ] ,
27+ handler : function ( props ) { return React . DOM . div ( null , props . match1 + props . match2 ) ; }
28+ } ) ,
2429 Router . NotFound ( {
2530 handler : function ( props ) { return React . DOM . div ( null , 'not_found' ) ; }
2631 } )
@@ -46,6 +51,12 @@ describe('react-router-component (on server)', function() {
4651 assert ( markup . match ( / o h h a i / ) ) ;
4752 } )
4853
54+ it ( 'renders with regex and matchKeys' , function ( ) {
55+ var markup = React . renderComponentToString ( App ( { path : '/z/one/two' } ) ) ;
56+ assert ( markup . match ( / c l a s s = " A p p " / ) ) ;
57+ assert ( markup . match ( / o n e t w o / ) ) ;
58+ } )
59+
4960 it ( 'renders to empty on notfound' , function ( ) {
5061 var markup = React . renderComponentToString ( App ( { path : '/notfound' } ) ) ;
5162 assert ( markup . match ( / c l a s s = " A p p " / ) ) ;
You can’t perform that action at this time.
0 commit comments