@immense/vue-pom-generator 1.0.98 → 1.0.100

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/README.md CHANGED
@@ -787,10 +787,20 @@ misleading API. Components that do not forward the marker to a DOM root are omit
787
787
  component-instance composition rather than falling back to page-wide selectors; their
788
788
  own standalone fixture is still generated normally.
789
789
 
790
- When `injection.optionKeyAttribute` maps a radio component to `"value"`, its generated
791
- selection API uses the domain term directly: `selectByValue(value)`. Other configured
792
- attribute names retain `key` when the HTML attribute name is not a valid public TypeScript
793
- identifier (for example `data-value`).
790
+ Repeated option controls use their semantic identity automatically:
791
+
792
+ - radio inputs require `:value` and generate `selectByValue(value)`;
793
+ - elements with `role="option"` require `:data-value` and generate a keyed option action;
794
+ - other repeated controls continue to use their Vue `:key` identity.
795
+
796
+ When the template does not expose a finite set of values, the generated option parameter
797
+ accepts primitive HTML values (`string | number | boolean | bigint`) so domain enums can be
798
+ passed without string conversion.
799
+
800
+ Use `injection.optionKeyAttribute` only to override those conventions for a component.
801
+ Map the component to `"key"` to explicitly use Vue's reconciliation key, or to another
802
+ bound attribute such as `"data-option-id"`. A configured binding is required on recognized
803
+ option controls; generation fails instead of silently choosing a different identity.
794
804
 
795
805
  `data-pom-instance` is generator-owned. Do not author it in Vue templates.
796
806
 
package/RELEASE_NOTES.md CHANGED
@@ -1,41 +1,68 @@
1
- v1.0.98
1
+ I'll verify the actual commits and PR merge times in this release range before writing the notes.
2
+
3
+ PR #63 merged at 22:00:03Z (before the window start of 22:06:13Z), so it's in the prior release.
4
+ Only PR #62 is in range. Let me review the actual diff to write accurate notes.
5
+
6
+ Now I have a complete picture. Only PR #62 falls in the release window (PR #63 merged before the
7
+ window start). Here are the release notes:
2
8
 
3
9
  Highlights
4
10
 
5
- - Cleared all outstanding Knip findings — removed unused exports, simplified configuration, and
6
- extracted a dedicated floating-UI runtime entry point
7
- - Net reduction of 32 lines across 11 files; one new entry-point file added
8
- - No behavioral changes; cleanup and tooling hygiene only
11
+ - The generator now infers semantic option identities automatically instead of relying solely on
12
+ Vue's :key directive.
13
+ - Radio inputs derive identity from :value and emit selectByValue(value); elements with
14
+ role="option" derive identity from :data-value.
15
+ - optionKeyAttribute is repurposed as an explicit override — map to "key" to opt back into Vue's
16
+ reconciliation key, or to a custom bound attribute.
17
+ - Missing identity bindings on recognized option controls now fail fast with a clear, actionable
18
+ error instead of silently falling back.
9
19
 
10
20
  Changes
11
21
 
12
- Knip configuration
22
+ Semantic option identity inference
23
+
24
+ - Added getConventionalOptionIdentityAttribute to detect radio (:value) and ARIA option
25
+ (:data-value) controls by role and tag.
26
+ - Repeated radios generate selectByValue(value); repeated role="option" elements generate a keyed
27
+ option action keyed off :data-value.
28
+ - Other repeated controls continue to use Vue's :key identity unchanged.
29
+
30
+ optionKeyAttribute override semantics
13
31
 
14
- - Simplified knip.json rules (reduced from 11 lines to a leaner set)
32
+ - Explicit component configuration wins over semantic inference.
33
+ - Mapping a component to "key" selects Vue's reconciliation :key; any other value must match a
34
+ bound attribute on the option element.
35
+ - A configured or conventional binding that is missing on a repeated option control throws a
36
+ descriptive error with file/line context.
15
37
 
