webpipe-js 2.0.49 → 2.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1611,9 +1611,7 @@ function printVariable(variable) {
|
|
|
1611
1611
|
}
|
|
1612
1612
|
function printGraphQLSchema(schema) {
|
|
1613
1613
|
const firstLine = schema.inlineComment ? `graphqlSchema = \` ${printComment(schema.inlineComment)}` : "graphqlSchema = `";
|
|
1614
|
-
return `${firstLine}
|
|
1615
|
-
${schema.sdl}
|
|
1616
|
-
\``;
|
|
1614
|
+
return `${firstLine}${schema.sdl}\``;
|
|
1617
1615
|
}
|
|
1618
1616
|
function printQueryResolver(query) {
|
|
1619
1617
|
const lines = [];
|
|
@@ -1678,15 +1676,20 @@ function printCondition(condition, indent = " ") {
|
|
|
1678
1676
|
}
|
|
1679
1677
|
if (condition.field === "selector" && condition.selector && condition.domAssert) {
|
|
1680
1678
|
const selector = condition.selector;
|
|
1679
|
+
const formatSelectorValue = (val) => {
|
|
1680
|
+
if (val.startsWith("`") || val.startsWith('"')) return val;
|
|
1681
|
+
if (/\{\{[^}]+\}\}/.test(val)) return `"${val}"`;
|
|
1682
|
+
return formatConditionValue(val);
|
|
1683
|
+
};
|
|
1681
1684
|
if (condition.domAssert.kind === "Exists") {
|
|
1682
1685
|
const operation = condition.comparison === "exists" ? "exists" : "does not exist";
|
|
1683
1686
|
return `${indent}${condType} selector \`${selector}\` ${operation}`;
|
|
1684
1687
|
} else if (condition.domAssert.kind === "Text") {
|
|
1685
|
-
return `${indent}${condType} selector \`${selector}\` text ${condition.comparison} ${
|
|
1688
|
+
return `${indent}${condType} selector \`${selector}\` text ${condition.comparison} ${formatSelectorValue(condition.value)}`;
|
|
1686
1689
|
} else if (condition.domAssert.kind === "Count") {
|
|
1687
1690
|
return `${indent}${condType} selector \`${selector}\` count ${condition.comparison} ${condition.value}`;
|
|
1688
1691
|
} else if (condition.domAssert.kind === "Attribute") {
|
|
1689
|
-
return `${indent}${condType} selector \`${selector}\` attribute "${condition.domAssert.name}" ${condition.comparison} ${
|
|
1692
|
+
return `${indent}${condType} selector \`${selector}\` attribute "${condition.domAssert.name}" ${condition.comparison} ${formatSelectorValue(condition.value)}`;
|
|
1690
1693
|
}
|
|
1691
1694
|
}
|
|
1692
1695
|
const fieldPart = condition.headerName ? `${condition.field} "${condition.headerName}"` : condition.jqExpr ? `${condition.field} \`${condition.jqExpr}\`` : condition.field;
|
package/dist/index.mjs
CHANGED
|
@@ -1558,9 +1558,7 @@ function printVariable(variable) {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
function printGraphQLSchema(schema) {
|
|
1560
1560
|
const firstLine = schema.inlineComment ? `graphqlSchema = \` ${printComment(schema.inlineComment)}` : "graphqlSchema = `";
|
|
1561
|
-
return `${firstLine}
|
|
1562
|
-
${schema.sdl}
|
|
1563
|
-
\``;
|
|
1561
|
+
return `${firstLine}${schema.sdl}\``;
|
|
1564
1562
|
}
|
|
1565
1563
|
function printQueryResolver(query) {
|
|
1566
1564
|
const lines = [];
|
|
@@ -1625,15 +1623,20 @@ function printCondition(condition, indent = " ") {
|
|
|
1625
1623
|
}
|
|
1626
1624
|
if (condition.field === "selector" && condition.selector && condition.domAssert) {
|
|
1627
1625
|
const selector = condition.selector;
|
|
1626
|
+
const formatSelectorValue = (val) => {
|
|
1627
|
+
if (val.startsWith("`") || val.startsWith('"')) return val;
|
|
1628
|
+
if (/\{\{[^}]+\}\}/.test(val)) return `"${val}"`;
|
|
1629
|
+
return formatConditionValue(val);
|
|
1630
|
+
};
|
|
1628
1631
|
if (condition.domAssert.kind === "Exists") {
|
|
1629
1632
|
const operation = condition.comparison === "exists" ? "exists" : "does not exist";
|
|
1630
1633
|
return `${indent}${condType} selector \`${selector}\` ${operation}`;
|
|
1631
1634
|
} else if (condition.domAssert.kind === "Text") {
|
|
1632
|
-
return `${indent}${condType} selector \`${selector}\` text ${condition.comparison} ${
|
|
1635
|
+
return `${indent}${condType} selector \`${selector}\` text ${condition.comparison} ${formatSelectorValue(condition.value)}`;
|
|
1633
1636
|
} else if (condition.domAssert.kind === "Count") {
|
|
1634
1637
|
return `${indent}${condType} selector \`${selector}\` count ${condition.comparison} ${condition.value}`;
|
|
1635
1638
|
} else if (condition.domAssert.kind === "Attribute") {
|
|
1636
|
-
return `${indent}${condType} selector \`${selector}\` attribute "${condition.domAssert.name}" ${condition.comparison} ${
|
|
1639
|
+
return `${indent}${condType} selector \`${selector}\` attribute "${condition.domAssert.name}" ${condition.comparison} ${formatSelectorValue(condition.value)}`;
|
|
1637
1640
|
}
|
|
1638
1641
|
}
|
|
1639
1642
|
const fieldPart = condition.headerName ? `${condition.field} "${condition.headerName}"` : condition.jqExpr ? `${condition.field} \`${condition.jqExpr}\`` : condition.field;
|