diff --git a/tests/standard/__snapshots__/jsfmt.spec.js.snap b/tests/standard/__snapshots__/jsfmt.spec.js.snap index babaa312fb..77210fd6d3 100644 --- a/tests/standard/__snapshots__/jsfmt.spec.js.snap +++ b/tests/standard/__snapshots__/jsfmt.spec.js.snap @@ -2159,3 +2159,53 @@ const StorybookLoader = ({ match }) => ================================================================================ `; + +exports[`nested-ternary-promises.js 1`] = ` +====================================options===================================== +alignTernaryLines: false +arrowParens: "avoid" +endOfLine: "lf" +generatorStarSpacing: true +jsxSingleQuote: true +parsers: ["babel", "babel-flow", "flow", "typescript"] +printWidth: 80 +semi: false +singleQuote: true +spaceBeforeFunctionParen: true +trailingComma: "none" +yieldStarSpacing: true + | printWidth +=====================================input====================================== +// check for consistent formatting as discussed in: +// - https://github.com/eslint/eslint/issues/13971 +// - https://github.com/standard/standard/issues/1624 +// - https://github.com/brodybits/prettierx/issues/41 + +function test1() { + return condition1 + ? condition2 + ? Promise(1) + : Promise(2) + : condition3 + ? Promise(3) + : Promise(4) +} + +=====================================output===================================== +// check for consistent formatting as discussed in: +// - https://github.com/eslint/eslint/issues/13971 +// - https://github.com/standard/standard/issues/1624 +// - https://github.com/brodybits/prettierx/issues/41 + +function test1 () { + return condition1 + ? condition2 + ? Promise(1) + : Promise(2) + : condition3 + ? Promise(3) + : Promise(4) +} + +================================================================================ +`; diff --git a/tests/standard/nested-ternary-promises.js b/tests/standard/nested-ternary-promises.js new file mode 100644 index 0000000000..59fd9d27aa --- /dev/null +++ b/tests/standard/nested-ternary-promises.js @@ -0,0 +1,14 @@ +// check for consistent formatting as discussed in: +// - https://github.com/eslint/eslint/issues/13971 +// - https://github.com/standard/standard/issues/1624 +// - https://github.com/brodybits/prettierx/issues/41 + +function test1() { + return condition1 + ? condition2 + ? Promise(1) + : Promise(2) + : condition3 + ? Promise(3) + : Promise(4) +}