File tree 2 files changed +14
-0
lines changed
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) {
15
15
var handler = spec . handler ;
16
16
var path = spec . path ;
17
17
var ref = spec . ref ;
18
+ var matchKeys = spec . matchKeys ;
18
19
var props = merge ( { } , spec ) ;
19
20
20
21
delete props . path ;
21
22
delete props . handler ;
22
23
delete props . ref ;
24
+ delete props . matchKeys ;
23
25
24
26
var route = {
25
27
path : path ,
26
28
handler : handler ,
27
29
props : props ,
30
+ matchKeys : matchKeys ,
28
31
ref : ref
29
32
} ;
30
33
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ describe('react-router-component (on server)', function() {
21
21
path : / \/ y ( .* ) / ,
22
22
handler : function ( props ) { return React . DOM . div ( null , props . _ [ 0 ] ) ; }
23
23
} ) ,
24
+ Router . Location ( {
25
+ path : / \/ z \/ ( .* ) \/ ( .* ) / ,
26
+ matchKeys : [ 'match1' , 'match2' ] ,
27
+ handler : function ( props ) { return React . DOM . div ( null , props . match1 + props . match2 ) ; }
28
+ } ) ,
24
29
Router . NotFound ( {
25
30
handler : function ( props ) { return React . DOM . div ( null , 'not_found' ) ; }
26
31
} )
@@ -46,6 +51,12 @@ describe('react-router-component (on server)', function() {
46
51
assert ( markup . match ( / o h h a i / ) ) ;
47
52
} )
48
53
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
+
49
60
it ( 'renders to empty on notfound' , function ( ) {
50
61
var markup = React . renderComponentToString ( App ( { path : '/notfound' } ) ) ;
51
62
assert ( markup . match ( / c l a s s = " A p p " / ) ) ;
You can’t perform that action at this time.
0 commit comments