diff --git a/src/__tests__/data/SyntheticDefaultComponent.tsx b/src/__tests__/data/SyntheticDefaultComponent.tsx new file mode 100644 index 00000000..b22cd32c --- /dev/null +++ b/src/__tests__/data/SyntheticDefaultComponent.tsx @@ -0,0 +1,17 @@ +import React from 'react'; + +export interface Props { + /** prop1 description */ + prop1: boolean; + /** prop2 description */ + prop2: string; +} + +/** + * SyntheticDefaultComponent description + */ +export default class SimpleComponent extends React.Component { + render() { + return
{this.props.prop1 && this.props.prop2}
; + } +} diff --git a/src/__tests__/parser.ts b/src/__tests__/parser.ts index 300a8347..f9cc02da 100644 --- a/src/__tests__/parser.ts +++ b/src/__tests__/parser.ts @@ -6,6 +6,14 @@ import { check, checkComponent, fixturePath } from './testUtils'; describe('parser', () => { const children = { type: 'ReactNode', required: false, description: '' }; + it('should parse a react class component using synthetic default export', () => { + check('SyntheticDefaultComponent', { + SyntheticDefaultComponent: { + prop1: { type: 'boolean' }, + prop2: { type: 'string' } + } + }); + }); it('should parse simple react class component', () => { check('Column', { Column: {