vite-plugin-vue-testid 1.0.6 → 1.0.7
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 +17 -12
- 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;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;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;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;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;AA+a7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,GAAE,cAAmB,GAAG,MAAM,IAAI,CAkF7E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,cAAmB,GAAG,IAAI,CA+CtE"}
|
package/dist/runtime.js
CHANGED
|
@@ -236,21 +236,26 @@ function injectMenuItems(attrName, root = document) {
|
|
|
236
236
|
{ selector: ".ant-menu-submenu", textSelector: ".ant-menu-submenu-title", prefix: "a-sub-menu-" },
|
|
237
237
|
{ selector: ".ant-menu-item-group", textSelector: ".ant-menu-item-group-title", prefix: "a-menu-item-group-" }
|
|
238
238
|
];
|
|
239
|
+
const injectSingle = (el, rule) => {
|
|
240
|
+
if (el.hasAttribute(attrName)) return;
|
|
241
|
+
const id = el.getAttribute("id");
|
|
242
|
+
if (id) {
|
|
243
|
+
el.setAttribute(attrName, id);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const textTarget = rule.textSelector ? el.querySelector(rule.textSelector) : el;
|
|
247
|
+
const text = (textTarget?.textContent || "").trim().replace(/\s+/g, "-");
|
|
248
|
+
if (text) {
|
|
249
|
+
el.setAttribute(attrName, rule.prefix + text);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
239
252
|
for (const rule of itemRules) {
|
|
253
|
+
if (root instanceof HTMLElement && root.matches(rule.selector)) {
|
|
254
|
+
injectSingle(root, rule);
|
|
255
|
+
}
|
|
240
256
|
const items = root.querySelectorAll(rule.selector);
|
|
241
257
|
items.forEach((item) => {
|
|
242
|
-
|
|
243
|
-
if (el.hasAttribute(attrName)) return;
|
|
244
|
-
const id = el.getAttribute("id");
|
|
245
|
-
if (id) {
|
|
246
|
-
el.setAttribute(attrName, id);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const textTarget = rule.textSelector ? el.querySelector(rule.textSelector) : el;
|
|
250
|
-
const text = (textTarget?.textContent || "").trim().replace(/\s+/g, "-");
|
|
251
|
-
if (text) {
|
|
252
|
-
el.setAttribute(attrName, rule.prefix + text);
|
|
253
|
-
}
|
|
258
|
+
injectSingle(item, rule);
|
|
254
259
|
});
|
|
255
260
|
}
|
|
256
261
|
}
|