16
- Dead-code removal
38
+ Documentation & types
17
39
 
18
- - Removed unused exports from pom-discoverability.ts (4 deletions)
19
- - Trimmed tests/broad/helpers/fake-runtime.ts (21 lines reduced)
20
- - Trimmed scripts/bundle-floating-ui-runtime.mjs (21 lines reduced)
40
+ - Updated README.md and plugin/types.ts to document the new conventions, override behavior, and
41
+ fail-fast guarantee.
21
42
 
22
- New file
43
+ Tests
23
44
 
24
- - Added scripts/floating-ui-runtime-entry.ts — extracted dedicated entry point for the floating-UI
25
- runtime bundler
45
+ - Added fixtures covering missing :value on mousedown handlers, option-change handlers without
46
+ :value, and option elements missing :data-value.
47
+ - Updated transform.test.ts and semantic-component-instances.test.ts to reflect the new identity
48
+ resolution.
26
49
 
27
- Minor cleanup
50
+ Breaking Changes
28
51
 
29
- - pom-params.ts, pom-patterns.ts, router-introspection.ts, utils.ts — small adjustments to satisfy
30
- Knip
31
- - package.json / package-lock.json — updated entry-point wiring
52
+ - Repeated radios must bind :value. Repeated elements with role="option" must bind :data-value.
53
+ Templates that previously relied on an implicit :key fallback for these controls will now fail
54
+ generation with a directed error message.
55
+ - Missing optionKeyAttribute overrides no longer silently fall back to :key. A configured binding
56
+ is required on recognized option controls; absence is a hard error.
32
57
 
33
58
  Pull Requests Included
34
59
 
35
- - #61 Clear Knip findings — by @dkattan (]8;id=md-ce60fz;https://github.com/immense/vue-pom-generator/pull/61link]8;;]8;;)]8;;
60
+ - ]8;id=md-co5m4y;https://github.com/immense/vue-pom-generator/pull/62#62 Infer semantic option identities]8;;]8;; (@dkattan)]8;;
36
61
 
37
62
  Testing
38
63
 
39
- No new tests added; changes are code cleanup, configuration, and build-script refactoring only.
40
- Existing test suite continues to cover the affected modules.
64
+ - npm test (42 files, 431 tests), npm run typecheck, npm run lint (0 errors), npm run smoke:pack,
65
+ and npm run test:playwright (3 tests) all pass.
66
+ - Validated against an ImmyBot generated-POM migration build (643 entries, 1,442 selectors) using a
67
+ local packed dependency.
41
68
 
@@ -8,6 +8,7 @@ import type { CalloutRenderer } from "./callout";
8
8
  import { Pointer, type AfterPointerClick, type AfterPointerClickInfo, type PointerRenderer } from "./pointer";
9
9
 
10
10
  const POM_ACTIVE_ACTION_REGISTRY = Symbol.for("@immense/vue-pom-generator.active-action-registry");
11
+ const CHECKABLE_CONTROL_SELECTOR = 'input[type="checkbox"], input[type="radio"]';
11
12
 
