Skip to content

Commit

Permalink
Add tests for jsx-indent rule with indentLogicalExpressions option en…
Browse files Browse the repository at this point in the history
…abled.
  • Loading branch information
mdnsk committed Apr 3, 2019
1 parent 34ce0e7 commit ce54181
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/lib/rules/jsx-indent.js
Expand Up @@ -832,6 +832,19 @@ const Component = () => (
}
`,
options: [2, {checkAttributes: true}]
}, {
code: `
function Foo() {
return (
<div>
{condition && (
<p>Bar</p>
)}
</div>
);
}
`,
options: [2, {indentLogicalExpressions: true}]
}],

invalid: [{
Expand Down Expand Up @@ -1652,5 +1665,32 @@ const Component = () => (
errors: [
{message: 'Expected indentation of 2 tab characters but found 0.'}
]
}, {
code: `
function Foo() {
return (
<div>
{condition && (
<p>Bar</p>
)}
</div>
);
}
`,
output: `
function Foo() {
return (
<div>
{condition && (
<p>Bar</p>
)}
</div>
);
}
`,
options: [2, {indentLogicalExpressions: true}],
errors: [
{message: 'Expected indentation of 12 space characters but found 10.'}
]
}]
});

0 comments on commit ce54181

Please sign in to comment.