Skip to content

Commit 1612eab

Browse files
committed
Add test for comments inside a <Switch>
Fixes #4608
1 parent 2ba6a0f commit 1612eab

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/react-router/modules/__tests__/Switch-test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,21 @@ describe('A <Switch>', () => {
121121
expect(node.innerHTML).toNotContain('cup')
122122
expect(node.innerHTML).toContain('bub')
123123
})
124+
125+
it('handles comments', () => {
126+
const node = document.createElement('div')
127+
128+
ReactDOM.render((
129+
<MemoryRouter initialEntries={[ '/cupcakes' ]}>
130+
<Switch>
131+
<Route path="/bubblegum" render={() => <div>bub</div>}/>
132+
{/* this is a comment */}
133+
<Route path="/cupcakes" render={() => <div>cup</div>}/>
134+
</Switch>
135+
</MemoryRouter>
136+
), node)
137+
138+
expect(node.innerHTML).toNotContain('bub')
139+
expect(node.innerHTML).toContain('cup')
140+
})
124141
})

0 commit comments

Comments
 (0)