Consider [0] to be part of the first member group
parent
538ce6d209
commit
979b86944d
|
@ -3723,13 +3723,20 @@ function printMemberChain(path, options, print) {
|
|||
// The first group is the first node followed by
|
||||
// - as many CallExpression as possible
|
||||
// < fn()()() >.something()
|
||||
// - as many array acessors as possible
|
||||
// < fn()[0][1][2] >.something()
|
||||
// - then, as many MemberExpression as possible but the last one
|
||||
// < this.items >.something()
|
||||
const groups = [];
|
||||
let currentGroup = [printedNodes[0]];
|
||||
let i = 1;
|
||||
for (; i < printedNodes.length; ++i) {
|
||||
if (printedNodes[i].node.type === "CallExpression") {
|
||||
if (
|
||||
printedNodes[i].node.type === "CallExpression" ||
|
||||
(printedNodes[i].node.type === "MemberExpression" &&
|
||||
printedNodes[i].node.computed &&
|
||||
isNumericLiteral(printedNodes[i].node.property))
|
||||
) {
|
||||
currentGroup.push(printedNodes[i]);
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -719,6 +719,10 @@ const version = someLongString
|
|||
.pop()
|
||||
.split(EOL)[0]
|
||||
.trim();
|
||||
|
||||
const component = find('.org-lclp-edit-copy-url-banner__link')[0]
|
||||
.getAttribute('href')
|
||||
.indexOf(this.landingPageLink);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const version = someLongString
|
||||
.split("jest version =")
|
||||
|
@ -726,6 +730,10 @@ const version = someLongString
|
|||
.split(EOL)[0]
|
||||
.trim();
|
||||
|
||||
const component = find(".org-lclp-edit-copy-url-banner__link")[0]
|
||||
.getAttribute("href")
|
||||
.indexOf(this.landingPageLink);
|
||||
|
||||
`;
|
||||
|
||||
exports[`test.js 1`] = `
|
||||
|
|
|
@ -3,3 +3,7 @@ const version = someLongString
|
|||
.pop()
|
||||
.split(EOL)[0]
|
||||
.trim();
|
||||
|
||||
const component = find('.org-lclp-edit-copy-url-banner__link')[0]
|
||||
.getAttribute('href')
|
||||
.indexOf(this.landingPageLink);
|
||||
|
|
Loading…
Reference in New Issue