12
13
  interface PomActiveActionRecord {
13
14
  componentName?: string;
@@ -621,8 +622,16 @@ export class BasePage {
621
622
  let clickTarget = locator;
622
623
  let activateWithKeyboard = false;
623
624
  if (action?.preferAssociatedLabel) {
624
- const visibleControl = locator;
625
- const controlId = await visibleControl.getAttribute("id");
625
+ // Vue components commonly consume an `id` prop while fallthrough attributes such as
626
+ // `data-testid` land on the component's root wrapper. Prefer the nested native control
627
+ // when present so generated checkbox actions activate the control instead of its wrapper.
628
+ const testIdSelector = this.selectorForTestId(testId);
629
+ const control = this.describeLocator(this.page.locator([
630
+ `${testIdSelector}:is(${CHECKABLE_CONTROL_SELECTOR})`,
631
+ `${testIdSelector} :is(${CHECKABLE_CONTROL_SELECTOR})`,
632
+ ].join(", ")), description).first();
633
+ clickTarget = control;
634
+ const controlId = await control.getAttribute("id");
626
635
  if (controlId) {
627
636
  // Bootstrap custom controls often use an empty label whose painted ::before/::after
628
637
  // pseudo-elements intercept the pointer. Playwright's visible filter can exclude that
@@ -641,14 +650,11 @@ export class BasePage {
641
650
  }
642
651
  }
643
652
  }
644
- else {
645
- clickTarget = visibleControl;
646
- }
647
653
  }
648
654
  const afterClick = this.getAfterPointerClick(wait);
649
655
  if (activateWithKeyboard) {
650
- await this.pointer.animateCursorToElement(locator, false, 200, annotationText);
651
- await locator.press("Space");
656
+ await this.pointer.animateCursorToElement(clickTarget, false, 200, annotationText);
657
+ await clickTarget.press("Space");
652
658
  if (afterClick) {
653
659
  await afterClick({ testId, instrumented: true });
654
660
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-page.d.ts","sourceRoot":"","sources":["../../class-generation/base-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAK5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAW,KAAK,iBAAiB,EAA8B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAgC9G;;;;;;;;GAQG;AACH;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,GACzD,CAAC,S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index.cjs CHANGED
@@ -3052,9 +3052,10 @@ Fix: either (1) include ${bestKeyPreservePlaceholder} in your :${attrLabel} temp
3052
3052
  }
3053
3053
  }
3054
3054
  }
3055
+ const selectorParameterName = args.selectorParameterName?.trim() || "key";
3055
3056
  const getKeyTypeFromValues = (values) => {
3056
3057
  if (!values || values.length === 0) {
3057
- return "string";
3058
+ return selectorParameterName === "key" ? "string" : "string | number | boolean | bigint";
3058
3059
  }
3059
3060
  return values.map((v) => JSON.stringify(v)).join(" | ");
3060
3061
  };
@@ -3079,7 +3080,6 @@ Fix: either (1) include ${bestKeyPreservePlaceholder} in your :${attrLabel} temp
3079
3080
  };
3080
3081
  const normalizedRole = normalizeNativeRole(args.nativeRole) ?? "button";
3081
3082
  const targetPageObjectModelClass = entryOverrides.targetPageObjectModelClass;
3082
- const selectorParameterName = args.selectorParameterName?.trim() || "key";
3083
3083
  const pomKeyPattern = dataTestId.kind === "template" ? toPomKeyPattern(dataTestId, selectorParameterName) : null;
3084
3084
  const formattedDataTestIdForPom = dataTestId.kind === "template" ? pomKeyPattern.formatted : dataTestId.value;
3085
3085
  const selectorPatternKind = dataTestId.kind === "template" ? "parameterized" : "static";
