Skip to content

WIP: Add failing test for synthetic default #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/__tests__/data/SyntheticDefaultComponent.tsx
Original file line number Diff line number Diff line change
@@ -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<Props> {
render() {
return <div>{this.props.prop1 && this.props.prop2}</div>;
}
}
8 changes: 8 additions & 0 deletions src/__tests__/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down