Skip to content

Commit

Permalink
jsx-max-props-per-line: Add additional test cases
Browse files Browse the repository at this point in the history
Make sure it works when a prop is on the same line as the start line of
the tag, as well as with spread props that spans multiple lines.
  • Loading branch information
kentor committed Jan 29, 2017
1 parent bcb7812 commit 7f44442
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/lib/rules/jsx-max-props-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ ruleTester.run('jsx-max-props-per-line', rule, {
code: '<App foo bar />',
options: [{when: 'multiline'}],
parserOptions: parserOptions
}, {
code: '<App foo {...this.props} />',
options: [{when: 'multiline'}],
parserOptions: parserOptions
}, {
code: '<App foo bar baz />',
options: [{maximum: 2, when: 'multiline'}],
Expand Down Expand Up @@ -109,6 +113,46 @@ ruleTester.run('jsx-max-props-per-line', rule, {
].join('\n'),
errors: [{message: 'Prop `bar` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App foo={{',
'}} bar />'
].join('\n'),
errors: [{message: 'Prop `bar` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App foo bar={{',
'}} baz />'
].join('\n'),
options: [{maximum: 2}],
errors: [{message: 'Prop `baz` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App foo={{',
'}} {...rest} />'
].join('\n'),
errors: [{message: 'Prop `rest` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App {',
' ...this.props',
'} bar />'
].join('\n'),
errors: [{message: 'Prop `bar` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App {',
' ...this.props',
'} {',
' ...rest',
'} />'
].join('\n'),
errors: [{message: 'Prop `rest` must be placed on a new line'}],
parserOptions: parserOptions
}, {
code: [
'<App',
Expand Down

0 comments on commit 7f44442

Please sign in to comment.