@@ -8728,6 +8728,24 @@ function getStaticAttributeContent(element, name) {
8728
8728
  function getNativeHtmlControlRole(element) {
8729
8729
  return getElementControlRole(element);
8730
8730
  }
8731
+ function getConventionalOptionIdentityAttribute(element) {
8732
+ const explicitRole = getStaticAttributeContent(element, "role")?.toLowerCase();
8733
+ if (explicitRole === "option") {
8734
+ return "data-value";
8735
+ }
8736
+ if (explicitRole === "radio") {
8737
+ return "value";
8738
+ }
8739
+ const tag = element.tag.toLowerCase();
8740
+ const type = getStaticAttributeContent(element, "type")?.toLowerCase();
8741
+ if ((tag === "input" || tag === "uinput") && type === "radio") {
8742
+ return "value";
8743
+ }
8744
+ return null;
8745
+ }
8746
+ function describeConventionalOption(element) {
8747
+ return getConventionalOptionIdentityAttribute(element) === "value" ? "radio" : `<${element.tag} role="option">`;
8748
+ }
8731
8749
  function normalizeControlLabelText(value) {
8732
8750
  const normalized = (value ?? "").replace(/\*/g, " ").replace(/\s+/g, " ").trim();
8733
8751
  return normalized || null;
@@ -9282,15 +9300,55 @@ Fix: set \`role\` explicitly in nativeWrappers (e.g. { "${element.tag}": { role:
9282
9300
  const getBestAvailableKeyInfo = () => {
9283
9301
  const parentNode = context.parent && typeof context.parent === "object" ? context.parent : null;
9284
9302
  const isDirectVForChild = parentNode?.type === compilerCore.NodeTypes.FOR;
9285
- const configuredAttrName = optionKeyAttribute[componentName];
9303
+ const isInVForScope = isDirectVForChild || context.scopes.vFor > 0;
9304
+ const vForKeyInfo = (isDirectVForChild ? getKeyDirectiveInfo(element) : null) || getContainedInVForDirectiveKeyInfo(context, element, hierarchyMap);
9305
+ const conventionalIdentityAttribute = getConventionalOptionIdentityAttribute(element);
9306
+ const configuredAttrName = optionKeyAttribute[componentName]?.trim();
9307
+ if (configuredAttrName === "key") {
9308
+ if (vForKeyInfo) {
9309
+ return vForKeyInfo;
9310
+ }
9311
+ if (isInVForScope && conventionalIdentityAttribute) {
9312
+ const loc = element.loc.start;
9313
+ throw new Error(
9314
+ `[vue-pom-generator] optionKeyAttribute maps ${componentName} to "key", but repeated ${describeConventionalOption(element)} has no resolvable v-for :key.
9315
+ File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}
9316
+
9317
+ Fix: bind :key on the repeated option or remove the override to use the conventional :${conventionalIdentityAttribute} identity.`
9318
+ );
9319
+ }
9320
+ }
9286
9321
  if (configuredAttrName && configuredAttrName !== "key") {
9287
9322
  const bindingKeyInfo = getBindingKeyInfo(element, configuredAttrName);
9288
9323
  if (bindingKeyInfo) {
9289
9324
  selectorParameterName = configuredAttrName === "value" ? "value" : "key";
9290
9325
  return bindingKeyInfo;
9291
9326
  }
9327
+ if (isInVForScope && conventionalIdentityAttribute) {
9328
+ const loc = element.loc.start;
9329
+ throw new Error(
9330
+ `[vue-pom-generator] optionKeyAttribute maps ${componentName} to "${configuredAttrName}", but repeated ${describeConventionalOption(element)} does not bind :${configuredAttrName}.
9331
+ File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}
9332
+
9333
+ Fix: bind :${configuredAttrName} on the option element or remove the override to use the conventional :${conventionalIdentityAttribute} identity.`
9334
+ );
9335
+ }
9336
+ }
9337
+ if (conventionalIdentityAttribute) {
9338
+ const bindingKeyInfo = getBindingKeyInfo(element, conventionalIdentityAttribute);
9339
+ if (bindingKeyInfo) {
9340
+ selectorParameterName = conventionalIdentityAttribute === "value" ? "value" : "key";
9341
+ return bindingKeyInfo;
9342
+ }
9343
+ if (isInVForScope) {
9344
+ const loc = element.loc.start;
9345
+ throw new Error(
9346
+ `[vue-pom-generator] Repeated ${describeConventionalOption(element)} must bind :${conventionalIdentityAttribute} for generated option selection.
9347
+ Component: ${componentName}
9348
+ File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}`
9349
+ );
9350
+ }
9292
9351
  }
9293
- const vForKeyInfo = (isDirectVForChild ? getKeyDirectiveInfo(element) : null) || getContainedInVForDirectiveKeyInfo(context, element, hierarchyMap);
9294
9352
  if (vForKeyInfo) {
9295
9353
  return vForKeyInfo;
9296
9354
  }