From ce54181c14e80be6905b014d1c6fb012f499b590 Mon Sep 17 00:00:00 2001 From: Mikhail Donskoy Date: Wed, 3 Apr 2019 22:58:10 +0300 Subject: [PATCH] Add tests for jsx-indent rule with indentLogicalExpressions option enabled. --- tests/lib/rules/jsx-indent.js | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 43d6a80a70..bb5429cab6 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -832,6 +832,19 @@ const Component = () => ( } `, options: [2, {checkAttributes: true}] + }, { + code: ` + function Foo() { + return ( +
+ {condition && ( +

Bar

+ )} +
+ ); + } + `, + options: [2, {indentLogicalExpressions: true}] }], invalid: [{ @@ -1652,5 +1665,32 @@ const Component = () => ( errors: [ {message: 'Expected indentation of 2 tab characters but found 0.'} ] + }, { + code: ` + function Foo() { + return ( +
+ {condition && ( +

Bar

+ )} +
+ ); + } + `, + output: ` + function Foo() { + return ( +
+ {condition && ( +

Bar

+ )} +
+ ); + } + `, + options: [2, {indentLogicalExpressions: true}], + errors: [ + {message: 'Expected indentation of 12 space characters but found 10.'} + ] }] });