Group [0] at the end of the previous chain instead of beginning of next one (#784)
Fixes #775master
parent
694816517a
commit
6b7aa83820
|
@ -2287,6 +2287,13 @@ function printMemberChain(path, options, print) {
|
|||
if (
|
||||
hasSeenCallExpression && printedNodes[i].node.type === "MemberExpression"
|
||||
) {
|
||||
// [0] should be appended at the end of the group instead of the
|
||||
// beginning of the next one
|
||||
if (printedNodes[i].node.computed) {
|
||||
currentGroup.push(printedNodes[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
groups.push(currentGroup);
|
||||
currentGroup = [];
|
||||
hasSeenCallExpression = false;
|
||||
|
|
|
@ -242,6 +242,21 @@ if (testConfig.ENABLE_ONLINE_TESTS === \\"true\\") {
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`square_0.js 1`] = `
|
||||
"const version = someLongString
|
||||
.split('jest version =')
|
||||
.pop()
|
||||
.split(EOL)[0]
|
||||
.trim();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const version = someLongString
|
||||
.split(\\"jest version =\\")
|
||||
.pop()
|
||||
.split(EOL)[0]
|
||||
.trim();
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test.js 1`] = `
|
||||
"method().then(x => x)
|
||||
[\\"abc\\"](x => x)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
const version = someLongString
|
||||
.split('jest version =')
|
||||
.pop()
|
||||
.split(EOL)[0]
|
||||
.trim();
|
Loading…
Reference in New Issue