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.
[fixed] Allow comments in JSX config
Fixes remix-run#672
- Loading branch information
Showing
3 changed files
with
38 additions
and
15 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,37 @@ | ||
var expect = require('expect'); | ||
var React = require('react'); | ||
var Router = require('../index'); | ||
var Route = require('../components/Route'); | ||
var { Foo, Bar, Nested } = require('../utils/TestHandlers'); | ||
|
||
describe('creating routes from ReactChildren', function () { | ||
it('works with falsy children', 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('works with comments', function (done) { | ||
var routes = [ | ||
<Route handler={Nested} path="/foo"> | ||
// This is a comment. | ||
<Route handler={Bar} path="/bar"/> | ||
</Route> | ||
]; | ||
|
||
Router.run(routes, '/bar', function (Handler, state) { | ||
var html = React.renderToString(<Handler/>); | ||
expect(html).toMatch(/Bar/); | ||
done(); | ||
}); | ||
}); | ||
}); |
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