From 896fe4b7ecf3f929aa60aacb9ac848a725badb6d Mon Sep 17 00:00:00 2001 From: Moong0122 Date: Sun, 4 Oct 2020 19:25:11 +0900 Subject: [PATCH] [Tests] `jsx-indent-props` : Apply indentation when used expression Closes #1187. --- CHANGELOG.md | 3 ++- tests/lib/rules/jsx-indent-props.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9ec04130..0f1fc5f8f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,11 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ### Fixed * [`no-unused-prop-types`]: Silence false positive on `never` type in TS ([#2815][] @pcorpet) -* [`jsx-indent-props`]: Apply indentation when operator is used in front of the upper line ([#2808][] @Moong0122) +* [`jsx-indent-props`]: Apply indentation when operator is used in front of the upper line ([#2808][], [#2820][] @Moong0122) * [Deps] update `jsx-ast-utils` ([#2822][] [jsx-eslint/jsx-ast-utils#102][] @ljharb) [#2822]: https://github.com/yannickcr/eslint-plugin-react/issues/2822 +[#2820]: https://github.com/yannickcr/eslint-plugin-react/pull/2820 [#2815]: https://github.com/yannickcr/eslint-plugin-react/pull/2815 [#2808]: https://github.com/yannickcr/eslint-plugin-react/pull/2808 [jsx-eslint/jsx-ast-utils#102]: https://github.com/jsx-eslint/jsx-ast-utils/pull/102 diff --git a/tests/lib/rules/jsx-indent-props.js b/tests/lib/rules/jsx-indent-props.js index 0cd1de59ba..cc037fa39b 100644 --- a/tests/lib/rules/jsx-indent-props.js +++ b/tests/lib/rules/jsx-indent-props.js @@ -228,6 +228,28 @@ ruleTester.run('jsx-indent-props', rule, { {message: 'Expected indentation of 6 space characters but found 4.'}, {message: 'Expected indentation of 6 space characters but found 4.'} ] + }, { + code: [ + '{this.props.test', + ' ? ', + ' : null}' + ].join('\n'), + output: [ + '{this.props.test', + ' ? ', + ' : null}' + ].join('\n'), + options: [2], + errors: [ + {message: 'Expected indentation of 6 space characters but found 4.'}, + {message: 'Expected indentation of 6 space characters but found 4.'} + ] }, { code: [ '