Skip to content

Commit

Permalink
test(prop-types): Add import test with Union
Browse files Browse the repository at this point in the history
  • Loading branch information
justinanastos committed Nov 24, 2017
1 parent 78ec577 commit 6323015
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions tests/lib/rules/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,17 @@ ruleTester.run('prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'import type { FieldProps } from "redux-form"',
'',
'type Props = {',
'label: string,',
' type: string,',
' options: Array<SelectOption>',
'} & FieldProps'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'Card.propTypes = {',
Expand Down Expand Up @@ -1699,7 +1710,7 @@ ruleTester.run('prop-types', rule, {
class Bar extends React.Component {
props: Props;
render() {
return <div>{this.props.foo} - {this.props.bar}</div>
}
Expand All @@ -1715,7 +1726,7 @@ ruleTester.run('prop-types', rule, {
class Bar extends React.Component {
props: Props & PropsC;
render() {
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
}
Expand All @@ -1731,7 +1742,7 @@ ruleTester.run('prop-types', rule, {
class Bar extends React.Component {
props: Props & PropsC;
render() {
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
}
Expand All @@ -1743,12 +1754,12 @@ ruleTester.run('prop-types', rule, {
type PropsA = { bar: string };
type PropsB = { zap: string };
type Props = PropsA & {
baz: string
baz: string
};
class Bar extends React.Component {
props: Props & PropsB;
render() {
return <div>{this.props.bar} - {this.props.zap} - {this.props.baz}</div>
}
Expand All @@ -1760,12 +1771,12 @@ ruleTester.run('prop-types', rule, {
type PropsA = { bar: string };
type PropsB = { zap: string };
type Props = {
baz: string
baz: string
} & PropsA;
class Bar extends React.Component {
props: Props & PropsB;
render() {
return <div>{this.props.bar} - {this.props.zap} - {this.props.baz}</div>
}
Expand Down Expand Up @@ -3453,7 +3464,7 @@ ruleTester.run('prop-types', rule, {
class MyComponent extends React.Component {
props: Props;
render() {
return <div>{this.props.foo} - {this.props.bar} - {this.props.fooBar}</div>
}
Expand All @@ -3472,7 +3483,7 @@ ruleTester.run('prop-types', rule, {
class Bar extends React.Component {
props: Props & PropsC;
render() {
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap} - {this.props.fooBar}</div>
}
Expand All @@ -3487,12 +3498,12 @@ ruleTester.run('prop-types', rule, {
type PropsB = { bar: string };
type PropsC = { zap: string };
type Props = PropsB & {
baz: string
baz: string
};
class Bar extends React.Component {
props: Props & PropsC;
render() {
return <div>{this.props.bar} - {this.props.baz} - {this.props.fooBar}</div>
}
Expand All @@ -3507,12 +3518,12 @@ ruleTester.run('prop-types', rule, {
type PropsB = { bar: string };
type PropsC = { zap: string };
type Props = {
baz: string
baz: string
} & PropsB;
class Bar extends React.Component {
props: Props & PropsC;
render() {
return <div>{this.props.bar} - {this.props.baz} - {this.props.fooBar}</div>
}
Expand Down

0 comments on commit 6323015

Please sign in to comment.