mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 19:47:10 +00:00
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.
8 lines
437 B
TypeScript
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()}`)}`;
|
|
}
|