Skip to content

Commit

Permalink
Add more invalid tests for boolean-prop-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jomasti committed Nov 22, 2017
1 parent ca23ff4 commit a73d574
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,5 +578,41 @@ ruleTester.run('boolean-prop-naming', rule, {
errors: [{
message: 'Prop name (showScore) doesn\'t match rule (^(is|has)[A-Z]([A-Za-z0-9]?)+)'
}]
}, {
code: `
function Card(props) {
return <div>{props.showScore ? 'yeh' : 'no'}</div>;
}
Card.propTypes = forbidExtraProps({
showScore: PropTypes.bool
});`,
settings: {
propWrapperFunctions: ['forbidExtraProps']
},
options: [{
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+'
}],
errors: [{
message: 'Prop name (showScore) doesn\'t match rule (^(is|has)[A-Z]([A-Za-z0-9]?)+)'
}]
}, {
code: `
class Card extends React.Component {
render() {
return <div>{props.showScore ? 'yeh' : 'no'}</div>;
}
}
Card.propTypes = forbidExtraProps({
showScore: PropTypes.bool
});`,
settings: {
propWrapperFunctions: ['forbidExtraProps']
},
options: [{
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+'
}],
errors: [{
message: 'Prop name (showScore) doesn\'t match rule (^(is|has)[A-Z]([A-Za-z0-9]?)+)'
}]
}]
});

0 comments on commit a73d574

Please sign in to comment.