vite-plugin-vue-testid 1.0.11 → 1.0.12
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/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +26 -8
- package/package.json +1 -1
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,CAAA;CACzD;AAED,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,SAAS,EAAE,WAAW,CAAA;IACtB,iBAAiB;IACjB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,CAAA;CACzD;AAED,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,SAAS,EAAE,WAAW,CAAA;IACtB,iBAAiB;IACjB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;AAukB7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,cAAmB,GAAG,MAAM,IAAI,CAwFrE;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,wBAAkB,CAAA;AAMtD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,cAAmB,GAAG,IAAI,CAgCtE"}
|
package/dist/runtime.js
CHANGED
|
@@ -308,18 +308,29 @@ function getTriggerTestId(trigger, attrName) {
|
|
|
308
308
|
return trigger.getAttribute(attrName) || trigger.getAttribute("id") || "unknown";
|
|
309
309
|
}
|
|
310
310
|
function findActiveTrigger(attrName, pc) {
|
|
311
|
+
const resolveInContainer = (el) => {
|
|
312
|
+
if (el.hasAttribute(attrName)) return el;
|
|
313
|
+
const inner = el.querySelector(`[${attrName}]`);
|
|
314
|
+
if (inner) return inner;
|
|
315
|
+
return null;
|
|
316
|
+
};
|
|
311
317
|
const focused = document.querySelector(sel(pc, "picker-focused"));
|
|
312
318
|
if (focused) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (inner) return inner;
|
|
319
|
+
const found = resolveInContainer(focused);
|
|
320
|
+
if (found) return found;
|
|
316
321
|
const input = focused.querySelector("input[id]");
|
|
317
322
|
if (input) return input;
|
|
318
323
|
}
|
|
319
324
|
const selectOpen = document.querySelector(sel(pc, "select-open"));
|
|
320
|
-
if (selectOpen
|
|
325
|
+
if (selectOpen) {
|
|
326
|
+
const found = resolveInContainer(selectOpen);
|
|
327
|
+
if (found) return found;
|
|
328
|
+
}
|
|
321
329
|
const cascader = document.querySelector(sel(pc, "cascader-picker-focused"));
|
|
322
|
-
if (cascader
|
|
330
|
+
if (cascader) {
|
|
331
|
+
const found = resolveInContainer(cascader);
|
|
332
|
+
if (found) return found;
|
|
333
|
+
}
|
|
323
334
|
const expanded = document.querySelector(
|
|
324
335
|
`[${attrName}][aria-expanded="true"]`
|
|
325
336
|
);
|
|
@@ -402,9 +413,16 @@ function setupAntTestIds(opts = {}) {
|
|
|
402
413
|
if (container.hasAttribute(attrName)) continue;
|
|
403
414
|
if (strategy) {
|
|
404
415
|
queueMicrotask(() => {
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
const runPanelInjection = (retriesLeft) => {
|
|
417
|
+
const trigger = findActiveTrigger(attrName, pc);
|
|
418
|
+
const triggerTestId = getTriggerTestId(trigger, attrName);
|
|
419
|
+
if (triggerTestId === "unknown" && retriesLeft > 0) {
|
|
420
|
+
requestAnimationFrame(() => runPanelInjection(retriesLeft - 1));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
strategy({ container, trigger, triggerTestId, attrName });
|
|
424
|
+
};
|
|
425
|
+
runPanelInjection(3);
|
|
408
426
|
});
|
|
409
427
|
}
|
|
410
428
|
}
|