fix(javascript): no regression for ternary#test alignment (#5333)
parent
e2d8834c49
commit
02f9802119
|
@ -364,7 +364,21 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|||
return maybeGroup(
|
||||
concat(
|
||||
[].concat(
|
||||
operatorOptions.beforeParts(),
|
||||
(testDoc =>
|
||||
/**
|
||||
* a
|
||||
* ? b
|
||||
* : multiline
|
||||
* test
|
||||
* node
|
||||
* ^^ align(2)
|
||||
* ? d
|
||||
* : e
|
||||
*/
|
||||
parent.type === operatorOptions.conditionalNodeType &&
|
||||
parent[operatorOptions.alternateNodePropertyName] === node
|
||||
? align(2, testDoc)
|
||||
: testDoc)(concat(operatorOptions.beforeParts())),
|
||||
forceNoIndent ? concat(parts) : indent(concat(parts)),
|
||||
operatorOptions.afterParts(breakClosingParen)
|
||||
)
|
||||
|
|
|
@ -1599,7 +1599,16 @@ const foo = <div className={'match-achievement-medal-type type' + (medals[0].rec
|
|||
) : (
|
||||
i18n('Theme')
|
||||
)}
|
||||
</div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
</div>
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let icecream =
|
||||
what == "cone"
|
||||
? p => (!!p ? \`here's your \${p} cone\` : \`just the empty cone for you\`)
|
||||
|
@ -1689,6 +1698,14 @@ const foo = (
|
|||
</div>
|
||||
);
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline;
|
||||
|
||||
`;
|
||||
|
||||
exports[`nested.js - flow-verify 2`] = `
|
||||
|
@ -1778,7 +1795,16 @@ const foo = <div className={'match-achievement-medal-type type' + (medals[0].rec
|
|||
) : (
|
||||
i18n('Theme')
|
||||
)}
|
||||
</div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
</div>
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let icecream =
|
||||
what == "cone"
|
||||
? p => (!!p ? \`here's your \${p} cone\` : \`just the empty cone for you\`)
|
||||
|
@ -1868,6 +1894,14 @@ const foo = (
|
|||
</div>
|
||||
);
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline;
|
||||
|
||||
`;
|
||||
|
||||
exports[`nested.js - flow-verify 3`] = `
|
||||
|
@ -1957,7 +1991,16 @@ const foo = <div className={'match-achievement-medal-type type' + (medals[0].rec
|
|||
) : (
|
||||
i18n('Theme')
|
||||
)}
|
||||
</div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
</div>
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let icecream =
|
||||
what == "cone"
|
||||
? p => (!!p ? \`here's your \${p} cone\` : \`just the empty cone for you\`)
|
||||
|
@ -2047,6 +2090,14 @@ const foo = (
|
|||
</div>
|
||||
);
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline;
|
||||
|
||||
`;
|
||||
|
||||
exports[`nested.js - flow-verify 4`] = `
|
||||
|
@ -2136,7 +2187,16 @@ const foo = <div className={'match-achievement-medal-type type' + (medals[0].rec
|
|||
) : (
|
||||
i18n('Theme')
|
||||
)}
|
||||
</div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
</div>
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let icecream =
|
||||
what == "cone"
|
||||
? p => (!!p ? \`here's your \${p} cone\` : \`just the empty cone for you\`)
|
||||
|
@ -2226,6 +2286,14 @@ const foo = (
|
|||
</div>
|
||||
);
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline;
|
||||
|
||||
`;
|
||||
|
||||
exports[`parenthesis.js - flow-verify 1`] = `
|
||||
|
|
|
@ -84,4 +84,12 @@ const foo = <div className={'match-achievement-medal-type type' + (medals[0].rec
|
|||
) : (
|
||||
i18n('Theme')
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
a
|
||||
? literalline
|
||||
: {
|
||||
123: 12
|
||||
}
|
||||
? line
|
||||
: softline
|
||||
|
|
Loading…
Reference in New Issue