Skip to content

Commit 4fd16e7

Browse files
committed
Ensure matchKeys are passed directly, add test in actual markup
1 parent 0c3a1c4 commit 4fd16e7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: lib/Route.js

+3
Original file line numberDiff line numberDiff 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

Diff for: tests/server.js

+11
Original file line numberDiff line numberDiff 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(/ohhai/));
4752
})
4853

54+
it('renders with regex and matchKeys', function() {
55+
var markup = React.renderComponentToString(App({path: '/z/one/two'}));
56+
assert(markup.match(/class="App"/));
57+
assert(markup.match(/onetwo/));
58+
})
59+
4960
it('renders to empty on notfound', function() {
5061
var markup = React.renderComponentToString(App({path: '/notfound'}));
5162
assert(markup.match(/class="App"/));

0 commit comments

Comments
 (0)