@immense/vue-pom-generator 1.0.81 → 1.0.83
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 +34 -24
- 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 +70 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +70 -41
- 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 +13 -0
- 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 +16 -0
- package/dist/plugin/runtime/annotator/plugin.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/text-utils.d.ts +15 -0
- package/dist/plugin/runtime/annotator/text-utils.d.ts.map +1 -0
- package/dist/plugin/runtime/annotator/vue-detector.d.ts +49 -0
- 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 +24 -8
- package/plugin/runtime/annotator/format.ts +7 -5
- package/plugin/runtime/annotator/plugin.ts +24 -2
- package/plugin/runtime/annotator/text-utils.ts +23 -0
- package/plugin/runtime/annotator/vue-detector.ts +70 -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,40 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Only PR #45 falls in the git range v1.0.82..HEAD (confirmed by git log), with no release-bump commit
|
|
2
|
+
to exclude. The long PR list spans prior releases; the 9-minute window and the diffstat both point
|
|
3
|
+
to #45 alone. Here are the release notes:
|
|
4
4
|
|
|
5
5
|
Highlights
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
- Pure refactor, no behavior changes — consolidates annotator display-text helpers and normalizes
|
|
8
|
+
the export surface.
|
|
9
|
+
- Extracts shared display-text normalization into a new annotator/text-utils.ts, eliminating two
|
|
10
|
+
duplicate inline copies.
|
|
11
|
+
- Exposes pure annotator string helpers via an __internal export to enable direct unit testing.
|
|
12
|
+
- Renames splitDiscoverabilityWords/joinDiscoverabilityWords to the shorter splitWords/joinWords
|
|
13
|
+
with @example TSDoc.
|
|
14
|
+
- Adds @example TSDoc to annotator helper functions for improved discoverability.
|
|
12
15
|
|
|
13
16
|
Changes
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
Annotator runtime (plugin/runtime/annotator/)
|
|
19
|
+
|
|
20
|
+
- Added text-utils.ts housing normalizeInlineText, now shared by client.ts and format.ts (replaces
|
|
21
|
+
duplicated inline copies).
|
|
22
|
+
- Added normalizePathSeparators to the annotator plugin.
|
|
23
|
+
- Exposed pure helpers — placementPrimarySide, stripSourcePosition, inferNameFromFile,
|
|
24
|
+
isComponentLikeSourceTag, formatSourceLabel, ignoredComponentNamePattern — via a __internal export
|
|
25
|
+
for unit tests.
|
|
26
|
+
- Added @example TSDoc to stripSourcePosition, inferNameFromFile, isComponentLikeSourceTag,
|
|
27
|
+
formatSourceLabel, and ignoredComponentNamePattern in vue-detector.ts.
|
|
28
|
+
|
|
29
|
+
POM discoverability (pom-discoverability.ts)
|
|
30
|
+
|
|
31
|
+
- Renamed splitDiscoverabilityWords → splitWords and joinDiscoverabilityWords → joinWords; updated
|
|
32
|
+
all internal call sites (humanizePomMethodName, humanizePomComponentName,
|
|
33
|
+
buildPomLocatorDescription).
|
|
34
|
+
- Added @example TSDoc to both renamed functions.
|
|
27
35
|
|
|
28
36
|
Breaking Changes
|
|
29
37
|
|
|
30
|
-
None.
|
|
38
|
+
None. This is a pure refactor with no behavior changes; renamed helpers were internal-only with no
|
|
39
|
+
external callers.
|
|
31
40
|
|
|
32
41
|
Pull Requests Included
|
|
33
42
|
|
|
34
|
-
- ]8;id=md-
|
|
43
|
+
- ]8;id=md-gu5yjh;https://github.com/immense/vue-pom-generator/pull/45#45 — refactor: consolidate annotator display-text helpers and normalize export surface]8;;]8;; ]8;;
|
|
44
|
+
(@dkattan)
|
|
35
45
|
|
|
36
46
|
Testing
|
|
37
47
|
|
|
38
|
-
No tests added
|
|
39
|
-
|
|
48
|
+
No new tests added. As a pure refactor preserving existing behavior, the unchanged functionality
|
|
49
|
+
remains covered by the existing test suite.
|
|
40
50
|
|
|
@@ -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":"","sources":["../../class-generation/base-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAW,KAAK,iBAAiB,EAA8B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAe9G;;;;;;;;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,SAAS,aAAa,GACvB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GACxC,CAAC,SAAS,kBAAkB,GAC5B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GACxC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,GAC7B,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnB,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GACvB,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,IAA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AAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInE;;;;OAIG;cACa,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIvE;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5F;;;OAGG;cACa,aAAa,CAAC,MAAM,EAAE,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
|
@@ -602,14 +602,14 @@ function uniquePomStringPatterns(primary, alternates) {
|
|
|
602
602
|
}
|
|
603
603
|
return out;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function splitWords(value) {
|
|
606
606
|
const normalized = value.replace(/ByKey/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[._-]+/g, " ").trim();
|
|
607
607
|
if (!normalized) {
|
|
608
608
|
return [];
|
|
609
609
|
}
|
|
610
610
|
return normalized.split(/\s+/).map((word) => word.toLowerCase()).filter(Boolean);
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function joinWords(words) {
|
|
613
613
|
return words.join(" ").replace(/\s+/g, " ").trim();
|
|
614
614
|
}
|
|
615
615
|
function toSentenceCase(value) {
|
|
@@ -641,7 +641,7 @@ function removeTrailingRoleWord(words, roleWord) {
|
|
|
641
641
|
return words.slice(0, -1);
|
|
642
642
|
}
|
|
643
643
|
function humanizePomMethodName(methodName) {
|
|
644
|
-
return
|
|
644
|
+
return joinWords(splitWords(methodName));
|
|
645
645
|
}
|
|
646
646
|
function stripPomActionPrefix(actionName) {
|
|
647
647
|
for (const prefix of ["click", "select", "type", "goTo"]) {
|
|
@@ -658,13 +658,13 @@ function normalizePomRoleLabel(nativeRole) {
|
|
|
658
658
|
return nativeRole || "element";
|
|
659
659
|
}
|
|
660
660
|
function buildPomLocatorDescription(args) {
|
|
661
|
-
const componentWords =
|
|
661
|
+
const componentWords = splitWords(args.componentName ? stripComponentKindSuffix(args.componentName) : "");
|
|
662
662
|
const roleWord = normalizePomRoleLabel(args.nativeRole).toLowerCase();
|
|
663
663
|
const semanticWords = removeLeadingWords(
|
|
664
|
-
removeTrailingRoleWord(
|
|
664
|
+
removeTrailingRoleWord(splitWords(args.methodName), roleWord),
|
|
665
665
|
componentWords
|
|
666
666
|
);
|
|
667
|
-
const phrase =
|
|
667
|
+
const phrase = joinWords([
|
|
668
668
|
...componentWords,
|
|
669
669
|
...semanticWords,
|
|
670
670
|
roleWord
|
|
@@ -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
|
}
|
|
@@ -8866,8 +8907,11 @@ const DEFAULT_ENTRY_SUFFIXES = [
|
|
|
8866
8907
|
"/src/main.tsx",
|
|
8867
8908
|
"/src/main.jsx"
|
|
8868
8909
|
];
|
|
8910
|
+
function normalizePathSeparators(filePath) {
|
|
8911
|
+
return filePath.replace(/\\/g, "/");
|
|
8912
|
+
}
|
|
8869
8913
|
function toFsImportPath(filePath) {
|
|
8870
|
-
return `/@fs/${filePath
|
|
8914
|
+
return `/@fs/${normalizePathSeparators(filePath)}`;
|
|
8871
8915
|
}
|
|
8872
8916
|
function resolveAnnotatorClientPath() {
|
|
8873
8917
|
const candidates = [
|
|
@@ -8912,7 +8956,7 @@ function createAnnotatorUiPlugin(options) {
|
|
|
8912
8956
|
if (!options.enabled) {
|
|
8913
8957
|
return null;
|
|
8914
8958
|
}
|
|
8915
|
-
const normalizedId = id
|
|
8959
|
+
const normalizedId = normalizePathSeparators(id);
|
|
8916
8960
|
if (!DEFAULT_ENTRY_SUFFIXES.some((suffix) => normalizedId.endsWith(suffix))) {
|
|
8917
8961
|
return null;
|
|
8918
8962
|
}
|
|
@@ -8960,23 +9004,9 @@ function createInternalPlugins(options) {
|
|
|
8960
9004
|
annotatorRuntime
|
|
8961
9005
|
} = options;
|
|
8962
9006
|
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
9007
|
routerAwarePoms,
|
|
8977
9008
|
routerEntry,
|
|
8978
|
-
routerType
|
|
8979
|
-
routerModuleShims
|
|
9009
|
+
routerType
|
|
8980
9010
|
} = generation;
|
|
8981
9011
|
const resolveRouterEntry2 = () => {
|
|
8982
9012
|
if (!routerAwarePoms)
|
|
@@ -9098,7 +9128,7 @@ function findStaticAttributeValue(element, attributeName) {
|
|
|
9098
9128
|
(prop) => prop.type === compilerCore.NodeTypes.ATTRIBUTE && prop.name === attributeName
|
|
9099
9129
|
);
|
|
9100
9130
|
const value = attribute?.value?.content?.trim();
|
|
9101
|
-
return value
|
|
9131
|
+
return value || void 0;
|
|
9102
9132
|
}
|
|
9103
9133
|
function collectStaticTextContent(children) {
|
|
9104
9134
|
const parts = [];
|
|
@@ -10472,10 +10502,6 @@ const SHORTCUT_LABELS = {
|
|
|
10472
10502
|
settings: ",",
|
|
10473
10503
|
cancel: "Esc"
|
|
10474
10504
|
};
|
|
10475
|
-
function normalizeText(value) {
|
|
10476
|
-
const normalized = value?.replace(/\s+/g, " ").trim();
|
|
10477
|
-
return normalized || void 0;
|
|
10478
|
-
}
|
|
10479
10505
|
function formatShortcutTitle(label, shortcut) {
|
|
10480
10506
|
return shortcut ? `${label} (${shortcut})` : label;
|
|
10481
10507
|
}
|
|
@@ -10516,11 +10542,11 @@ function getElementPath(element) {
|
|
|
10516
10542
|
return segments.join(" > ");
|
|
10517
10543
|
}
|
|
10518
10544
|
function getNearbyText(element) {
|
|
10519
|
-
const ownText =
|
|
10545
|
+
const ownText = normalizeInlineText(element.textContent || void 0);
|
|
10520
10546
|
if (ownText && ownText.length >= 2) {
|
|
10521
10547
|
return ownText.length > 160 ? `${ownText.slice(0, 160)}...` : ownText;
|
|
10522
10548
|
}
|
|
10523
|
-
const parentText =
|
|
10549
|
+
const parentText = normalizeInlineText(element.parentElement?.textContent || void 0);
|
|
10524
10550
|
if (parentText) {
|
|
10525
10551
|
return parentText.length > 160 ? `${parentText.slice(0, 160)}...` : parentText;
|
|
10526
10552
|
}
|
|
@@ -10543,6 +10569,9 @@ function createFloatingArrow() {
|
|
|
10543
10569
|
function toCssPixels(value) {
|
|
10544
10570
|
return `${Math.round(value)}px`;
|
|
10545
10571
|
}
|
|
10572
|
+
function placementPrimarySide(placement) {
|
|
10573
|
+
return placement.split("-")[0];
|
|
10574
|
+
}
|
|
10546
10575
|
function clamp(value, min, max) {
|
|
10547
10576
|
return Math.min(Math.max(value, min), max);
|
|
10548
10577
|
}
|
|
@@ -11031,7 +11060,7 @@ class AnnotatorRuntime {
|
|
|
11031
11060
|
panel.style.top = toCssPixels(result.y);
|
|
11032
11061
|
panel.style.visibility = "visible";
|
|
11033
11062
|
const arrowData = result.middlewareData.arrow;
|
|
11034
|
-
const side = result.placement
|
|
11063
|
+
const side = placementPrimarySide(result.placement);
|
|
11035
11064
|
const staticSide = side === "top" ? "bottom" : side === "bottom" ? "top" : side === "left" ? "right" : "left";
|
|
11036
11065
|
arrowEl.style.removeProperty("top");
|
|
11037
11066
|
arrowEl.style.removeProperty("right");
|