fix: support sequential CallExpressions in member chains (#2990)
* fix: support sequential CallExpressions in member chains fixes #2832 * test: add additional test cases for sequential CallExpressions * test: regenerate method-chain snapshotmaster
parent
6c8cde9672
commit
4a6b61aaf3
|
@ -3580,7 +3580,10 @@ function printMemberChain(path, options, print) {
|
|||
|
||||
function rec(path) {
|
||||
const node = path.getValue();
|
||||
if (node.type === "CallExpression" && isMemberish(node.callee)) {
|
||||
if (
|
||||
node.type === "CallExpression" &&
|
||||
(isMemberish(node.callee) || node.callee.type === "CallExpression")
|
||||
) {
|
||||
printedNodes.unshift({
|
||||
node: node,
|
||||
printed: comments.printComments(
|
||||
|
|
|
@ -621,6 +621,22 @@ if (testConfig.ENABLE_ONLINE_TESTS === "true") {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')().then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')('argument').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName', 'second argument that pushes this group past 80 characters')('argument').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')('argument', 'second argument that pushes this group past 80 characters').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if (testConfig.ENABLE_ONLINE_TESTS === "true") {
|
||||
describe("POST /users/me/pet", function() {
|
||||
|
@ -641,6 +657,40 @@ if (testConfig.ENABLE_ONLINE_TESTS === "true") {
|
|||
});
|
||||
}
|
||||
|
||||
wrapper
|
||||
.find("SomewhatLongNodeName")
|
||||
.prop("longPropFunctionName")()
|
||||
.then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper
|
||||
.find("SomewhatLongNodeName")
|
||||
.prop("longPropFunctionName")("argument")
|
||||
.then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper
|
||||
.find("SomewhatLongNodeName")
|
||||
.prop(
|
||||
"longPropFunctionName",
|
||||
"second argument that pushes this group past 80 characters"
|
||||
)("argument")
|
||||
.then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper
|
||||
.find("SomewhatLongNodeName")
|
||||
.prop("longPropFunctionName")(
|
||||
"argument",
|
||||
"second argument that pushes this group past 80 characters"
|
||||
)
|
||||
.then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
`;
|
||||
|
||||
exports[`square_0.js 1`] = `
|
||||
|
|
|
@ -14,3 +14,19 @@ if (testConfig.ENABLE_ONLINE_TESTS === "true") {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')().then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')('argument').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName', 'second argument that pushes this group past 80 characters')('argument').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
||||
wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')('argument', 'second argument that pushes this group past 80 characters').then(function() {
|
||||
doSomething();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue