From bee139928200ea59fd68c284e47ef5da4c5800ae Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 15 Aug 2026 17:30:50 +0800 Subject: [PATCH] Improve tests for JSX quotes (#19856) --- .../jsx/jsx/__snapshots__/format.test.js.snap | 4868 +---------------- .../jsx/{flow_fix_me.js => flow-fix-me.js} | 0 tests/format/jsx/jsx/format.test.js | 17 +- .../jsx/{html_escape.js => html-escape.js} | 0 .../quotes/__snapshots__/format.test.js.snap | 389 ++ tests/format/jsx/quotes/format.test.js | 16 + tests/format/jsx/{jsx => quotes}/quotes.js | 0 7 files changed, 425 insertions(+), 4865 deletions(-) rename tests/format/jsx/jsx/{flow_fix_me.js => flow-fix-me.js} (100%) rename tests/format/jsx/jsx/{html_escape.js => html-escape.js} (100%) create mode 100644 tests/format/jsx/quotes/__snapshots__/format.test.js.snap create mode 100644 tests/format/jsx/quotes/format.test.js rename tests/format/jsx/{jsx => quotes}/quotes.js (100%) diff --git a/tests/format/jsx/jsx/__snapshots__/format.test.js.snap b/tests/format/jsx/jsx/__snapshots__/format.test.js.snap index 6124d6237..e3cbbdbd4 100644 --- a/tests/format/jsx/jsx/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/jsx/__snapshots__/format.test.js.snap @@ -1,10 +1,8 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`array-iter.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` +exports[`array-iter.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: false parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== const UsersList = ({ users }) => ( @@ -77,242 +75,9 @@ const TodoList = ({ todos }) => ( ================================================================================ `; -exports[`array-iter.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`arrow.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-) - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter(scope => scope.value !== '') - .map((scope, i) => ( - - ))} -
- -=====================================output===================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-); - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter((scope) => scope.value !== "") - .map((scope, i) => ( - - ))} -
; - -================================================================================ -`; - -exports[`array-iter.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-) - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter(scope => scope.value !== '') - .map((scope, i) => ( - - ))} -
- -=====================================output===================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-); - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter((scope) => scope.value !== '') - .map((scope, i) => ( - - ))} -
; - -================================================================================ -`; - -exports[`array-iter.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-) - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter(scope => scope.value !== '') - .map((scope, i) => ( - - ))} -
- -=====================================output===================================== -const UsersList = ({ users }) => ( -
-

Users list

- -
-); - -const TodoList = ({ todos }) => ( -
- -
-); - -
- {scopes - .filter((scope) => scope.value !== '') - .map((scope, i) => ( - - ))} -
; - -================================================================================ -`; - -exports[`arrow.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== () => ; @@ -399,284 +164,9 @@ singleQuote: false ================================================================================ `; -exports[`arrow.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`attr-comments.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -() => ; -() => () => ; -() => () => () => ; - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() =>
Long long long long long, very very long text. And more text. Another text.
; -() => () =>
Long long long long long, very very long text. And more text. Another text.
; -() => () => () =>
Long long long long long, very very long text. And more text. Another text.
; - - - {We => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => currying => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - -=====================================output===================================== -() => ( - - - -); -() => () => ( - - - -); -() => () => () => ( - - - -); - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); - - - {(We) => - "The purple monkey danced with a tambourine made of cheese." + - "The robot chef cooked a cake that tasted like rainbows." + - "The talking pineapple sang a lullaby to the sleepy giraffe." - } -; - - {(We) => (love) => - "The purple monkey danced with a tambourine made of cheese." + - "The robot chef cooked a cake that tasted like rainbows." + - "The talking pineapple sang a lullaby to the sleepy giraffe." - } -; - - {(We) => (love) => (currying) => - "The purple monkey danced with a tambourine made of cheese." + - "The robot chef cooked a cake that tasted like rainbows." + - "The talking pineapple sang a lullaby to the sleepy giraffe." - } -; - -================================================================================ -`; - -exports[`arrow.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -() => ; -() => () => ; -() => () => () => ; - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() =>
Long long long long long, very very long text. And more text. Another text.
; -() => () =>
Long long long long long, very very long text. And more text. Another text.
; -() => () => () =>
Long long long long long, very very long text. And more text. Another text.
; - - - {We => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => currying => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - -=====================================output===================================== -() => ( - - - -); -() => () => ( - - - -); -() => () => () => ( - - - -); - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); - - - {(We) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - - {(We) => (love) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - - {(We) => (love) => (currying) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - -================================================================================ -`; - -exports[`arrow.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -() => ; -() => () => ; -() => () => () => ; - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() =>
Long long long long long, very very long text. And more text. Another text.
; -() => () =>
Long long long long long, very very long text. And more text. Another text.
; -() => () => () =>
Long long long long long, very very long text. And more text. Another text.
; - - - {We => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - - {We => love => currying => 'The purple monkey danced with a tambourine made of cheese.' + 'The robot chef cooked a cake that tasted like rainbows.' + 'The talking pineapple sang a lullaby to the sleepy giraffe.'} -; - -=====================================output===================================== -() => ( - - - -); -() => () => ( - - - -); -() => () => () => ( - - - -); - -() =>
Some text here
; -() => () =>
Some text here
; -() => () => () =>
Some text here
; - -() => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); -() => () => () => ( -
- Long long long long long, very very long text. And more text. Another text. -
-); - - - {(We) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - - {(We) => (love) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - - {(We) => (love) => (currying) => - 'The purple monkey danced with a tambourine made of cheese.' + - 'The robot chef cooked a cake that tasted like rainbows.' + - 'The talking pineapple sang a lullaby to the sleepy giraffe.' - } -; - -================================================================================ -`; - -exports[`attr-comments.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== fn(arg) - } - propArrowWithBreak={ - // comment - arg => - fn({ - makeItBreak - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -=====================================output===================================== - fn(arg) - } - propArrowWithBreak={ - // comment - (arg) => - fn({ - makeItBreak, - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -================================================================================ -`; - -exports[`attr-comments.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== - fn(arg) - } - propArrowWithBreak={ - // comment - arg => - fn({ - makeItBreak - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -=====================================output===================================== - fn(arg) - } - propArrowWithBreak={ - // comment - (arg) => - fn({ - makeItBreak, - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -================================================================================ -`; - -exports[`attr-comments.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== - fn(arg) - } - propArrowWithBreak={ - // comment - arg => - fn({ - makeItBreak - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -=====================================output===================================== - fn(arg) - } - propArrowWithBreak={ - // comment - (arg) => - fn({ - makeItBreak, - }) - } - propArray={ - // comment - [el1, el2] - } - propObj={ - // comment - { key: val } - } - propTemplate={ - // comment - \`text\` - } -/>; - -================================================================================ -`; - -exports[`await.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== async function testFunction() { @@ -1069,302 +332,9 @@ async function testFunction() { ================================================================================ `; -exports[`await.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`conditional-expression.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -async function testFunction() { - const short = <> - {await Promise.all( - hierarchyCriticism - )} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all( - hierarchyCriticism - )} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - - const long = <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {await hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - - const jsx = <> - {await ( - material education original articulate parameter - )} - -} - -=====================================output===================================== -async function testFunction() { - const short = ( - <> - {await Promise.all(hierarchyCriticism)} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all(hierarchyCriticism)} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - ); - - const long = ( - <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - await hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - ); - - const jsx = ( - <> - {await ( - - material education original articulate parameter - - )} - - ); -} - -================================================================================ -`; - -exports[`await.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -async function testFunction() { - const short = <> - {await Promise.all( - hierarchyCriticism - )} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all( - hierarchyCriticism - )} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - - const long = <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {await hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - - const jsx = <> - {await ( - material education original articulate parameter - )} - -} - -=====================================output===================================== -async function testFunction() { - const short = ( - <> - {await Promise.all(hierarchyCriticism)} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all(hierarchyCriticism)} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - ); - - const long = ( - <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - await hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - ); - - const jsx = ( - <> - {await ( - - material education original articulate parameter - - )} - - ); -} - -================================================================================ -`; - -exports[`await.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -async function testFunction() { - const short = <> - {await Promise.all( - hierarchyCriticism - )} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all( - hierarchyCriticism - )} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - - const long = <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {await hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - )} - {hierarchyCriticism.IncongruousCooperate.MaterialEducation.OriginalArticulate.Parameter} - {hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter} - - - const jsx = <> - {await ( - material education original articulate parameter - )} - -} - -=====================================output===================================== -async function testFunction() { - const short = ( - <> - {await Promise.all(hierarchyCriticism)} - {await hierarchyCriticism.ic.me.oa.p} - {await hierarchyCriticism} - - {Promise.all(hierarchyCriticism)} - {hierarchyCriticism.ic.me.oa.p} - {hierarchyCriticism} - - ); - - const long = ( - <> - {await Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - await hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - await hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - {Promise.all( - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter, - )} - { - hierarchyCriticism.IncongruousCooperate.MaterialEducation - .OriginalArticulate.Parameter - } - { - hierarchyCriticismIncongruousCooperateMaterialEducationOriginalArticulateParameter - } - - ); - - const jsx = ( - <> - {await ( - - material education original articulate parameter - - )} - - ); -} - -================================================================================ -`; - -exports[`conditional-expression.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== // There are two ways to print ConditionalExpressions: "normal mode" and @@ -1676,959 +646,9 @@ foo ? ( ================================================================================ `; -exports[`conditional-expression.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`expression.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? "a" : "b"; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : "c"; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : "a"; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: "a"; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? "a" :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
? ( - "jsx mode from element breaking" -) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - "a" -) : ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
- {a ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - "satellite" -) : isPublic ? ( - "affairs" -) : network ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : sateline ? ( - "public" -) : affairs ? ( - "network" -) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx : -undefined - -=====================================output===================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? "a" : "b"; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : "c"; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : "a"; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: "a"; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? "a" :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
? ( - "jsx mode from element breaking" -) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - "a" -) : ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
{a ? "a" : b ? "b" : "c"}
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - ? "a" - : b - ? "b" - : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - "satellite" -) : isPublic ? ( - "affairs" -) : network ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - "dunno" -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : sateline ? ( - "public" -) : affairs ? ( - "network" -) : ( - "dunno" -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? ( - - loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx - -) : undefined; - -================================================================================ -`; - -exports[`conditional-expression.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? "a" : "b"; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : "c"; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : "a"; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: "a"; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? "a" :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
? ( - "jsx mode from element breaking" -) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - "a" -) : ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
- {a ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - "satellite" -) : isPublic ? ( - "affairs" -) : network ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : sateline ? ( - "public" -) : affairs ? ( - "network" -) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx : -undefined - -=====================================output===================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? 'a' : 'b'; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : 'c'; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : 'a'; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: 'a'; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? 'a' :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
? ( - 'jsx mode from element breaking' -) : ( - 'a' -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - 'a' -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - 'a' -) : ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
{a ? 'a' : b ? 'b' : 'c'}
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - ? 'a' - : b - ? 'b' - : 'c'} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? 'satellite' : isPublic ? 'affairs' : network ? : 'dun'; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - 'satellite' -) : isPublic ? ( - 'affairs' -) : network ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - 'dunno' -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : sateline ? ( - 'public' -) : affairs ? ( - 'network' -) : ( - 'dunno' -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? ( - - loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx - -) : undefined; - -================================================================================ -`; - -exports[`conditional-expression.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? "a" : "b"; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : "c"; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : "a"; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: "a"; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? "a" :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
? ( - "jsx mode from element breaking" -) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : ( - "a" -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - "a" -) : ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
- {a ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo ? "a" : b ? "b" : "c"} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - "satellite" -) : isPublic ? ( - "affairs" -) : network ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo -
-) : sateline ? ( - "public" -) : affairs ? ( - "network" -) : "dunno"; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx : -undefined - -=====================================output===================================== -// There are two ways to print ConditionalExpressions: "normal mode" and -// "JSX mode". This is normal mode (when breaking): -// -// test -// ? consequent -// : alternate; -// -// And this is JSX mode (when breaking): -// -// test ? ( -// consequent -// ) : ( -// alternate -// ); -// -// When non-breaking, they look the same: -// -// test ? consequent : alternate; -// -// We only print a conditional expression in JSX mode if its test, -// consequent, or alternate are JSXElements. -// Otherwise, we print in normal mode. - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// The line does not break. -normalModeNonBreaking ? 'a' : 'b'; - -// This ConditionalExpression has no JSXElements so it prints in normal mode. -// Its consequent is very long, so it breaks out to multiple lines. -normalModeBreaking - ? johnJacobJingleHeimerSchmidtHisNameIsMyNameTooWheneverWeGoOutThePeopleAlwaysShoutThereGoesJohnJacobJingleHeimerSchmidtYaDaDaDaDaDaDa - : 'c'; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is non-breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
? jsxModeFromElementNonBreaking : 'a'; - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ?
: 'a'; - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is non-breaking. -jsxModeFromElementNonBreaking ? 'a' :
; - -// This ConditionalExpression prints in JSX mode because its test is a -// JSXElement. It is breaking. -// Note: I have never, ever seen someone use a JSXElement as the test in a -// ConditionalExpression. But this test is included for completeness. -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
? ( - 'jsx mode from element breaking' -) : ( - 'a' -); - -// This ConditionalExpression prints in JSX mode because its consequent is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - 'a' -); - -// This ConditionalExpression prints in JSX mode because its alternate is a -// JSXElement. It is breaking. -jsxModeFromElementBreaking ? ( - 'a' -) : ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-); - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// non-breaking. -
{a ? 'a' : b ? 'b' : 'c'}
; - -// This chain of ConditionalExpressions prints in JSX mode because the parent of -// the outermost ConditionalExpression is a JSXExpressionContainer. It is -// breaking. -
- {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - ? 'a' - : b - ? 'b' - : 'c'} -
; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is non-breaking. -cable ? 'satellite' : isPublic ? 'affairs' : network ? : 'dun'; - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the end). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( - 'satellite' -) : isPublic ? ( - 'affairs' -) : network ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : ( - 'dunno' -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain (in this case, at the beginning). It is -// breaking; notice the consequents and alternates in the entire chain get -// wrapped in parens. -cable ? ( -
- - thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo - -
-) : sateline ? ( - 'public' -) : affairs ? ( - 'network' -) : ( - 'dunno' -); - -// This chain of ConditionalExpressions prints in JSX mode because there is a -// JSX element somewhere in the chain. It is breaking; notice the consequents -// and alternates in the entire chain get wrapped in parens. -
- {properties.length > 1 || - (properties.length === 1 && properties[0].apps.size > 1) ? ( - draggingApp == null || newPropertyName == null ? ( - - ) : ( - - ) - ) : null} -
; - -// #3552 -foo ? ( - - loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong jsx - -) : undefined; - -================================================================================ -`; - -exports[`expression.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== ; - -; - - - {() => ( - - - - )} -; - - - {items.map(item => ( - - - - ))} -; - - - {function() { - return ( - - - - ); - }} -; - -; - - - test - -}/>; - - doLogClick("short", "short", data)} -/>; - - - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -/>; - - { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -/>; - - - {data => doLogClick("short", "short", data)} -; - - - {data => - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -; - - - {data => { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -=====================================output===================================== -; - -; - - - {() => ( - - - - )} -; - - - {items.map((item) => ( - - - - ))} -; - - - {function () { - return ( - - - - ); - }} -; - -; - -test} />; - - doLogClick("short", "short", data)} -/>; - - - doLogClick( - "long_name_long_name_long_name", - "long_name_long_name_long_name", - data, - ) - } -/>; - - { - doLogClick( - "long_name_long_name_long_name", - "long_name_long_name_long_name", - data, - ); - }} -/>; - - - {(data) => doLogClick("short", "short", data)} -; - - - {(data) => - doLogClick( - "long_name_long_name_long_name", - "long_name_long_name_long_name", - data, - ) - } -; - - - {(data) => { - doLogClick( - "long_name_long_name_long_name", - "long_name_long_name_long_name", - data, - ); - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -================================================================================ -`; - -exports[`expression.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -; - -; - - - {() => ( - - - - )} -; - - - {items.map(item => ( - - - - ))} -; - - - {function() { - return ( - - - - ); - }} -; - -; - - - test - -}/>; - - doLogClick("short", "short", data)} -/>; - - - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -/>; - - { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -/>; - - - {data => doLogClick("short", "short", data)} -; - - - {data => - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -; - - - {data => { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -=====================================output===================================== -; - -; - - - {() => ( - - - - )} -; - - - {items.map((item) => ( - - - - ))} -; - - - {function () { - return ( - - - - ); - }} -; - -; - -test} />; - - doLogClick('short', 'short', data)} -/>; - - - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ) - } -/>; - - { - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ); - }} -/>; - - - {(data) => doLogClick('short', 'short', data)} -; - - - {(data) => - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ) - } -; - - - {(data) => { - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ); - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -================================================================================ -`; - -exports[`expression.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -; - -; - - - {() => ( - - - - )} -; - - - {items.map(item => ( - - - - ))} -; - - - {function() { - return ( - - - - ); - }} -; - -; - - - test - -}/>; - - doLogClick("short", "short", data)} -/>; - - - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -/>; - - { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -/>; - - - {data => doLogClick("short", "short", data)} -; - - - {data => - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - } -; - - - {data => { - doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data) - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -=====================================output===================================== -; - -; - - - {() => ( - - - - )} -; - - - {items.map((item) => ( - - - - ))} -; - - - {function () { - return ( - - - - ); - }} -; - -; - -test} />; - - doLogClick('short', 'short', data)} -/>; - - - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ) - } -/>; - - { - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ); - }} -/>; - - - {(data) => doLogClick('short', 'short', data)} -; - - - {(data) => - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ) - } -; - - - {(data) => { - doLogClick( - 'long_name_long_name_long_name', - 'long_name_long_name_long_name', - data, - ); - }} -; - - -
- {Array(20) - .fill() - .map((_, i) => ( -

{i + 1}

- ))} -
-
; - -================================================================================ -`; - -exports[`flow_fix_me.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== const aDiv = ( @@ -3619,80 +908,9 @@ const aDiv = ( ================================================================================ `; -exports[`flow_fix_me.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`html-escape.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -const aDiv = ( - /* $FlowFixMe */ -
- Foo bar -
-); - -=====================================output===================================== -const aDiv = ( - /* $FlowFixMe */ -
Foo bar
-); - -================================================================================ -`; - -exports[`flow_fix_me.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const aDiv = ( - /* $FlowFixMe */ -
- Foo bar -
-); - -=====================================output===================================== -const aDiv = ( - /* $FlowFixMe */ -
Foo bar
-); - -================================================================================ -`; - -exports[`flow_fix_me.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const aDiv = ( - /* $FlowFixMe */ -
- Foo bar -
-); - -=====================================output===================================== -const aDiv = ( - /* $FlowFixMe */ -
Foo bar
-); - -================================================================================ -`; - -exports[`html_escape.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== export default () => ; @@ -3707,68 +925,9 @@ export default () => ; ================================================================================ `; -exports[`html_escape.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`hug.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -export default () => ; - -() => ; - -=====================================output===================================== -export default () => ; - -() => ; - -================================================================================ -`; - -exports[`html_escape.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -export default () => ; - -() => ; - -=====================================output===================================== -export default () => ; - -() => ; - -================================================================================ -`; - -exports[`html_escape.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -export default () => ; - -() => ; - -=====================================output===================================== -export default () => ; - -() => ; - -================================================================================ -`; - -exports[`hug.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input======================================
@@ -3845,254 +1004,9 @@ singleQuote: false ================================================================================ `; -exports[`hug.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`logical-expression.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -
- {__DEV__ - ? this.renderDevApp() - :
- {routes.map(route => ( - - ))} -
} -
; - -
- {__DEV__ &&
- {routes.map(route => ( - - ))} -
} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? '()' : '')} -
- -=====================================output===================================== -
- {__DEV__ ? ( - this.renderDevApp() - ) : ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {__DEV__ && ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? "()" : "")} -
; - -================================================================================ -`; - -exports[`hug.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
- {__DEV__ - ? this.renderDevApp() - :
- {routes.map(route => ( - - ))} -
} -
; - -
- {__DEV__ &&
- {routes.map(route => ( - - ))} -
} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? '()' : '')} -
- -=====================================output===================================== -
- {__DEV__ ? ( - this.renderDevApp() - ) : ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {__DEV__ && ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? '()' : '')} -
; - -================================================================================ -`; - -exports[`hug.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
- {__DEV__ - ? this.renderDevApp() - :
- {routes.map(route => ( - - ))} -
} -
; - -
- {__DEV__ &&
- {routes.map(route => ( - - ))} -
} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? '()' : '')} -
- -=====================================output===================================== -
- {__DEV__ ? ( - this.renderDevApp() - ) : ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {__DEV__ && ( -
- {routes.map((route) => ( - - ))} -
- )} -
; - -
- {member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? '()' : '')} -
; - -================================================================================ -`; - -exports[`logical-expression.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input======================================
@@ -4165,242 +1079,9 @@ singleQuote: false ================================================================================ `; -exports[`logical-expression.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`object-property.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -
- {a || "b"} -
; - -
- {a && "b"} -
; - -
- {a || } -
; - -
- {a && } -
; - -
- {a && make this text just so long enough to break this to the next line} -
; - -
- {a && b && make this text just so long enough to break this to the next line} -
; - -
- {a && -
-
-
-
} -
; - -=====================================output===================================== -
{a || "b"}
; - -
{a && "b"}
; - -
{a || }
; - -
{a && }
; - -
- {a && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && b && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && ( - -
-
-
-
- )} -
; - -================================================================================ -`; - -exports[`logical-expression.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
- {a || "b"} -
; - -
- {a && "b"} -
; - -
- {a || } -
; - -
- {a && } -
; - -
- {a && make this text just so long enough to break this to the next line} -
; - -
- {a && b && make this text just so long enough to break this to the next line} -
; - -
- {a && -
-
-
-
} -
; - -=====================================output===================================== -
{a || 'b'}
; - -
{a && 'b'}
; - -
{a || }
; - -
{a && }
; - -
- {a && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && b && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && ( - -
-
-
-
- )} -
; - -================================================================================ -`; - -exports[`logical-expression.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
- {a || "b"} -
; - -
- {a && "b"} -
; - -
- {a || } -
; - -
- {a && } -
; - -
- {a && make this text just so long enough to break this to the next line} -
; - -
- {a && b && make this text just so long enough to break this to the next line} -
; - -
- {a && -
-
-
-
} -
; - -=====================================output===================================== -
{a || 'b'}
; - -
{a && 'b'}
; - -
{a || }
; - -
{a && }
; - -
- {a && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && b && ( - - make this text just so long enough to break this to the next line - - )} -
; - -
- {a && ( - -
-
-
-
- )} -
; - -================================================================================ -`; - -exports[`object-property.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== const tabs = [ @@ -4435,128 +1116,9 @@ const tabs = [ ================================================================================ `; -exports[`object-property.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`open-break.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -const tabs = [ - { - title: "General Info", - content: ( - - ) - } -]; - -=====================================output===================================== -const tabs = [ - { - title: "General Info", - content: ( - - ), - }, -]; - -================================================================================ -`; - -exports[`object-property.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const tabs = [ - { - title: "General Info", - content: ( - - ) - } -]; - -=====================================output===================================== -const tabs = [ - { - title: 'General Info', - content: ( - - ), - }, -]; - -================================================================================ -`; - -exports[`object-property.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const tabs = [ - { - title: "General Info", - content: ( - - ) - } -]; - -=====================================output===================================== -const tabs = [ - { - title: 'General Info', - content: ( - - ), - }, -]; - -================================================================================ -`; - -exports[`open-break.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== { ================================================================================ `; -exports[`open-break.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`parens.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== - { - a -}}>{header}{showSort}; - - { - a -}}>{header}; - -{\` a very long text that does not break \`}; - -=====================================output===================================== - { - a; - }} -> - {header} - {showSort} -; - - { - a; - }} -> - {header} - -; - -{\` a very long text that does not break \`}; - -================================================================================ -`; - -exports[`open-break.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== - { - a -}}>{header}{showSort}; - - { - a -}}>{header}; - -{\` a very long text that does not break \`}; - -=====================================output===================================== - { - a; - }} -> - {header} - {showSort} -; - - { - a; - }} -> - {header} - -; - -{\` a very long text that does not break \`}; - -================================================================================ -`; - -exports[`open-break.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== - { - a -}}>{header}{showSort}; - - { - a -}}>{header}; - -{\` a very long text that does not break \`}; - -=====================================output===================================== - { - a; - }} -> - {header} - {showSort} -; - - { - a; - }} -> - {header} - -; - -{\` a very long text that does not break \`}; - -================================================================================ -`; - -exports[`parens.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== a = [ @@ -4775,552 +1206,9 @@ new Foo(); ================================================================================ `; -exports[`parens.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`regex.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -a = [ - , - , -]; - -
- -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(()) - -=====================================output===================================== -a = [ - , - , -]; - -
; - -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(); - -================================================================================ -`; - -exports[`parens.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -a = [ - , - , -]; - -
- -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(()) - -=====================================output===================================== -a = [ - , - , -]; - -
; - -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(); - -================================================================================ -`; - -exports[`parens.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -a = [ - , - , -]; - -
- -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(()) - -=====================================output===================================== -a = [ - , - , -]; - -
; - -f?.(
); -(
)(); -(
)?.(); - -new Foo(); -new Foo(); - -================================================================================ -`; - -exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

- -=====================================output===================================== -
; -
; -
&quot;"} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "} -

; - -================================================================================ -`; - -exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

- -=====================================output===================================== -
; -
; -
&quot;"} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "} -

; - -================================================================================ -`; - -exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

- -=====================================output===================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

; - -================================================================================ -`; - -exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

- -=====================================output===================================== -
; -
; -
&quot;'} />; -
; -
; -
; -
; - -

- GitHub Desktop has encountered an unrecoverable error and will need to 1231231 - restart. This has been reported to the team, but if youencounter this121312331 - repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} -

; - -================================================================================ -`; - -exports[`regex.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== x =
one
,
two
; @@ -5337,74 +1225,9 @@ x = {/w/.test(s)}; ================================================================================ `; -exports[`regex.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`return-statement.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -x =
one
,
two
; -x = {} -x = {1/2} -x = {/w/.test(s)} - -=====================================output===================================== -((x =
one
), (
two
)); -x = {}; -x = {1 / 2}; -x = {/w/.test(s)}; - -================================================================================ -`; - -exports[`regex.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -x =
one
,
two
; -x = {} -x = {1/2} -x = {/w/.test(s)} - -=====================================output===================================== -((x =
one
), (
two
)); -x =
{}; -x = {1 / 2}; -x = {/w/.test(s)}; - -================================================================================ -`; - -exports[`regex.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -x =
one
,
two
; -x = {} -x = {1/2} -x = {/w/.test(s)} - -=====================================output===================================== -((x =
one
), (
two
)); -x = {}; -x = {1 / 2}; -x = {/w/.test(s)}; - -================================================================================ -`; - -exports[`return-statement.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== const NonBreakingArrowExpression = () =>
; @@ -5513,350 +1336,9 @@ class BreakingClass extends React.component { ================================================================================ `; -exports[`return-statement.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`self-closing.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () =>
-
- bla bla bla -
-
; - -const NonBreakingArrowExpressionWBody = () => { - return ( -
- ); -}; - -const BreakingArrowExpressionWBody = () => { - return
-
- bla bla bla -
-
-}; - -const NonBreakingFunction = function() { - return ( -
- ); -}; - -const BreakingFunction = function() { - return
-
- bla bla bla -
-
-}; - -class NonBreakingClass extends React.component { - render() { - return ( -
- ); - } -} - -class BreakingClass extends React.component { - render() { - return
-
- bla bla bla -
-
; - } -} - -=====================================output===================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () => ( -
-
bla bla bla
-
-); - -const NonBreakingArrowExpressionWBody = () => { - return
; -}; - -const BreakingArrowExpressionWBody = () => { - return ( -
-
bla bla bla
-
- ); -}; - -const NonBreakingFunction = function () { - return
; -}; - -const BreakingFunction = function () { - return ( -
-
bla bla bla
-
- ); -}; - -class NonBreakingClass extends React.component { - render() { - return
; - } -} - -class BreakingClass extends React.component { - render() { - return ( -
-
bla bla bla
-
- ); - } -} - -================================================================================ -`; - -exports[`return-statement.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () =>
-
- bla bla bla -
-
; - -const NonBreakingArrowExpressionWBody = () => { - return ( -
- ); -}; - -const BreakingArrowExpressionWBody = () => { - return
-
- bla bla bla -
-
-}; - -const NonBreakingFunction = function() { - return ( -
- ); -}; - -const BreakingFunction = function() { - return
-
- bla bla bla -
-
-}; - -class NonBreakingClass extends React.component { - render() { - return ( -
- ); - } -} - -class BreakingClass extends React.component { - render() { - return
-
- bla bla bla -
-
; - } -} - -=====================================output===================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () => ( -
-
bla bla bla
-
-); - -const NonBreakingArrowExpressionWBody = () => { - return
; -}; - -const BreakingArrowExpressionWBody = () => { - return ( -
-
bla bla bla
-
- ); -}; - -const NonBreakingFunction = function () { - return
; -}; - -const BreakingFunction = function () { - return ( -
-
bla bla bla
-
- ); -}; - -class NonBreakingClass extends React.component { - render() { - return
; - } -} - -class BreakingClass extends React.component { - render() { - return ( -
-
bla bla bla
-
- ); - } -} - -================================================================================ -`; - -exports[`return-statement.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () =>
-
- bla bla bla -
-
; - -const NonBreakingArrowExpressionWBody = () => { - return ( -
- ); -}; - -const BreakingArrowExpressionWBody = () => { - return
-
- bla bla bla -
-
-}; - -const NonBreakingFunction = function() { - return ( -
- ); -}; - -const BreakingFunction = function() { - return
-
- bla bla bla -
-
-}; - -class NonBreakingClass extends React.component { - render() { - return ( -
- ); - } -} - -class BreakingClass extends React.component { - render() { - return
-
- bla bla bla -
-
; - } -} - -=====================================output===================================== -const NonBreakingArrowExpression = () =>
; - -const BreakingArrowExpression = () => ( -
-
bla bla bla
-
-); - -const NonBreakingArrowExpressionWBody = () => { - return
; -}; - -const BreakingArrowExpressionWBody = () => { - return ( -
-
bla bla bla
-
- ); -}; - -const NonBreakingFunction = function () { - return
; -}; - -const BreakingFunction = function () { - return ( -
-
bla bla bla
-
- ); -}; - -class NonBreakingClass extends React.component { - render() { - return
; - } -} - -class BreakingClass extends React.component { - render() { - return ( -
-
bla bla bla
-
- ); - } -} - -================================================================================ -`; - -exports[`self-closing.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== ; @@ -5869,62 +1351,9 @@ singleQuote: false ================================================================================ `; -exports[`self-closing.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`spacing.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -; -; - -=====================================output===================================== -; -; - -================================================================================ -`; - -exports[`self-closing.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -; -; - -=====================================output===================================== -; -; - -================================================================================ -`; - -exports[`self-closing.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -; -; - -=====================================output===================================== -; -; - -================================================================================ -`; - -exports[`spacing.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input====================================== const Labels = { @@ -5959,128 +1388,9 @@ const Labels = { ================================================================================ `; -exports[`spacing.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`template-literal-in-attr.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -const Labels = { - label1: ( - - Label 1 - - ), - - label2: ( - - Label 2 - - ), - - label3: ( - - Label 3 - - ), -}; - -=====================================output===================================== -const Labels = { - label1: Label 1, - - label2: Label 2, - - label3: Label 3, -}; - -================================================================================ -`; - -exports[`spacing.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const Labels = { - label1: ( - - Label 1 - - ), - - label2: ( - - Label 2 - - ), - - label3: ( - - Label 3 - - ), -}; - -=====================================output===================================== -const Labels = { - label1: Label 1, - - label2: Label 2, - - label3: Label 3, -}; - -================================================================================ -`; - -exports[`spacing.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -const Labels = { - label1: ( - - Label 1 - - ), - - label2: ( - - Label 2 - - ), - - label3: ( - - Label 3 - - ), -}; - -=====================================output===================================== -const Labels = { - label1: Label 1, - - label2: Label 2, - - label3: Label 3, -}; - -================================================================================ -`; - -exports[`template-literal-in-attr.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false printWidth: 80 (default) | =====================================input======================================
@@ -6107,149 +1417,9 @@ singleQuote: false ================================================================================ `; -exports[`template-literal-in-attr.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +exports[`ternary.js format 1`] = ` ====================================options===================================== -jsxSingleQuote: true parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -
-
-
foo
-
-
- -=====================================output===================================== -
-
-
- foo -
-
-
; - -================================================================================ -`; - -exports[`template-literal-in-attr.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
-
-
foo
-
-
- -=====================================output===================================== -
-
-
- foo -
-
-
; - -================================================================================ -`; - -exports[`template-literal-in-attr.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -
-
-
foo
-
-
- -=====================================output===================================== -
-
-
- foo -
-
-
; - -================================================================================ -`; - -exports[`ternary.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -a == 3 ? (a =

123

) : (a =

abc

); - -=====================================output===================================== -a == 3 ? (a =

123

) : (a =

abc

); - -================================================================================ -`; - -exports[`ternary.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: false - printWidth: 80 (default) | -=====================================input====================================== -a == 3 ? (a =

123

) : (a =

abc

); - -=====================================output===================================== -a == 3 ? (a =

123

) : (a =

abc

); - -================================================================================ -`; - -exports[`ternary.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` -====================================options===================================== -jsxSingleQuote: false -parsers: ["babel", "typescript", "flow"] -singleQuote: true - printWidth: 80 (default) | -=====================================input====================================== -a == 3 ? (a =

123

) : (a =

abc

); - -=====================================output===================================== -a == 3 ? (a =

123

) : (a =

abc

); - -================================================================================ -`; - -exports[`ternary.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` -====================================options===================================== -jsxSingleQuote: true -parsers: ["babel", "typescript", "flow"] -singleQuote: true printWidth: 80 (default) | =====================================input====================================== a == 3 ? (a =

123

) : (a =

abc

); diff --git a/tests/format/jsx/jsx/flow_fix_me.js b/tests/format/jsx/jsx/flow-fix-me.js similarity index 100% rename from tests/format/jsx/jsx/flow_fix_me.js rename to tests/format/jsx/jsx/flow-fix-me.js diff --git a/tests/format/jsx/jsx/format.test.js b/tests/format/jsx/jsx/format.test.js index 441dcc225..8adc66f60 100644 --- a/tests/format/jsx/jsx/format.test.js +++ b/tests/format/jsx/jsx/format.test.js @@ -1,16 +1 @@ -runFormatTest(import.meta, ["babel", "typescript", "flow"], { - singleQuote: false, - jsxSingleQuote: false, -}); -runFormatTest(import.meta, ["babel", "typescript", "flow"], { - singleQuote: false, - jsxSingleQuote: true, -}); -runFormatTest(import.meta, ["babel", "typescript", "flow"], { - singleQuote: true, - jsxSingleQuote: false, -}); -runFormatTest(import.meta, ["babel", "typescript", "flow"], { - singleQuote: true, - jsxSingleQuote: true, -}); +runFormatTest(import.meta, ["babel", "typescript", "flow"]); diff --git a/tests/format/jsx/jsx/html_escape.js b/tests/format/jsx/jsx/html-escape.js similarity index 100% rename from tests/format/jsx/jsx/html_escape.js rename to tests/format/jsx/jsx/html-escape.js diff --git a/tests/format/jsx/quotes/__snapshots__/format.test.js.snap b/tests/format/jsx/quotes/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..549fbfdb9 --- /dev/null +++ b/tests/format/jsx/quotes/__snapshots__/format.test.js.snap @@ -0,0 +1,389 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = ` +====================================options===================================== +jsxSingleQuote: false +parsers: ["babel", "typescript", "flow"] +singleQuote: false + printWidth: 80 (default) | +=====================================input====================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

+ +=====================================output===================================== +
; +
; +
&quot;"} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "} +

; + +================================================================================ +`; + +exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = ` +====================================options===================================== +jsxSingleQuote: true +parsers: ["babel", "typescript", "flow"] +singleQuote: false + printWidth: 80 (default) | +=====================================input====================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

+ +=====================================output===================================== +
; +
; +
&quot;"} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "} +

; + +================================================================================ +`; + +exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = ` +====================================options===================================== +jsxSingleQuote: false +parsers: ["babel", "typescript", "flow"] +singleQuote: true + printWidth: 80 (default) | +=====================================input====================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

+ +=====================================output===================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

; + +================================================================================ +`; + +exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = ` +====================================options===================================== +jsxSingleQuote: true +parsers: ["babel", "typescript", "flow"] +singleQuote: true + printWidth: 80 (default) | +=====================================input====================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

+ +=====================================output===================================== +
; +
; +
&quot;'} />; +
; +
; +
; +
; + +

+ GitHub Desktop has encountered an unrecoverable error and will need to 1231231 + restart. This has been reported to the team, but if youencounter this121312331 + repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '} +

; + +================================================================================ +`; diff --git a/tests/format/jsx/quotes/format.test.js b/tests/format/jsx/quotes/format.test.js new file mode 100644 index 000000000..441dcc225 --- /dev/null +++ b/tests/format/jsx/quotes/format.test.js @@ -0,0 +1,16 @@ +runFormatTest(import.meta, ["babel", "typescript", "flow"], { + singleQuote: false, + jsxSingleQuote: false, +}); +runFormatTest(import.meta, ["babel", "typescript", "flow"], { + singleQuote: false, + jsxSingleQuote: true, +}); +runFormatTest(import.meta, ["babel", "typescript", "flow"], { + singleQuote: true, + jsxSingleQuote: false, +}); +runFormatTest(import.meta, ["babel", "typescript", "flow"], { + singleQuote: true, + jsxSingleQuote: true, +}); diff --git a/tests/format/jsx/jsx/quotes.js b/tests/format/jsx/quotes/quotes.js similarity index 100% rename from tests/format/jsx/jsx/quotes.js rename to tests/format/jsx/quotes/quotes.js