@immense/vue-pom-generator 1.0.80 → 1.0.82
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 +4 -3
- package/RELEASE_NOTES.md +55 -38
- package/class-generation/base-page.ts +1 -2
- package/dist/class-generation/base-page.d.ts.map +1 -1
- package/dist/compiler-metadata-utils.d.ts.map +1 -1
- package/dist/index.cjs +53 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -26
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/internal-plugins.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/client.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/format.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/plugin.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/vue-detector.d.ts.map +1 -1
- package/dist/pom-discoverability.d.ts.map +1 -1
- package/dist/pom-patterns.d.ts.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/runtime/annotator/client.ts +4 -0
- package/plugin/runtime/annotator/format.ts +4 -0
- package/plugin/runtime/annotator/plugin.ts +4 -0
- package/plugin/runtime/annotator/vue-detector.ts +14 -0
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ The generator does not use one naming trick. It layers several signals.
|
|
|
78
78
|
- **Fallback naming exists, but it is intentionally conservative.** That is why `generation.nameCollisionBehavior` exists.
|
|
79
79
|
- **Wrapper-action generation fails fast.** The generator blocks button-like wrapper `:handler` expressions that it cannot turn into a semantic action name.
|
|
80
80
|
|
|
81
|
-
Important limit: wrapper inference is helpful, not magical. The current implementation recursively inspects simple local SFC templates for the first inferable primitive (`input`, `textarea`, `select`, `button`, `vselect`, radio/checkbox inputs). It also recognizes some naming patterns like `*Button`. For anything more complex, configure `nativeWrappers` explicitly.
|
|
81
|
+
Important limit: wrapper inference is helpful, not magical. The current implementation recursively inspects simple local SFC templates for the first inferable primitive (`input`, `textarea`, `select`, `button`, `vselect`, radio/checkbox inputs, and `a` *with `href`*/`RouterLink` → `link`). It also recognizes some naming patterns like `*Button`. For anything more complex, configure `nativeWrappers` explicitly.
|
|
82
82
|
|
|
83
83
|
## Playwright before/after examples
|
|
84
84
|
|
|
@@ -990,9 +990,10 @@ The sections below follow the actual `VuePomGeneratorPluginOptions` shape from `
|
|
|
990
990
|
|
|
991
991
|
##### `nativeWrappers[...].role`
|
|
992
992
|
|
|
993
|
-
- **What it does:** Chooses the native behavior to emulate (`button`, `input`, `select`, `vselect`, `checkbox`, `toggle`, `radio`, `grid`).
|
|
994
|
-
- **Why it exists:** Role drives both test-id suffixes and generated POM method families (`click...`, `type...`, `select...`, etc.).
|
|
993
|
+
- **What it does:** Chooses the native behavior to emulate (`button`, `input`, `select`, `vselect`, `checkbox`, `toggle`, `radio`, `grid`, `link`).
|
|
994
|
+
- **Why it exists:** Role drives both test-id suffixes and generated POM method families (`click...`, `type...`, `select...`, etc.). `link` is the role for anchor-rendering wrappers (components that render an `<a>`/`RouterLink`); it produces `...Link` accessors and `-link` test-id suffixes, with `goTo...` navigation methods when a `:to` route target is resolvable.
|
|
995
995
|
- **Benefit:** The generated API matches what the wrapped control actually does.
|
|
996
|
+
- **Optional / inferred:** `role` may be omitted. When omitted, the generator infers it from the wrapper's rendered template — a component rendering an `<a>` *with an `href`* (or a `RouterLink`, directly or through nested wrapper components like a shared `AppLink`) infers `link`, an `<input>` infers `input`, and so on. Recursion follows `wrapperSearchRoots`. A bare `<a>` without an `href` is **not** a link (it has no implicit ARIA role) and won't be classified as `link`. If no native role can be inferred, the generator **throws** rather than guessing — declare `role` explicitly for wrappers that don't render a recognized native control. Declaring `role` explicitly always takes precedence over inference.
|
|
996
997
|
- **Without it:** wrapper components may be treated as generic tags unless they can be inferred.
|
|
997
998
|
|
|
998
999
|
##### `nativeWrappers[...].valueAttribute`
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,55 +1,72 @@
|
|
|
1
|
-
I'll
|
|
1
|
+
I'll verify the actual commits in the release range and check PR merge times to accurately identify
|
|
2
|
+
what's included in v1.0.82.
|
|
2
3
|
|
|
3
|
-
Now I
|
|
4
|
-
|
|
4
|
+
Now I understand the timeline. v1.0.81 = commit c74f482 (#44, merged 06:21:57 CDT), and HEAD =
|
|
5
|
+
7641d3f (#43, merged 08:15:13 CDT). So only PR #43 is in this release. Let me examine the actual
|
|
6
|
+
diff to write accurate notes.
|
|
7
|
+
|
|
8
|
+
Now I have a complete picture. Only PR #43 is in the v1.0.81..HEAD range. Let me write the release
|
|
9
|
+
notes.
|
|
5
10
|
|
|
6
11
|
Highlights
|
|
7
12
|
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- New link native role for anchor-rendering wrappers — components that render <a> (with href) or
|
|
14
|
+
RouterLink are now classified as link, producing ...Link accessors and -link test-id suffixes
|
|
15
|
+
- role is now optional on nativeWrappers config — when omitted, the generator infers it from the
|
|
16
|
+
wrapper's rendered template, recursing through nested wrapper components
|
|
17
|
+
- Fail-fast on unresolvable roles — if role is omitted and no native role can be inferred from the
|
|
18
|
+
template, the generator throws an actionable error instead of silently defaulting
|
|
19
|
+
- Correct ARIA semantics — a bare <a> without href is not treated as link (no implicit ARIA role),
|
|
20
|
+
preventing misclassification of anchor placeholders or anchor-styled buttons
|
|
16
21
|
|
|
17
22
|
Changes
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- Added
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
Role inference & link support
|
|
25
|
+
|
|
26
|
+
- Added link to the NativeRole union type (utils.ts)
|
|
27
|
+
- NativeWrappersMap[...].role is now optional; the transform infers it from the component's
|
|
28
|
+
rendered template when omitted (utils.ts, transform.ts)
|
|
29
|
+
- tryInferNativeWrapperRoleFromSfc now recognizes <a>/<ua> with an href (static or :href bind) and
|
|
30
|
+
RouterLink as link, recursing through nested wrapper components (transform.ts)
|
|
31
|
+
- formatTagName, getNativeWrapperTransformInfo, applyResolvedDataTestId, and
|
|
32
|
+
STANDALONE_WRAPPER_FALLBACK_ROLES updated to handle the link role (utils.ts)
|
|
33
|
+
- When a declared wrapper omits role and inference fails, the transform throws with a precise error
|
|
34
|
+
including file/line context (transform.ts)
|
|
35
|
+
- getNativeWrapperTransformInfo and formatTagName fail fast if called directly with an unresolved
|
|
36
|
+
(role-less) config (utils.ts)
|
|
37
|
+
|
|
38
|
+
Cleanup & maintenance
|
|
39
|
+
|
|
40
|
+
- Removed unused destructured options from createInternalPlugins (plugin/internal-plugins.ts)
|
|
41
|
+
- Removed unused requireEvent parameter from BasePage click-event evaluation
|
|
42
|
+
(class-generation/base-page.ts)
|
|
43
|
+
- Narrowed writeConstJson parameter type in manifest generator (manifest-generator.ts)
|
|
44
|
+
- Replaced .some(c => x === c) with .includes(x) in applyResolvedDataTestId (utils.ts)
|
|
45
|
+
- Added no-restricted-syntax ESLint disable/enable annotations for regex usage on non-source-code
|
|
46
|
+
strings (UI text, paths, CSS tokens) across compiler-metadata-utils.ts, pom-discoverability.ts,
|
|
47
|
+
pom-patterns.ts, and the annotator runtime (client.ts, format.ts, plugin.ts, vue-detector.ts)
|
|
48
|
+
- Removed dead :data-testid directive capture block in createTestIdTransform (transform.ts)
|
|
49
|
+
|
|
50
|
+
Documentation
|
|
51
|
+
|
|
52
|
+
- Updated README to document the link role, optional/inferred role behavior, and expanded inference
|
|
53
|
+
list (README.md)
|
|
42
54
|
|
|
43
55
|
Breaking Changes
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
- nativeWrappers[...].role is now optional — previously required. Existing configs that declare
|
|
58
|
+
role are unaffected. Configs that omit role will now trigger inference (or a fail-fast error if no
|
|
59
|
+
role can be inferred) instead of a type error.
|
|
46
60
|
|
|
47
61
|
Pull Requests Included
|
|
48
62
|
|
|
49
|
-
- ]8;id=md-
|
|
63
|
+
- ]8;id=md-f68cdn;https://github.com/immense/vue-pom-generator/pull/43#43 feat: infer link role for anchor-rendering wrappers]8;;]8;; (by @dkattan)]8;;
|
|
50
64
|
|
|
51
65
|
Testing
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
- Added 4 tests in tests/transform.test.ts: link role inference from a rendered <a> with :href,
|
|
68
|
+
inference through nested wrapper components via RouterLink, refusal to infer link from a bare <a>
|
|
69
|
+
without href (throws), and fail-fast when role can't be inferred from a non-native element (<div>)
|
|
70
|
+
- Added 1 test in tests/utils-coverage.test.ts verifying getNativeWrapperTransformInfo throws on
|
|
71
|
+
unresolved role-less configs
|
|
55
72
|
|
|
@@ -139,7 +139,7 @@ export class BasePage {
|
|
|
139
139
|
// In that scenario, the click already did its job; don't fail the test infra.
|
|
140
140
|
try {
|
|
141
141
|
await this.page.evaluate(
|
|
142
|
-
({ eventName, expectedTestId, timeoutMs,
|
|
142
|
+
({ eventName, expectedTestId, timeoutMs, debug }) => {
|
|
143
143
|
return new Promise<void>((resolve, reject) => {
|
|
144
144
|
const g = globalThis;
|
|
145
145
|
if (!g || typeof g.addEventListener !== "function") {
|
|
@@ -212,7 +212,6 @@ export class BasePage {
|
|
|
212
212
|
eventName: TESTID_CLICK_EVENT_NAME,
|
|
213
213
|
expectedTestId: testId,
|
|
214
214
|
timeoutMs,
|
|
215
|
-
requireEvent,
|
|
216
215
|
debug: CLICK_EVENT_DEBUG,
|
|
217
216
|
},
|
|
218
217
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-page.d.ts","sourceRoot":"","s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AE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D;;;;OAIG;cACa,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-metadata-utils.d.ts","sourceRoot":"","sources":["../compiler-metadata-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,GAAE,MAAsB,GAAG,cAAc,CAQ9G;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAcrE;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CA+C/G;
|
|
1
|
+
{"version":3,"file":"compiler-metadata-utils.d.ts","sourceRoot":"","sources":["../compiler-metadata-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,GAAE,MAAsB,GAAG,cAAc,CAQ9G;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAcrE;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CA+C/G;AAsCD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC,EAAE,OAAO,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,eAAe,GAAG,IAAI,CA6DzB"}
|
package/dist/index.cjs
CHANGED
|
@@ -2247,6 +2247,11 @@ function getNativeWrapperTransformInfo(node, componentName, nativeWrappers) {
|
|
|
2247
2247
|
return { nativeWrappersValue: null, optionDataTestIdPrefixValue: null, semanticNameHint: null };
|
|
2248
2248
|
}
|
|
2249
2249
|
const { role, valueAttribute, requiresOptionDataTestIdPrefix, inferred } = wrapperConfig;
|
|
2250
|
+
if (!role) {
|
|
2251
|
+
throw new Error(
|
|
2252
|
+
`[vue-pom-generator] Native wrapper <${node.tag}> has no resolved role in getNativeWrapperTransformInfo. The transform infers or declares a role before reaching this point; if calling this helper directly, pass a config with \`role\` set.`
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2250
2255
|
if (nodeHasClickDirective(node) && role === "button") {
|
|
2251
2256
|
return { nativeWrappersValue: null, optionDataTestIdPrefixValue: null, semanticNameHint: null };
|
|
2252
2257
|
}
|
|
@@ -2335,7 +2340,13 @@ function generateToDirectiveDataTestId(componentName, node, toDirective, context
|
|
|
2335
2340
|
}
|
|
2336
2341
|
function formatTagName(node, nativeWrappers) {
|
|
2337
2342
|
if (Object.keys(nativeWrappers).includes(node.tag)) {
|
|
2338
|
-
|
|
2343
|
+
const role = nativeWrappers[node.tag].role;
|
|
2344
|
+
if (!role) {
|
|
2345
|
+
throw new Error(
|
|
2346
|
+
`[vue-pom-generator] Native wrapper <${node.tag}> has no resolved role in formatTagName. The transform infers or declares a role before reaching this point; if calling this helper directly, pass a config with \`role\` set.`
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
return `-${role}`;
|
|
2339
2350
|
}
|
|
2340
2351
|
const nodeName = node.tag.replace(/-/g, "").toLowerCase();
|
|
2341
2352
|
return `-${nodeName}`;
|
|
@@ -2939,7 +2950,7 @@ Fix: reduce the template to a single key-based interpolation, or remove the expl
|
|
|
2939
2950
|
);
|
|
2940
2951
|
}
|
|
2941
2952
|
const hasExact = requiredKeyTemplateValue ? templateFragmentContainsSingleExpression(existingTemplateValue.parsedTemplate, requiredKeyTemplateValue.parsedTemplate) : false;
|
|
2942
|
-
const hasVarAccess = getBestKeyAccessCandidates(bestKeyVariable).
|
|
2953
|
+
const hasVarAccess = getBestKeyAccessCandidates(bestKeyVariable).includes(existingTemplateFragment.expressionSource);
|
|
2943
2954
|
if (!hasExact && !hasVarAccess && bestKeyPreservePlaceholder) {
|
|
2944
2955
|
throw new Error(
|
|
2945
2956
|
`[vue-pom-generator] Existing ${attrLabel} appears to be missing the key placeholder needed to keep it unique.
|
|
@@ -3001,6 +3012,7 @@ Fix: either (1) include ${bestKeyPreservePlaceholder} in your :${attrLabel} temp
|
|
|
3001
3012
|
case "toggle":
|
|
3002
3013
|
case "radio":
|
|
3003
3014
|
case "grid":
|
|
3015
|
+
case "link":
|
|
3004
3016
|
return role;
|
|
3005
3017
|
default:
|
|
3006
3018
|
return void 0;
|
|
@@ -3622,7 +3634,8 @@ const STANDALONE_WRAPPER_FALLBACK_ROLES = /* @__PURE__ */ new Set([
|
|
|
3622
3634
|
"vselect",
|
|
3623
3635
|
"checkbox",
|
|
3624
3636
|
"toggle",
|
|
3625
|
-
"radio"
|
|
3637
|
+
"radio",
|
|
3638
|
+
"link"
|
|
3626
3639
|
]);
|
|
3627
3640
|
function stripTrailingAsciiDigits(value) {
|
|
3628
3641
|
let end = value.length;
|
|
@@ -7168,6 +7181,18 @@ ${buildSearchRootsKey(normalizedSearchRoots)}`;
|
|
|
7168
7181
|
});
|
|
7169
7182
|
return (typeAttr?.value?.content ?? "").toLowerCase();
|
|
7170
7183
|
};
|
|
7184
|
+
const hasHrefAttribute = (element) => {
|
|
7185
|
+
return element.props.some((prop) => {
|
|
7186
|
+
if (prop.type === compilerCore.NodeTypes.ATTRIBUTE) {
|
|
7187
|
+
return prop.name === "href";
|
|
7188
|
+
}
|
|
7189
|
+
if (prop.type === compilerCore.NodeTypes.DIRECTIVE) {
|
|
7190
|
+
const directive = prop;
|
|
7191
|
+
return directive.name === "bind" && directive.arg?.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && directive.arg.content === "href";
|
|
7192
|
+
}
|
|
7193
|
+
return false;
|
|
7194
|
+
});
|
|
7195
|
+
};
|
|
7171
7196
|
let inferRoleFromNode;
|
|
7172
7197
|
const inferRoleFromElement = (element) => {
|
|
7173
7198
|
const elementTag = (element.tag || "").toLowerCase();
|
|
@@ -7187,6 +7212,10 @@ ${buildSearchRootsKey(normalizedSearchRoots)}`;
|
|
|
7187
7212
|
return { role: "vselect" };
|
|
7188
7213
|
if (elementTag === "button" || elementTag === "ubutton")
|
|
7189
7214
|
return { role: "button" };
|
|
7215
|
+
if (elementTag === "router-link" || elementTag === "routerlink")
|
|
7216
|
+
return { role: "link" };
|
|
7217
|
+
if ((elementTag === "a" || elementTag === "ua") && hasHrefAttribute(element))
|
|
7218
|
+
return { role: "link" };
|
|
7190
7219
|
if (isComponentLikeTag(element.tag) && element.tag !== tag) {
|
|
7191
7220
|
const nested = tryInferNativeWrapperRoleFromSfc(element.tag, vueFilesPathMap, normalizedSearchRoots, nextSeen);
|
|
7192
7221
|
if (nested)
|
|
@@ -7481,11 +7510,6 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
7481
7510
|
}
|
|
7482
7511
|
const element = node;
|
|
7483
7512
|
const parentIsRoot = context?.parent?.type === compilerCore.NodeTypes.ROOT;
|
|
7484
|
-
{
|
|
7485
|
-
element.props.find(
|
|
7486
|
-
(p) => p.type === compilerCore.NodeTypes.DIRECTIVE && p.name === "bind" && p.arg?.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && p.arg.content === testIdAttribute && !!p.exp
|
|
7487
|
-
);
|
|
7488
|
-
}
|
|
7489
7513
|
const grandParent = context.grandParent;
|
|
7490
7514
|
const parentElement = !parentIsRoot && context?.parent?.type === compilerCore.NodeTypes.ELEMENT ? context.parent : !parentIsRoot && grandParent?.type === compilerCore.NodeTypes.ELEMENT ? grandParent : null;
|
|
7491
7515
|
hierarchyMap.set(element, parentElement);
|
|
@@ -7543,7 +7567,8 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
7543
7567
|
}
|
|
7544
7568
|
}
|
|
7545
7569
|
}
|
|
7546
|
-
|
|
7570
|
+
const existingWrapperConfig = nativeWrappers[element.tag];
|
|
7571
|
+
if (!existingWrapperConfig) {
|
|
7547
7572
|
const inferred = tryInferNativeWrapperRoleFromSfc(element.tag, vueFilesPathMap, wrapperSearchRoots);
|
|
7548
7573
|
if (inferred?.role) {
|
|
7549
7574
|
nativeWrappers[element.tag] = { role: inferred.role, inferred: true };
|
|
@@ -7552,6 +7577,22 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
7552
7577
|
} else if (element.tag === "DxDataGrid") {
|
|
7553
7578
|
nativeWrappers[element.tag] = { role: "grid" };
|
|
7554
7579
|
}
|
|
7580
|
+
} else if (!existingWrapperConfig.role) {
|
|
7581
|
+
const inferred = tryInferNativeWrapperRoleFromSfc(element.tag, vueFilesPathMap, wrapperSearchRoots);
|
|
7582
|
+
if (!inferred?.role) {
|
|
7583
|
+
const loc = element.loc?.start;
|
|
7584
|
+
const locationHint = loc ? `${loc.line}:${loc.column}` : "unknown";
|
|
7585
|
+
throw new Error(
|
|
7586
|
+
`[vue-pom-generator] Could not infer a native role for declared wrapper <${element.tag}> in ${componentName} (${context.filename ?? "unknown"}:${locationHint}).
|
|
7587
|
+
The component's template does not render a recognized native control (input, textarea, select, button, vselect, a[href]/RouterLink, radio, checkbox).
|
|
7588
|
+
|
|
7589
|
+
Fix: set \`role\` explicitly in nativeWrappers (e.g. { "${element.tag}": { role: "button", ... } }).`
|
|
7590
|
+
);
|
|
7591
|
+
}
|
|
7592
|
+
nativeWrappers[element.tag] = {
|
|
7593
|
+
...existingWrapperConfig,
|
|
7594
|
+
role: inferred.role
|
|
7595
|
+
};
|
|
7555
7596
|
}
|
|
7556
7597
|
const getBestAvailableKeyInfo = () => {
|
|
7557
7598
|
const parentNode = context.parent && typeof context.parent === "object" ? context.parent : null;
|
|
@@ -7861,7 +7902,7 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
|
|
|
7861
7902
|
}
|
|
7862
7903
|
if (existingElementDataTestId) {
|
|
7863
7904
|
const inferredRole = getNativeRoleFromTagSuffix().toLowerCase();
|
|
7864
|
-
const isRecognizedInteractiveRole = inferredRole === "button" || inferredRole === "input" || inferredRole === "select" || inferredRole === "vselect" || inferredRole === "checkbox" || inferredRole === "toggle" || inferredRole === "radio" || inferredRole === "grid" || isComponentLikeTag(element.tag);
|
|
7905
|
+
const isRecognizedInteractiveRole = inferredRole === "button" || inferredRole === "input" || inferredRole === "select" || inferredRole === "vselect" || inferredRole === "checkbox" || inferredRole === "toggle" || inferredRole === "radio" || inferredRole === "grid" || inferredRole === "link" || isComponentLikeTag(element.tag);
|
|
7865
7906
|
if (!isRecognizedInteractiveRole) {
|
|
7866
7907
|
return;
|
|
7867
7908
|
}
|
|
@@ -8960,23 +9001,9 @@ function createInternalPlugins(options) {
|
|
|
8960
9001
|
annotatorRuntime
|
|
8961
9002
|
} = options;
|
|
8962
9003
|
const {
|
|
8963
|
-
outDir,
|
|
8964
|
-
emitLanguages,
|
|
8965
|
-
typescriptOutputStructure,
|
|
8966
|
-
csharp,
|
|
8967
|
-
generateFixtures,
|
|
8968
|
-
customPomAttachments,
|
|
8969
|
-
customPomDir,
|
|
8970
|
-
requireCustomPomDir,
|
|
8971
|
-
customPomImportAliases,
|
|
8972
|
-
customPomImportNameCollisionBehavior,
|
|
8973
|
-
nameCollisionBehavior,
|
|
8974
|
-
existingIdBehavior,
|
|
8975
|
-
testIdAttribute,
|
|
8976
9004
|
routerAwarePoms,
|
|
8977
9005
|
routerEntry,
|
|
8978
|
-
routerType
|
|
8979
|
-
routerModuleShims
|
|
9006
|
+
routerType
|
|
8980
9007
|
} = generation;
|
|
8981
9008
|
const resolveRouterEntry2 = () => {
|
|
8982
9009
|
if (!routerAwarePoms)
|
|
@@ -9098,7 +9125,7 @@ function findStaticAttributeValue(element, attributeName) {
|
|
|
9098
9125
|
(prop) => prop.type === compilerCore.NodeTypes.ATTRIBUTE && prop.name === attributeName
|
|
9099
9126
|
);
|
|
9100
9127
|
const value = attribute?.value?.content?.trim();
|
|
9101
|
-
return value
|
|
9128
|
+
return value || void 0;
|
|
9102
9129
|
}
|
|
9103
9130
|
function collectStaticTextContent(children) {
|
|
9104
9131
|
const parts = [];
|