Files
sanderling/replay-ui/sanderling/data-attributes.ts
T
pj e432af7828 fix(replay-ui): read data-* attributes by their markup names
The web runtime now publishes raw markup attribute names, so attrs["step"]
read nothing where the markup writes data-step. Three properties went
vacuous and exactlyOneStepIsSelected reported false against a UI that was
fine.

The test also fails if a dataOf key gains no matching attribute, or if an
attribute it derives is rendered nowhere.
2026-08-17 23:45:33 +05:30

8 lines
437 B
TypeScript

// attrs is keyed by the names the markup writes (rawAttributes in
// pkg/spec/src/web-runtime.ts), and the goja host the properties run in exposes
// attrs and nothing else (internal/verifier/marshal.go): there is no dataset
// field to read a camelCased key off, so the spec converts the key itself.
export function attributeOf(key: string): string {
return `data-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;
}