@cronn/element-snapshot 0.4.0 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -9,7 +9,9 @@ interface ButtonSnapshot extends GenericElementSnapshot<"button", ButtonAttribut
9
9
  }
10
10
  interface ButtonAttributes extends DisableableAttributes {
11
11
  expanded?: boolean;
12
+ pressed?: PressedValue;
12
13
  }
14
+ type PressedValue = true | "mixed";
13
15
 
14
16
  interface InputSnapshot extends GenericElementSnapshot<CommonInputRole, InputAttributes> {
15
17
  }
@@ -85,17 +85,26 @@
85
85
  }
86
86
 
87
87
  // src/snapshots/button.ts
88
+ var PRESSED_VALUES = /* @__PURE__ */ new Set(["true", "mixed", "false"]);
88
89
  function snapshotButton(element) {
89
90
  return {
90
91
  role: "button",
91
92
  name: resolveAccessibleName(element),
92
93
  attributes: {
93
94
  ...disableableAttributes(element),
94
- expanded: booleanAttribute(element.ariaExpanded)
95
+ expanded: booleanAttribute(element.ariaExpanded),
96
+ pressed: resolvePressedAttribute(element)
95
97
  },
96
98
  children: snapshotChildren(element)
97
99
  };
98
100
  }
101
+ function resolvePressedAttribute(element) {
102
+ const pressed = enumAttribute(element.ariaPressed, PRESSED_VALUES);
103
+ if (pressed === "mixed") {
104
+ return pressed;
105
+ }
106
+ return booleanAttribute(pressed === "true");
107
+ }
99
108
 
100
109
  // src/snapshots/description.ts
101
110
  function resolveDescription(element) {
package/dist/types.d.ts CHANGED
@@ -9,7 +9,9 @@ interface ButtonSnapshot extends GenericElementSnapshot<"button", ButtonAttribut
9
9
  }
10
10
  interface ButtonAttributes extends DisableableAttributes {
11
11
  expanded?: boolean;
12
+ pressed?: PressedValue;
12
13
  }
14
+ type PressedValue = true | "mixed";
13
15
 
14
16
  interface InputSnapshot extends GenericElementSnapshot<CommonInputRole, InputAttributes> {
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronn/element-snapshot",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Element snapshots for Playwright",
5
5
  "author": "cronn",
6
6
  "license": "Apache-2.0",
@@ -34,9 +34,9 @@
34
34
  "eslint-config-prettier": "10.1.8",
35
35
  "eslint-plugin-unused-imports": "4.3.0",
36
36
  "prettier": "3.6.2",
37
- "tsup": "8.5.0",
37
+ "tsup": "8.5.1",
38
38
  "typescript": "5.9.3",
39
- "typescript-eslint": "8.46.3",
39
+ "typescript-eslint": "8.47.0",
40
40
  "@cronn/shared-configs": "0.0.0"
41
41
  },
42
42
  "scripts": {