Skip to content

Commit 0f09f81

Browse files
committed
[Tests] jsx-indent: add passing test case
Closes #1662
1 parent d6f8738 commit 0f09f81

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

tests/lib/rules/jsx-indent.js

+36-2
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ const Component = () => (
11641164
},
11651165
]),
11661166

1167-
invalid: parsers.all([
1167+
invalid: parsers.all([].concat(
11681168
{
11691169
code: `
11701170
<div>
@@ -2934,5 +2934,39 @@ const Component = () => (
29342934
},
29352935
],
29362936
},
2937-
]),
2937+
semver.satisfies(eslintVersion, '> 4') ? {
2938+
code: `
2939+
import React from 'react';
2940+
2941+
export default function () {
2942+
return (
2943+
<div>
2944+
Test1
2945+
2946+
<p>Test2</p>
2947+
</div>
2948+
);
2949+
}
2950+
`,
2951+
// TODO: remove two spaces from the Test2 output line
2952+
output: `
2953+
import React from 'react';
2954+
2955+
export default function () {
2956+
return (
2957+
<div>
2958+
Test1
2959+
2960+
<p>Test2</p>
2961+
</div>
2962+
);
2963+
}
2964+
`,
2965+
options: [4],
2966+
errors: [
2967+
{ messageId: 'wrongIndent', line: 6 },
2968+
{ messageId: 'wrongIndent', line: 9 },
2969+
],
2970+
} : []
2971+
)),
29382972
});

0 commit comments

Comments
 (0)