Skip to content

Commit

Permalink
Add test cases for arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ColCh committed Aug 29, 2016
1 parent 9f76459 commit 321f354
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/lib/rules/jsx-wrap-multilines.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ var ASSIGNMENT_NO_PAREN = '\
<p>Hello</p>\n\
</div>;';

var ARROW_SINGLE_LINE = 'var hello = () => <p>Hello</p>;';

var ARROW_PAREN = '\
var hello = () => (<div>\n\
<p>Hello</p>\n\
</div>);';

var ARROW_NO_PAREN = '\
var hello = () => <div>\n\
<p>Hello</p>\n\
</div>;';

// ------------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------------
Expand Down Expand Up @@ -112,6 +124,18 @@ ruleTester.run('jsx-wrap-multilines', rule, {
code: ASSIGNMENT_NO_PAREN,
options: [{assignment: false}],
parserOptions: parserOptions
}, {
code: ARROW_PAREN,
options: [],
parserOptions: parserOptions
}, {
code: ARROW_SINGLE_LINE,
options: [],
parserOptions: parserOptions
}, {
code: ARROW_NO_PAREN,
options: [{arrow: false}],
parserOptions: parserOptions
}
],

Expand Down Expand Up @@ -149,6 +173,12 @@ ruleTester.run('jsx-wrap-multilines', rule, {
parserOptions: parserOptions,
options: [{assignment: true}],
errors: [{message: 'Missing parentheses around multilines JSX'}]
}, {
code: ARROW_NO_PAREN,
output: ARROW_PAREN,
parserOptions: parserOptions,
options: [{arrow: true}],
errors: [{message: 'Missing parentheses around multilines JSX'}]
}
]
});

0 comments on commit 321f354

Please sign in to comment.