@cronn/element-snapshot 0.21.0 → 0.23.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,31 +124,38 @@
124
124
  }
125
125
  //#endregion
126
126
  //#region src/types/elements/container.ts
127
- const CONTAINER_ROLES = new Set([
128
- "paragraph",
129
- "list",
130
- "listitem",
131
- "listbox",
127
+ const CONTAINER_ROLES = /* @__PURE__ */ new Set([
128
+ "alert",
132
129
  "article",
133
130
  "banner",
131
+ "blockquote",
132
+ "code",
134
133
  "complementary",
135
134
  "contentinfo",
135
+ "definition",
136
+ "descriptionlist",
137
+ "emphasis",
136
138
  "form",
139
+ "grid",
140
+ "label",
141
+ "list",
142
+ "listbox",
143
+ "listitem",
144
+ "log",
137
145
  "main",
146
+ "menu",
138
147
  "navigation",
148
+ "note",
149
+ "paragraph",
150
+ "row",
151
+ "rowgroup",
139
152
  "search",
140
- "descriptionlist",
141
- "term",
142
- "definition",
153
+ "status",
154
+ "strong",
143
155
  "table",
144
- "grid",
145
- "rowgroup",
146
- "row",
147
- "alert",
148
- "menu",
149
156
  "tablist",
150
157
  "tabpanel",
151
- "label"
158
+ "term"
152
159
  ]);
153
160
  //#endregion
154
161
  //#region src/browser/container.ts
@@ -188,10 +195,13 @@
188
195
  a: "link",
189
196
  article: "article",
190
197
  aside: "complementary",
198
+ blockquote: "blockquote",
191
199
  button: "button",
200
+ code: "code",
192
201
  dd: "definition",
193
202
  dl: "descriptionlist",
194
203
  dt: "term",
204
+ em: "emphasis",
195
205
  fieldset: "group",
196
206
  footer: "contentinfo",
197
207
  form: "form",
@@ -212,11 +222,13 @@
212
222
  nav: "navigation",
213
223
  ol: "list",
214
224
  option: "option",
225
+ output: "status",
215
226
  p: "paragraph",
216
227
  progress: "progressbar",
217
228
  search: "search",
218
229
  section: "region",
219
230
  select: "combobox",
231
+ strong: "strong",
220
232
  table: "table",
221
233
  tbody: "rowgroup",
222
234
  textarea: "textbox",
@@ -267,7 +279,8 @@
267
279
  const explicitRole = element.role;
268
280
  if (isIgnoredRole(explicitRole)) return;
269
281
  if (explicitRole !== null && (hasRoleSpecificSnapshot(explicitRole) || isContainerRole(explicitRole))) return explicitRole;
270
- const roleResolver = ELEMENT_ROLES[getElementTagName(element)];
282
+ const tagName = getElementTagName(element);
283
+ const roleResolver = ELEMENT_ROLES[tagName];
271
284
  if (roleResolver === void 0) return;
272
285
  if (typeof roleResolver === "string") return roleResolver;
273
286
  return roleResolver(element);
@@ -369,14 +382,17 @@
369
382
  }
370
383
  //#endregion
371
384
  //#region src/browser/name.ts
372
- const prohibitsNaming = new Set([
385
+ const prohibitsNaming = /* @__PURE__ */ new Set([
386
+ "code",
387
+ "emphasis",
373
388
  "label",
374
389
  "listitem",
375
390
  "paragraph",
376
391
  "rowgroup",
392
+ "strong",
377
393
  "term"
378
394
  ]);
379
- const supportsNamingByLabel = new Set([
395
+ const supportsNamingByLabel = /* @__PURE__ */ new Set([
380
396
  "checkbox",
381
397
  "combobox",
382
398
  "progressbar",
@@ -386,7 +402,7 @@
386
402
  "spinbutton",
387
403
  "textbox"
388
404
  ]);
389
- const supportsNamingFromChildContent = new Set([
405
+ const supportsNamingFromChildContent = /* @__PURE__ */ new Set([
390
406
  "button",
391
407
  "cell",
392
408
  "columnheader",
@@ -454,7 +470,7 @@
454
470
  }
455
471
  //#endregion
456
472
  //#region src/browser/button.ts
457
- const pressedValues = new Set(["mixed"]);
473
+ const pressedValues = /* @__PURE__ */ new Set(["mixed"]);
458
474
  function snapshotButton(element) {
459
475
  return {
460
476
  role: "button",
@@ -514,7 +530,7 @@
514
530
  ...inputStateAttributes(element)
515
531
  };
516
532
  }
517
- const CHECKED_INPUT_TYPES = new Set(["checkbox", "radio"]);
533
+ const CHECKED_INPUT_TYPES = /* @__PURE__ */ new Set(["checkbox", "radio"]);
518
534
  function resolveInputValue(element) {
519
535
  if (element instanceof HTMLInputElement && CHECKED_INPUT_TYPES.has(element.type)) return;
520
536
  return stringAttribute(element.value);
@@ -638,7 +654,7 @@
638
654
  }
639
655
  //#endregion
640
656
  //#region src/browser/link.ts
641
- const currentValues = new Set(["page", "step"]);
657
+ const currentValues = /* @__PURE__ */ new Set(["page", "step"]);
642
658
  function snapshotLink(element) {
643
659
  return {
644
660
  role: "link",
@@ -715,7 +731,7 @@
715
731
  }
716
732
  //#endregion
717
733
  //#region src/types/elements/table.ts
718
- const SORT_TYPES = new Set([
734
+ const SORT_TYPES = /* @__PURE__ */ new Set([
719
735
  "ascending",
720
736
  "descending",
721
737
  "other"
@@ -810,7 +826,7 @@
810
826
  }
811
827
  return snapshotContainer(elementRole, node);
812
828
  }
813
- const UNSUPPORTED_ELEMENTS = new Set([
829
+ const UNSUPPORTED_ELEMENTS = /* @__PURE__ */ new Set([
814
830
  "audio",
815
831
  "figure",
816
832
  "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<"alert" | "article" | "banner" | "blockquote" | "code" | "complementary" | "contentinfo" | "definition" | "descriptionlist" | "emphasis" | "form" | "grid" | "label" | "list" | "listbox" | "listitem" | "log" | "main" | "menu" | "navigation" | "note" | "paragraph" | "row" | "rowgroup" | "search" | "status" | "strong" | "table" | "tablist" | "tabpanel" | "term">;
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.23.0",
4
4
  "description": "Element snapshots for Playwright",
5
5
  "homepage": "https://cronn.github.io/file-snapshots/playwright/element-snapshots/",
6
6
  "bugs": {
@@ -26,27 +26,28 @@
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/lib-file-snapshots": "1.2.1",
30
+ "@cronn/playwright-file-snapshots": "2.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",
48
49
  "@cronn/test-utils": "0.0.0",
49
- "@cronn/vitest-file-snapshots": "2.1.1",
50
+ "@cronn/vitest-file-snapshots": "2.1.2",
50
51
  "@cronn/shared-configs": "0.0.0"
51
52
  },
52
53
  "peerDependencies": {
@@ -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",