Skip to content

Commit 6323015

Browse files
committed
test(prop-types): Add import test with Union
1 parent 78ec577 commit 6323015

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

tests/lib/rules/prop-types.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,17 @@ ruleTester.run('prop-types', rule, {
11511151
'}'
11521152
].join('\n'),
11531153
parser: 'babel-eslint'
1154+
}, {
1155+
code: [
1156+
'import type { FieldProps } from "redux-form"',
1157+
'',
1158+
'type Props = {',
1159+
'label: string,',
1160+
' type: string,',
1161+
' options: Array<SelectOption>',
1162+
'} & FieldProps'
1163+
].join('\n'),
1164+
parser: 'babel-eslint'
11541165
}, {
11551166
code: [
11561167
'Card.propTypes = {',
@@ -1699,7 +1710,7 @@ ruleTester.run('prop-types', rule, {
16991710
17001711
class Bar extends React.Component {
17011712
props: Props;
1702-
1713+
17031714
render() {
17041715
return <div>{this.props.foo} - {this.props.bar}</div>
17051716
}
@@ -1715,7 +1726,7 @@ ruleTester.run('prop-types', rule, {
17151726
17161727
class Bar extends React.Component {
17171728
props: Props & PropsC;
1718-
1729+
17191730
render() {
17201731
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
17211732
}
@@ -1731,7 +1742,7 @@ ruleTester.run('prop-types', rule, {
17311742
17321743
class Bar extends React.Component {
17331744
props: Props & PropsC;
1734-
1745+
17351746
render() {
17361747
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
17371748
}
@@ -1743,12 +1754,12 @@ ruleTester.run('prop-types', rule, {
17431754
type PropsA = { bar: string };
17441755
type PropsB = { zap: string };
17451756
type Props = PropsA & {
1746-
baz: string
1757+
baz: string
17471758
};
17481759
17491760
class Bar extends React.Component {
17501761
props: Props & PropsB;
1751-
1762+
17521763
render() {
17531764
return <div>{this.props.bar} - {this.props.zap} - {this.props.baz}</div>
17541765
}
@@ -1760,12 +1771,12 @@ ruleTester.run('prop-types', rule, {
17601771
type PropsA = { bar: string };
17611772
type PropsB = { zap: string };
17621773
type Props = {
1763-
baz: string
1774+
baz: string
17641775
} & PropsA;
17651776
17661777
class Bar extends React.Component {
17671778
props: Props & PropsB;
1768-
1779+
17691780
render() {
17701781
return <div>{this.props.bar} - {this.props.zap} - {this.props.baz}</div>
17711782
}
@@ -3453,7 +3464,7 @@ ruleTester.run('prop-types', rule, {
34533464
34543465
class MyComponent extends React.Component {
34553466
props: Props;
3456-
3467+
34573468
render() {
34583469
return <div>{this.props.foo} - {this.props.bar} - {this.props.fooBar}</div>
34593470
}
@@ -3472,7 +3483,7 @@ ruleTester.run('prop-types', rule, {
34723483
34733484
class Bar extends React.Component {
34743485
props: Props & PropsC;
3475-
3486+
34763487
render() {
34773488
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap} - {this.props.fooBar}</div>
34783489
}
@@ -3487,12 +3498,12 @@ ruleTester.run('prop-types', rule, {
34873498
type PropsB = { bar: string };
34883499
type PropsC = { zap: string };
34893500
type Props = PropsB & {
3490-
baz: string
3501+
baz: string
34913502
};
34923503
34933504
class Bar extends React.Component {
34943505
props: Props & PropsC;
3495-
3506+
34963507
render() {
34973508
return <div>{this.props.bar} - {this.props.baz} - {this.props.fooBar}</div>
34983509
}
@@ -3507,12 +3518,12 @@ ruleTester.run('prop-types', rule, {
35073518
type PropsB = { bar: string };
35083519
type PropsC = { zap: string };
35093520
type Props = {
3510-
baz: string
3521+
baz: string
35113522
} & PropsB;
35123523
35133524
class Bar extends React.Component {
35143525
props: Props & PropsC;
3515-
3526+
35163527
render() {
35173528
return <div>{this.props.bar} - {this.props.baz} - {this.props.fooBar}</div>
35183529
}

0 commit comments

Comments
 (0)