We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd3772f commit 100fee6Copy full SHA for 100fee6
src/__tests__/visitor.test.js
@@ -324,4 +324,16 @@ describe('visitElement', () => {
324
expect(children[0].type).toBe(Noop)
325
expect(children[0].props.children).toBe('test')
326
})
327
+
328
+ it('renders function components with default props', () => {
329
+ const Test = props => <Noop>{props.value}</Noop>
330
331
+ Test.defaultProps = { value: 'default' }
332
333
+ const childA = visitElement(<Test />, [], () => {})[0]
334
+ expect(childA.props.children).toBe('default')
335
336
+ const childB = visitElement(<Test value="test" />, [], () => {})[0]
337
+ expect(childB.props.children).toBe('test')
338
+ })
339
0 commit comments