@testid/antd-testid-runtime 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/index.d.mts CHANGED
@@ -400,8 +400,8 @@ declare class TestIdObserver {
400
400
  /**
401
401
  * 处理浮层内部子节点 (Modal/Drawer/Dropdown 内的按钮、输入框等)
402
402
  *
403
- * 每个浮层实例独立计数: 以浮层根节点 data-testid 作为隔离 key
404
- * 重复打开相同类型的浮层,子元素 ID 均从 0 重新开始。
403
+ * 同类型浮层的子节点共享全局计数器 (key: popupType_tag)
404
+ * 确保页面上多个同类下拉选择框的下拉选项 testid 全局唯一。
405
405
  *
406
406
  * ID 格式: ${runtimePagePrefix}${popupPrefix}${tag}_${counter}
407
407
  * 例: hall_dynamic_modal_button_0, hall_dynamic_select_div_2
package/dist/index.d.ts CHANGED
@@ -400,8 +400,8 @@ declare class TestIdObserver {
400
400
  /**
401
401
  * 处理浮层内部子节点 (Modal/Drawer/Dropdown 内的按钮、输入框等)
402
402
  *
403
- * 每个浮层实例独立计数: 以浮层根节点 data-testid 作为隔离 key
404
- * 重复打开相同类型的浮层,子元素 ID 均从 0 重新开始。
403
+ * 同类型浮层的子节点共享全局计数器 (key: popupType_tag)
404
+ * 确保页面上多个同类下拉选择框的下拉选项 testid 全局唯一。
405
405
  *
406
406
  * ID 格式: ${runtimePagePrefix}${popupPrefix}${tag}_${counter}
407
407
  * 例: hall_dynamic_modal_button_0, hall_dynamic_select_div_2
package/dist/index.js CHANGED
@@ -428,7 +428,7 @@ var TestIdObserver = class {
428
428
  }
429
429
  const popupAncestor = this.detectPopupAncestor(node);
430
430
  if (popupAncestor) {
431
- this.handlePopupChildNode(node, popupAncestor.type, popupAncestor.element, config);
431
+ this.handlePopupChildNode(node, popupAncestor.type, config);
432
432
  return;
433
433
  }
434
434
  const popupType = this.detectPopupType(node);
@@ -595,19 +595,18 @@ var TestIdObserver = class {
595
595
  /**
596
596
  * 处理浮层内部子节点 (Modal/Drawer/Dropdown 内的按钮、输入框等)
597
597
  *
598
- * 每个浮层实例独立计数: 以浮层根节点 data-testid 作为隔离 key
599
- * 重复打开相同类型的浮层,子元素 ID 均从 0 重新开始。
598
+ * 同类型浮层的子节点共享全局计数器 (key: popupType_tag)
599
+ * 确保页面上多个同类下拉选择框的下拉选项 testid 全局唯一。
600
600
  *
601
601
  * ID 格式: ${runtimePagePrefix}${popupPrefix}${tag}_${counter}
602
602
  * 例: hall_dynamic_modal_button_0, hall_dynamic_select_div_2
603
603
  *
604
604
  * 浮层子元素均为运行时注入,统一使用 runtimePagePrefix 前缀。
605
605
  */
606
- handlePopupChildNode(node, popupType, popupElement, config) {
606
+ handlePopupChildNode(node, popupType, config) {
607
607
  if (config.onlyInteractive && !this.isInteractive(node)) return;
608
608
  const tag = this.getSimpleTag(node);
609
- const popupRootTestId = popupElement.getAttribute("data-testid") || `${popupType}_unknown`;
610
- const key = `${popupRootTestId}_${tag}`;
609
+ const key = `${popupType}_${tag}`;
611
610
  const current = this.state.popupChildCounter.get(key) ?? 0;
612
611
  this.state.popupChildCounter.set(key, current + 1);
613
612
  const popupPrefix = config.popupPrefixMap[popupType] || `${popupType}_`;
package/dist/index.mjs CHANGED
@@ -385,7 +385,7 @@ var TestIdObserver = class {
385
385
  }
386
386
  const popupAncestor = this.detectPopupAncestor(node);
387
387
  if (popupAncestor) {
388
- this.handlePopupChildNode(node, popupAncestor.type, popupAncestor.element, config);
388
+ this.handlePopupChildNode(node, popupAncestor.type, config);
389
389
  return;
390
390
  }
391
391
  const popupType = this.detectPopupType(node);
@@ -552,19 +552,18 @@ var TestIdObserver = class {
552
552
  /**
553
553
  * 处理浮层内部子节点 (Modal/Drawer/Dropdown 内的按钮、输入框等)
554
554
  *
555
- * 每个浮层实例独立计数: 以浮层根节点 data-testid 作为隔离 key
556
- * 重复打开相同类型的浮层,子元素 ID 均从 0 重新开始。
555
+ * 同类型浮层的子节点共享全局计数器 (key: popupType_tag)
556
+ * 确保页面上多个同类下拉选择框的下拉选项 testid 全局唯一。
557
557
  *
558
558
  * ID 格式: ${runtimePagePrefix}${popupPrefix}${tag}_${counter}
559
559
  * 例: hall_dynamic_modal_button_0, hall_dynamic_select_div_2
560
560
  *
561
561
  * 浮层子元素均为运行时注入,统一使用 runtimePagePrefix 前缀。
562
562
  */
563
- handlePopupChildNode(node, popupType, popupElement, config) {
563
+ handlePopupChildNode(node, popupType, config) {
564
564
  if (config.onlyInteractive && !this.isInteractive(node)) return;
565
565
  const tag = this.getSimpleTag(node);
566
- const popupRootTestId = popupElement.getAttribute("data-testid") || `${popupType}_unknown`;
567
- const key = `${popupRootTestId}_${tag}`;
566
+ const key = `${popupType}_${tag}`;
568
567
  const current = this.state.popupChildCounter.get(key) ?? 0;
569
568
  this.state.popupChildCounter.set(key, current + 1);
570
569
  const popupPrefix = config.popupPrefixMap[popupType] || `${popupType}_`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testid/antd-testid-runtime",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "运行时兜底打标模块 — MutationObserver + 锚点计数器 + 浮层计数器 + ID 重复检测",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",