Skip to content

Commit a131363

Browse files
committed
[Tests]prop-types: add passing test case about array.length
Closes jsx-eslint#1047
1 parent 2f6d828 commit a131363

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,20 @@ ruleTester.run('prop-types', rule, {
483483
' )',
484484
'};'
485485
].join('\n')
486+
}, {
487+
code: `
488+
class ArrayLengthTest extends React.Component {
489+
render() {
490+
use(this.props.arr.length)
491+
use(this.props.arr2.length)
492+
return <div />
493+
}
494+
}
495+
496+
ArrayLengthTest.propTypes = {
497+
arr: PropTypes.array,
498+
arr2: PropTypes.arrayOf(PropTypes.number),
499+
}`
486500
}, {
487501
code: [
488502
'var TestComp1 = createReactClass({',

0 commit comments

Comments
 (0)