Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/Router-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,20 @@ describe('Router.run', function () {
});
});

it('does not break on falsy routes', function (done) {
var routes = [
<Route handler={Foo} path="/foo"/>,
null,
<Route handler={Bar} path="/bar"/>,
undefined
];
Router.run(routes, '/foo', function (Handler, state) {
var html = React.renderToString(<Handler/>);
expect(html).toMatch(/Foo/);
done();
});
});

it('matches nested routes', function (done) {
var routes = (
<Route handler={Nested} path='/'>
Expand Down
4 changes: 2 additions & 2 deletions utils/createRoutesFromChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ function createRoutesFromChildren(children, parentRoute, namedRoutes) {
var routes = [];

React.Children.forEach(children, function (child) {
// Exclude <DefaultRoute>s and <NotFoundRoute>s.
if (child = createRoute(child, parentRoute, namedRoutes))
// Exclude null values, <DefaultRoute>s and <NotFoundRoute>s.
if (child && (child = createRoute(child, parentRoute, namedRoutes)))
routes.push(child);
});

Expand Down