Skip to content

Commit 26eadf5

Browse files
Stefan Buckljharb
authored andcommitted
Add failing test case for jsx-indent
1 parent e747459 commit 26eadf5

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

tests/lib/rules/jsx-indent.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,26 @@ const Component = () => (
820820
);
821821
`,
822822
options: ['tab', {checkAttributes: false}]
823+
}, {
824+
code: [
825+
'function App() {',
826+
' return (',
827+
' <App />',
828+
' );',
829+
'}'
830+
].join('\n'),
831+
options: [2],
832+
parserOptions: parserOptions
833+
}, {
834+
code: [
835+
'function App() {',
836+
' return <App>',
837+
' <Foo />',
838+
' </App>;',
839+
'}'
840+
].join('\n'),
841+
options: [2],
842+
parserOptions: parserOptions
823843
}],
824844

825845
invalid: [{
@@ -920,6 +940,28 @@ const Component = () => (
920940
].join('\n'),
921941
options: [2],
922942
errors: [{message: 'Expected indentation of 2 space characters but found 4.'}]
943+
}, {
944+
code: [
945+
'function App() {',
946+
' return (<App>',
947+
' <Foo />',
948+
' </App>);',
949+
'}'
950+
].join('\n'),
951+
output: [
952+
'function App() {',
953+
' return (',
954+
' <App>',
955+
' <Foo />',
956+
' </App>',
957+
' );',
958+
'}'
959+
].join('\n'),
960+
options: [2],
961+
errors: [{
962+
line: 5,
963+
message: 'Expected indentation of 4 space characters but found 6.'
964+
}]
923965
}, {
924966
code: [
925967
'function App() {',
@@ -1640,5 +1682,27 @@ const Component = () => (
16401682
errors: [
16411683
{message: 'Expected indentation of 2 tab characters but found 0.'}
16421684
]
1685+
}, {
1686+
code: [
1687+
'function App() {',
1688+
' return (',
1689+
' <App />',
1690+
' );',
1691+
'}'
1692+
].join('\n'),
1693+
options: [2],
1694+
parserOptions: parserOptions,
1695+
errors: [{message: 'Expected indentation of 2 space characters but found 4.'}]
1696+
}, {
1697+
code: [
1698+
'function App() {',
1699+
' return (',
1700+
' <App />',
1701+
');',
1702+
'}'
1703+
].join('\n'),
1704+
options: [2],
1705+
parserOptions: parserOptions,
1706+
errors: [{message: 'Expected indentation of 2 space characters but found 0.'}]
16431707
}]
16441708
});

0 commit comments

Comments
 (0)