Skip to content

Commit 4727bc0

Browse files
committed
[Tests] jsx-indent: add passing tests
Closes #902
1 parent 42eaadc commit 4727bc0

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

tests/lib/rules/jsx-indent.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,24 @@ const Component = () => (
11161116
options: [2],
11171117
parserOptions,
11181118
},
1119+
{
1120+
code: `
1121+
const myFunction = () => (
1122+
[
1123+
<Tag
1124+
{...properties}
1125+
/>,
1126+
<Tag
1127+
{...properties}
1128+
/>,
1129+
<Tag
1130+
{...properties}
1131+
/>,
1132+
]
1133+
)
1134+
`,
1135+
options: [2],
1136+
},
11191137
]),
11201138

11211139
invalid: parsers.all([
@@ -2853,5 +2871,40 @@ const Component = () => (
28532871
parserOptions,
28542872
errors: [{ message: 'Expected indentation of 10 space characters but found 8.' }],
28552873
},
2874+
{
2875+
code: `
2876+
{condition && [
2877+
<Tag key="a" onClick={() => {
2878+
// some code
2879+
}} />,
2880+
<Tag key="b" onClick={() => {
2881+
// some code
2882+
}} />,
2883+
]
2884+
}
2885+
`,
2886+
output: `
2887+
{condition && [
2888+
<Tag key="a" onClick={() => {
2889+
// some code
2890+
}} />,
2891+
<Tag key="b" onClick={() => {
2892+
// some code
2893+
}} />,
2894+
]
2895+
}
2896+
`,
2897+
options: [2],
2898+
errors: [
2899+
{
2900+
message: 'Expected indentation of 10 space characters but found 12.',
2901+
line: 3,
2902+
},
2903+
{
2904+
message: 'Expected indentation of 10 space characters but found 12.',
2905+
line: 6,
2906+
},
2907+
],
2908+
},
28562909
]),
28572910
});

0 commit comments

Comments
 (0)