forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edf684c
commit cd2087d
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var expect = require('expect'); | ||
var React = require('react'); | ||
var Router = require('../../index'); | ||
var DefaultRoute = require('../DefaultRoute'); | ||
var Route = require('../Route'); | ||
var { Foo, Bar } = require('../../utils/TestHandlers'); | ||
|
||
describe('Route', function () { | ||
|
||
it('renders default child route if path match but no handler provided', function () { | ||
var routes = ( | ||
<Route path='/'> | ||
<Route path='/bar' handler={Bar} /> | ||
<DefaultRoute handler={Foo} /> | ||
</Route> | ||
); | ||
|
||
Router.run(routes, '/', function (App) { | ||
var html = React.renderToString(<App/>); | ||
expect(html).toMatch(/Foo/); | ||
}); | ||
}); | ||
|
||
it('renders matched child route if no handler provided', function () { | ||
var routes = ( | ||
<Route path='/'> | ||
<Route path='/bar' handler={Bar} /> | ||
<DefaultRoute handler={Foo} /> | ||
</Route> | ||
); | ||
|
||
Router.run(routes, '/bar', function (App) { | ||
var html = React.renderToString(<App/>); | ||
expect(html).toMatch(/Bar/); | ||
}); | ||
}); | ||
|
||
}); |