Consider [0] to be part of the first member group

master
Lucas Duailibe 2017-11-02 10:35:34 -02:00
parent 538ce6d209
commit 979b86944d
3 changed files with 20 additions and 1 deletions

View File

@ -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;

View File

@ -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`] = `

View File

@ -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);