eslint-plugin-playwright 0.22.1 → 0.22.2

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.js CHANGED
@@ -273,7 +273,8 @@ var expectPlaywrightMatchers = [
273
273
  "toMatchText",
274
274
  "toMatchTitle",
275
275
  "toMatchURL",
276
- "toMatchValue"
276
+ "toMatchValue",
277
+ "toPass"
277
278
  ];
278
279
  var playwrightTestMatchers = [
279
280
  "toBeChecked",
@@ -1501,7 +1502,7 @@ var prefer_to_have_count_default = {
1501
1502
  return;
1502
1503
  }
1503
1504
  const [argument] = node.arguments;
1504
- if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression") {
1505
+ if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression" || !isPropertyAccessor(argument.argument.callee, "count")) {
1505
1506
  return;
1506
1507
  }
1507
1508
  const callee = argument.argument.callee;
@@ -1602,7 +1603,11 @@ var methods3 = {
1602
1603
  },
1603
1604
  innerText: { matcher: "toHaveText", type: "string" },
1604
1605
  inputValue: { matcher: "toHaveValue", type: "string" },
1605
- isChecked: { matcher: "toBeChecked", type: "boolean" },
1606
+ isChecked: {
1607
+ matcher: "toBeChecked",
1608
+ prop: "checked",
1609
+ type: "boolean"
1610
+ },
1606
1611
  isDisabled: {
1607
1612
  inverse: "toBeEnabled",
1608
1613
  matcher: "toBeDisabled",
@@ -1690,6 +1695,11 @@ var prefer_web_first_assertions_default = {
1690
1695
  const [matcherArg] = args ?? [];
1691
1696
  if (matcherArg && isBooleanLiteral(matcherArg)) {
1692
1697
  fixes.push(fixer.remove(matcherArg));
1698
+ } else if (methodConfig.prop && matcherArg) {
1699
+ const propArg = methodConfig.prop;
1700
+ const variable = getStringValue(matcherArg);
1701
+ const args2 = `{ ${propArg}: ${variable} }`;
1702
+ fixes.push(fixer.replaceText(matcherArg, args2));
1693
1703
  }
1694
1704
  const hasOtherArgs = !!methodArgs.filter(
1695
1705
  (arg2) => !isBooleanLiteral(arg2)
package/dist/index.mjs CHANGED
@@ -306,7 +306,8 @@ var init_missing_playwright_await = __esm({
306
306
  "toMatchText",
307
307
  "toMatchTitle",
308
308
  "toMatchURL",
309
- "toMatchValue"
309
+ "toMatchValue",
310
+ "toPass"
310
311
  ];
311
312
  playwrightTestMatchers = [
312
313
  "toBeChecked",
@@ -1670,6 +1671,7 @@ var matchers2, prefer_to_have_count_default;
1670
1671
  var init_prefer_to_have_count = __esm({
1671
1672
  "src/rules/prefer-to-have-count.ts"() {
1672
1673
  "use strict";
1674
+ init_ast();
1673
1675
  init_fixer();
1674
1676
  init_parseExpectCall();
1675
1677
  matchers2 = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
@@ -1682,7 +1684,7 @@ var init_prefer_to_have_count = __esm({
1682
1684
  return;
1683
1685
  }
1684
1686
  const [argument] = node.arguments;
1685
- if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression") {
1687
+ if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression" || !isPropertyAccessor(argument.argument.callee, "count")) {
1686
1688
  return;
1687
1689
  }
1688
1690
  const callee = argument.argument.callee;
@@ -1800,7 +1802,11 @@ var init_prefer_web_first_assertions = __esm({
1800
1802
  },
1801
1803
  innerText: { matcher: "toHaveText", type: "string" },
1802
1804
  inputValue: { matcher: "toHaveValue", type: "string" },
1803
- isChecked: { matcher: "toBeChecked", type: "boolean" },
1805
+ isChecked: {
1806
+ matcher: "toBeChecked",
1807
+ prop: "checked",
1808
+ type: "boolean"
1809
+ },
1804
1810
  isDisabled: {
1805
1811
  inverse: "toBeEnabled",
1806
1812
  matcher: "toBeDisabled",
@@ -1888,6 +1894,11 @@ var init_prefer_web_first_assertions = __esm({
1888
1894
  const [matcherArg] = args ?? [];
1889
1895
  if (matcherArg && isBooleanLiteral(matcherArg)) {
1890
1896
  fixes.push(fixer.remove(matcherArg));
1897
+ } else if (methodConfig.prop && matcherArg) {
1898
+ const propArg = methodConfig.prop;
1899
+ const variable = getStringValue(matcherArg);
1900
+ const args2 = `{ ${propArg}: ${variable} }`;
1901
+ fixes.push(fixer.replaceText(matcherArg, args2));
1891
1902
  }
1892
1903
  const hasOtherArgs = !!methodArgs.filter(
1893
1904
  (arg2) => !isBooleanLiteral(arg2)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-playwright",
3
3
  "description": "ESLint plugin for Playwright testing.",
4
- "version": "0.22.1",
4
+ "version": "0.22.2",
5
5
  "repository": "https://github.com/playwright-community/eslint-plugin-playwright",
6
6
  "author": "Mark Skelton <mark@mskelton.dev>",
7
7
  "packageManager": "pnpm@8.12.0",