Skip to content

Commit ce54181

Browse files
committed
Add tests for jsx-indent rule with indentLogicalExpressions option enabled.
1 parent 34ce0e7 commit ce54181

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/lib/rules/jsx-indent.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,19 @@ const Component = () => (
832832
}
833833
`,
834834
options: [2, {checkAttributes: true}]
835+
}, {
836+
code: `
837+
function Foo() {
838+
return (
839+
<div>
840+
{condition && (
841+
<p>Bar</p>
842+
)}
843+
</div>
844+
);
845+
}
846+
`,
847+
options: [2, {indentLogicalExpressions: true}]
835848
}],
836849

837850
invalid: [{
@@ -1652,5 +1665,32 @@ const Component = () => (
16521665
errors: [
16531666
{message: 'Expected indentation of 2 tab characters but found 0.'}
16541667
]
1668+
}, {
1669+
code: `
1670+
function Foo() {
1671+
return (
1672+
<div>
1673+
{condition && (
1674+
<p>Bar</p>
1675+
)}
1676+
</div>
1677+
);
1678+
}
1679+
`,
1680+
output: `
1681+
function Foo() {
1682+
return (
1683+
<div>
1684+
{condition && (
1685+
<p>Bar</p>
1686+
)}
1687+
</div>
1688+
);
1689+
}
1690+
`,
1691+
options: [2, {indentLogicalExpressions: true}],
1692+
errors: [
1693+
{message: 'Expected indentation of 12 space characters but found 10.'}
1694+
]
16551695
}]
16561696
});

0 commit comments

Comments
 (0)