From 26eadf5276063000084a9d7f646857c4cc2f8ab0 Mon Sep 17 00:00:00 2001 From: Stefan Buck Date: Fri, 3 Jun 2016 15:32:29 +0200 Subject: [PATCH] Add failing test case for jsx-indent --- tests/lib/rules/jsx-indent.js | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 75584a32bf..eb796b04cd 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -820,6 +820,26 @@ const Component = () => ( ); `, options: ['tab', {checkAttributes: false}] + }, { + code: [ + 'function App() {', + ' return (', + ' ', + ' );', + '}' + ].join('\n'), + options: [2], + parserOptions: parserOptions + }, { + code: [ + 'function App() {', + ' return ', + ' ', + ' ;', + '}' + ].join('\n'), + options: [2], + parserOptions: parserOptions }], invalid: [{ @@ -920,6 +940,28 @@ const Component = () => ( ].join('\n'), options: [2], errors: [{message: 'Expected indentation of 2 space characters but found 4.'}] + }, { + code: [ + 'function App() {', + ' return (', + ' ', + ' );', + '}' + ].join('\n'), + output: [ + 'function App() {', + ' return (', + ' ', + ' ', + ' ', + ' );', + '}' + ].join('\n'), + options: [2], + errors: [{ + line: 5, + message: 'Expected indentation of 4 space characters but found 6.' + }] }, { code: [ 'function App() {', @@ -1640,5 +1682,27 @@ const Component = () => ( errors: [ {message: 'Expected indentation of 2 tab characters but found 0.'} ] + }, { + code: [ + 'function App() {', + ' return (', + ' ', + ' );', + '}' + ].join('\n'), + options: [2], + parserOptions: parserOptions, + errors: [{message: 'Expected indentation of 2 space characters but found 4.'}] + }, { + code: [ + 'function App() {', + ' return (', + ' ', + ');', + '}' + ].join('\n'), + options: [2], + parserOptions: parserOptions, + errors: [{message: 'Expected indentation of 2 space characters but found 0.'}] }] });