@cronn/element-snapshot 0.21.0 → 0.22.0

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.
@@ -124,8 +124,12 @@
124
124
  }
125
125
  //#endregion
126
126
  //#region src/types/elements/container.ts
127
- const CONTAINER_ROLES = new Set([
127
+ const CONTAINER_ROLES = /* @__PURE__ */ new Set([
128
128
  "paragraph",
129
+ "blockquote",
130
+ "code",
131
+ "emphasis",
132
+ "strong",
129
133
  "list",
130
134
  "listitem",
131
135
  "listbox",
@@ -188,10 +192,13 @@
188
192
  a: "link",
189
193
  article: "article",
190
194
  aside: "complementary",
195
+ blockquote: "blockquote",
191
196
  button: "button",
197
+ code: "code",
192
198
  dd: "definition",
193
199
  dl: "descriptionlist",
194
200
  dt: "term",
201
+ em: "emphasis",
195
202
  fieldset: "group",
196
203
  footer: "contentinfo",
197
204
  form: "form",
@@ -217,6 +224,7 @@
217
224
  search: "search",
218
225
  section: "region",
219
226
  select: "combobox",
227
+ strong: "strong",
220
228
  table: "table",
221
229
  tbody: "rowgroup",
222
230
  textarea: "textbox",
@@ -267,7 +275,8 @@
267
275
  const explicitRole = element.role;
268
276
  if (isIgnoredRole(explicitRole)) return;
269
277
  if (explicitRole !== null && (hasRoleSpecificSnapshot(explicitRole) || isContainerRole(explicitRole))) return explicitRole;
270
- const roleResolver = ELEMENT_ROLES[getElementTagName(element)];
278
+ const tagName = getElementTagName(element);
279
+ const roleResolver = ELEMENT_ROLES[tagName];
271
280
  if (roleResolver === void 0) return;
272
281
  if (typeof roleResolver === "string") return roleResolver;
273
282
  return roleResolver(element);
@@ -369,14 +378,17 @@
369
378
  }
370
379
  //#endregion
371
380
  //#region src/browser/name.ts
372
- const prohibitsNaming = new Set([
381
+ const prohibitsNaming = /* @__PURE__ */ new Set([
382
+ "code",
383
+ "emphasis",
373
384
  "label",
374
385
  "listitem",
375
386
  "paragraph",
376
387
  "rowgroup",
388
+ "strong",
377
389
  "term"
378
390
  ]);
379
- const supportsNamingByLabel = new Set([
391
+ const supportsNamingByLabel = /* @__PURE__ */ new Set([
380
392
  "checkbox",
381
393
  "combobox",
382
394
  "progressbar",
@@ -386,7 +398,7 @@
386
398
  "spinbutton",
387
399
  "textbox"
388
400
  ]);
389
- const supportsNamingFromChildContent = new Set([
401
+ const supportsNamingFromChildContent = /* @__PURE__ */ new Set([
390
402
  "button",
391
403
  "cell",
392
404
  "columnheader",
@@ -454,7 +466,7 @@
454
466
  }
455
467
  //#endregion
456
468
  //#region src/browser/button.ts
457
- const pressedValues = new Set(["mixed"]);
469
+ const pressedValues = /* @__PURE__ */ new Set(["mixed"]);
458
470
  function snapshotButton(element) {
459
471
  return {
460
472
  role: "button",
@@ -514,7 +526,7 @@
514
526
  ...inputStateAttributes(element)
515
527
  };
516
528
  }
517
- const CHECKED_INPUT_TYPES = new Set(["checkbox", "radio"]);
529
+ const CHECKED_INPUT_TYPES = /* @__PURE__ */ new Set(["checkbox", "radio"]);
518
530
  function resolveInputValue(element) {
519
531
  if (element instanceof HTMLInputElement && CHECKED_INPUT_TYPES.has(element.type)) return;
520
532
  return stringAttribute(element.value);
@@ -638,7 +650,7 @@
638
650
  }
639
651
  //#endregion
640
652
  //#region src/browser/link.ts
641
- const currentValues = new Set(["page", "step"]);
653
+ const currentValues = /* @__PURE__ */ new Set(["page", "step"]);
642
654
  function snapshotLink(element) {
643
655
  return {
644
656
  role: "link",
@@ -715,7 +727,7 @@
715
727
  }
716
728
  //#endregion
717
729
  //#region src/types/elements/table.ts
718
- const SORT_TYPES = new Set([
730
+ const SORT_TYPES = /* @__PURE__ */ new Set([
719
731
  "ascending",
720
732
  "descending",
721
733
  "other"
@@ -810,7 +822,7 @@
810
822
  }
811
823
  return snapshotContainer(elementRole, node);
812
824
  }
813
- const UNSUPPORTED_ELEMENTS = new Set([
825
+ const UNSUPPORTED_ELEMENTS = /* @__PURE__ */ new Set([
814
826
  "audio",
815
827
  "figure",
816
828
  "noscript",
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Expect, Locator, MatcherReturnType } from "@playwright/test";
2
2
  import { PlaywrightMatchJsonFileOptions, PlaywrightMatchTextFileOptions, PlaywrightValidationFileMatcherConfig } from "@cronn/playwright-file-snapshots";
3
-
4
3
  //#region src/playwright/markdown-table.d.ts
5
4
  interface MarkdownTableSnapshotOptions {
6
5
  /**
@@ -43,7 +42,7 @@ type PressedValue = true | "mixed";
43
42
  type SetValues<TSet> = TSet extends Set<infer TValue> ? TValue : never;
44
43
  //#endregion
45
44
  //#region src/types/elements/container.d.ts
46
- declare const CONTAINER_ROLES: Set<"paragraph" | "list" | "listitem" | "listbox" | "article" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "search" | "descriptionlist" | "term" | "definition" | "table" | "grid" | "rowgroup" | "row" | "alert" | "menu" | "tablist" | "tabpanel" | "label">;
45
+ declare const CONTAINER_ROLES: Set<"paragraph" | "blockquote" | "code" | "emphasis" | "strong" | "list" | "listitem" | "listbox" | "article" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "search" | "descriptionlist" | "term" | "definition" | "table" | "grid" | "rowgroup" | "row" | "alert" | "menu" | "tablist" | "tabpanel" | "label">;
47
46
  interface ContainerSnapshot extends GenericElementSnapshot<ContainerRole> {}
48
47
  type ContainerRole = SetValues<typeof CONTAINER_ROLES>;
49
48
  interface RegionSnapshot extends GenericElementSnapshot<"region"> {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronn/element-snapshot",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Element snapshots for Playwright",
5
5
  "homepage": "https://cronn.github.io/file-snapshots/playwright/element-snapshots/",
6
6
  "bugs": {
@@ -26,28 +26,29 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "package-directory": "8.2.0",
29
- "@cronn/lib-file-snapshots": "1.2.0",
30
- "@cronn/playwright-file-snapshots": "2.2.0"
29
+ "@cronn/playwright-file-snapshots": "2.2.1",
30
+ "@cronn/lib-file-snapshots": "1.2.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@arethetypeswrong/core": "0.18.3",
34
- "@playwright/test": "1.60.0",
35
- "@types/node": "24.12.4",
36
- "@typescript/native-preview": "7.0.0-dev.20260527.2",
37
- "@vitest/coverage-v8": "4.1.7",
38
- "eslint": "10.4.1",
33
+ "@arethetypeswrong/core": "0.18.5",
34
+ "@playwright/test": "1.61.1",
35
+ "@types/node": "24.13.2",
36
+ "@typescript/native": "npm:typescript@^7.0.2",
37
+ "@vitest/coverage-v8": "4.1.10",
38
+ "eslint": "10.7.0",
39
39
  "eslint-config-prettier": "10.1.8",
40
40
  "eslint-plugin-check-file": "3.3.1",
41
41
  "eslint-plugin-unused-imports": "4.4.1",
42
42
  "publint": "0.3.21",
43
43
  "rimraf": "6.1.3",
44
- "tsdown": "0.22.1",
45
- "typescript-eslint": "8.60.0",
46
- "vitest": "4.1.7",
47
- "node": "runtime:>=24.14.1 <25",
44
+ "tsdown": "0.22.7",
45
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
46
+ "typescript-eslint": "8.63.0",
47
+ "vitest": "4.1.10",
48
+ "node": "runtime:24.18.0",
49
+ "@cronn/shared-configs": "0.0.0",
48
50
  "@cronn/test-utils": "0.0.0",
49
- "@cronn/vitest-file-snapshots": "2.1.1",
50
- "@cronn/shared-configs": "0.0.0"
51
+ "@cronn/vitest-file-snapshots": "2.1.2"
51
52
  },
52
53
  "peerDependencies": {
53
54
  "@playwright/test": "^1.55"
@@ -55,22 +56,22 @@
55
56
  "devEngines": {
56
57
  "packageManager": {
57
58
  "name": "pnpm",
58
- "version": "11.5.2",
59
+ "version": "11.13.1",
59
60
  "onFail": "download"
60
61
  },
61
62
  "runtime": {
62
63
  "name": "node",
63
- "version": ">=24.14.1 <25",
64
+ "version": "24.18.0",
64
65
  "onFail": "download"
65
66
  }
66
67
  },
67
68
  "engines": {
68
- "node": "^20 || ^22 || >=24"
69
+ "node": "^22 || ^24 || >=26"
69
70
  },
70
71
  "scripts": {
71
72
  "build": "tsdown",
72
73
  "clean": "rimraf .turbo dist playwright-report test-results coverage",
73
- "compile": "tsgo",
74
+ "compile": "tsc",
74
75
  "lint:check": "eslint src/ tests/ --max-warnings=0",
75
76
  "lint:fix": "eslint src/ tests/ --max-warnings=0 --fix",
76
77
  "playwright:install": "playwright install chromium",