@testid/antd-testid-runtime 1.0.14 → 1.0.15

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
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * 支持的浮层类型
12
12
  */
13
- type PopupType = 'modal' | 'drawer' | 'select' | 'datePicker' | 'popconfirm' | 'dropdown' | 'tooltip' | 'message';
13
+ type PopupType = 'modal' | 'drawer' | 'select' | 'datePicker' | 'popconfirm' | 'popover' | 'dropdown' | 'tooltip' | 'message';
14
14
  /**
15
15
  * UI 库适配器接口
16
16
  *
@@ -294,7 +294,7 @@ declare class TestIdObserver {
294
294
  private tagPrefixPattern;
295
295
  constructor();
296
296
  /**
297
- * 启动 MutationObserver
297
+ * 启动 MutationObserver (自动执行全量扫描兜底)
298
298
  */
299
299
  start(): void;
300
300
  /**
@@ -429,6 +429,7 @@ declare class TestIdObserver {
429
429
  * - onclick 属性
430
430
  * - role="button" / role="checkbox" / role="radio" / role="switch"
431
431
  * - tabindex 属性
432
+ * - CSS class 匹配 UI 库交互组件 (如 ant-menu-item → 渲染为 <li>,tag 不匹配组件名)
432
433
  */
433
434
  private isInteractive;
434
435
  /**
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * 支持的浮层类型
12
12
  */
13
- type PopupType = 'modal' | 'drawer' | 'select' | 'datePicker' | 'popconfirm' | 'dropdown' | 'tooltip' | 'message';
13
+ type PopupType = 'modal' | 'drawer' | 'select' | 'datePicker' | 'popconfirm' | 'popover' | 'dropdown' | 'tooltip' | 'message';
14
14
  /**
15
15
  * UI 库适配器接口
16
16
  *
@@ -294,7 +294,7 @@ declare class TestIdObserver {
294
294
  private tagPrefixPattern;
295
295
  constructor();
296
296
  /**
297
- * 启动 MutationObserver
297
+ * 启动 MutationObserver (自动执行全量扫描兜底)
298
298
  */
299
299
  start(): void;
300
300
  /**
@@ -429,6 +429,7 @@ declare class TestIdObserver {
429
429
  * - onclick 属性
430
430
  * - role="button" / role="checkbox" / role="radio" / role="switch"
431
431
  * - tabindex 属性
432
+ * - CSS class 匹配 UI 库交互组件 (如 ant-menu-item → 渲染为 <li>,tag 不匹配组件名)
432
433
  */
433
434
  private isInteractive;
434
435
  /**
package/dist/index.js CHANGED
@@ -70,6 +70,7 @@ var popupClassSuffixMap = {
70
70
  // Ant Design Vue 1.x
71
71
  ],
72
72
  popconfirm: [["-popover", "-popconfirm"]],
73
+ popover: [["-popover"]],
73
74
  dropdown: [["-dropdown"]],
74
75
  tooltip: [["-tooltip"]],
75
76
  message: [["-message"]]
@@ -115,6 +116,7 @@ var defaultConfig = {
115
116
  select: "select_",
116
117
  datePicker: "datePicker_",
117
118
  popconfirm: "popconfirm_",
119
+ popover: "popover_",
118
120
  dropdown: "dropdown_",
119
121
  tooltip: "tooltip_",
120
122
  message: "message_"
@@ -182,13 +184,9 @@ var popupClassSuffixMap2 = {
182
184
  ["-popconfirm"]
183
185
  // Element Popconfirm
184
186
  ],
187
+ popover: [["-popover"]],
185
188
  dropdown: [["-dropdown-menu"]],
186
- tooltip: [
187
- ["-tooltip__popper"],
188
- // Element Tooltip 浮层
189
- ["-popover"]
190
- // Element Popover 浮层 (语义上接近 tooltip)
191
- ],
189
+ tooltip: [["-tooltip__popper"]],
192
190
  message: [["-message"]]
193
191
  };
194
192
  var elementAdapter = {
@@ -259,6 +257,7 @@ var popupCounters = {
259
257
  select: 0,
260
258
  datePicker: 0,
261
259
  popconfirm: 0,
260
+ popover: 0,
262
261
  dropdown: 0,
263
262
  tooltip: 0,
264
263
  message: 0
@@ -365,7 +364,7 @@ var TestIdObserver = class {
365
364
  // 生命周期
366
365
  // ==========================================================
367
366
  /**
368
- * 启动 MutationObserver
367
+ * 启动 MutationObserver (自动执行全量扫描兜底)
369
368
  */
370
369
  start() {
371
370
  if (this.state.isRunning) return;
@@ -380,6 +379,7 @@ var TestIdObserver = class {
380
379
  // 监听所有后代节点
381
380
  });
382
381
  this.state.isRunning = true;
382
+ this.fullScan();
383
383
  }
384
384
  /**
385
385
  * 停止 Observer
@@ -675,6 +675,7 @@ var TestIdObserver = class {
675
675
  * - onclick 属性
676
676
  * - role="button" / role="checkbox" / role="radio" / role="switch"
677
677
  * - tabindex 属性
678
+ * - CSS class 匹配 UI 库交互组件 (如 ant-menu-item → 渲染为 <li>,tag 不匹配组件名)
678
679
  */
679
680
  isInteractive(node) {
680
681
  const tag = node.tagName.toLowerCase();
@@ -685,6 +686,15 @@ var TestIdObserver = class {
685
686
  return true;
686
687
  }
687
688
  if (node.hasAttribute("tabindex")) return true;
689
+ const classStr = node.className;
690
+ if (typeof classStr === "string") {
691
+ if (/\bant-(?:menu-item|dropdown-menu-item|select-item|tabs-tab|picker-cell|breadcrumb-link)\b/.test(classStr)) {
692
+ return true;
693
+ }
694
+ if (/\bel-(?:menu-item|dropdown-menu__item|select-dropdown__item|tabs__item)\b/.test(classStr)) {
695
+ return true;
696
+ }
697
+ }
688
698
  return false;
689
699
  }
690
700
  /**
@@ -713,6 +723,7 @@ var GROUP_LABELS = {
713
723
  select: "[Select \u6D6E\u5C42]",
714
724
  datePicker: "[DatePicker \u6D6E\u5C42]",
715
725
  popconfirm: "[Popconfirm \u6D6E\u5C42]",
726
+ popover: "[Popover \u6D6E\u5C42]",
716
727
  dropdown: "[Dropdown \u6D6E\u5C42]",
717
728
  tooltip: "[Tooltip \u6D6E\u5C42]",
718
729
  message: "[Message \u6D6E\u5C42]"
@@ -726,6 +737,7 @@ var GROUP_SUGGESTIONS = {
726
737
  select: "Select \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
727
738
  datePicker: "DatePicker \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
728
739
  popconfirm: "Popconfirm \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
740
+ popover: "Popover \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
729
741
  dropdown: "Dropdown \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
730
742
  tooltip: "Tooltip \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
731
743
  message: "Message \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548"
@@ -824,6 +836,7 @@ var TestIdChecker = class {
824
836
  "select",
825
837
  "datePicker",
826
838
  "popconfirm",
839
+ "popover",
827
840
  "dropdown",
828
841
  "tooltip",
829
842
  "message"
package/dist/index.mjs CHANGED
@@ -30,6 +30,7 @@ var popupClassSuffixMap = {
30
30
  // Ant Design Vue 1.x
31
31
  ],
32
32
  popconfirm: [["-popover", "-popconfirm"]],
33
+ popover: [["-popover"]],
33
34
  dropdown: [["-dropdown"]],
34
35
  tooltip: [["-tooltip"]],
35
36
  message: [["-message"]]
@@ -75,6 +76,7 @@ var defaultConfig = {
75
76
  select: "select_",
76
77
  datePicker: "datePicker_",
77
78
  popconfirm: "popconfirm_",
79
+ popover: "popover_",
78
80
  dropdown: "dropdown_",
79
81
  tooltip: "tooltip_",
80
82
  message: "message_"
@@ -142,13 +144,9 @@ var popupClassSuffixMap2 = {
142
144
  ["-popconfirm"]
143
145
  // Element Popconfirm
144
146
  ],
147
+ popover: [["-popover"]],
145
148
  dropdown: [["-dropdown-menu"]],
146
- tooltip: [
147
- ["-tooltip__popper"],
148
- // Element Tooltip 浮层
149
- ["-popover"]
150
- // Element Popover 浮层 (语义上接近 tooltip)
151
- ],
149
+ tooltip: [["-tooltip__popper"]],
152
150
  message: [["-message"]]
153
151
  };
154
152
  var elementAdapter = {
@@ -219,6 +217,7 @@ var popupCounters = {
219
217
  select: 0,
220
218
  datePicker: 0,
221
219
  popconfirm: 0,
220
+ popover: 0,
222
221
  dropdown: 0,
223
222
  tooltip: 0,
224
223
  message: 0
@@ -325,7 +324,7 @@ var TestIdObserver = class {
325
324
  // 生命周期
326
325
  // ==========================================================
327
326
  /**
328
- * 启动 MutationObserver
327
+ * 启动 MutationObserver (自动执行全量扫描兜底)
329
328
  */
330
329
  start() {
331
330
  if (this.state.isRunning) return;
@@ -340,6 +339,7 @@ var TestIdObserver = class {
340
339
  // 监听所有后代节点
341
340
  });
342
341
  this.state.isRunning = true;
342
+ this.fullScan();
343
343
  }
344
344
  /**
345
345
  * 停止 Observer
@@ -635,6 +635,7 @@ var TestIdObserver = class {
635
635
  * - onclick 属性
636
636
  * - role="button" / role="checkbox" / role="radio" / role="switch"
637
637
  * - tabindex 属性
638
+ * - CSS class 匹配 UI 库交互组件 (如 ant-menu-item → 渲染为 <li>,tag 不匹配组件名)
638
639
  */
639
640
  isInteractive(node) {
640
641
  const tag = node.tagName.toLowerCase();
@@ -645,6 +646,15 @@ var TestIdObserver = class {
645
646
  return true;
646
647
  }
647
648
  if (node.hasAttribute("tabindex")) return true;
649
+ const classStr = node.className;
650
+ if (typeof classStr === "string") {
651
+ if (/\bant-(?:menu-item|dropdown-menu-item|select-item|tabs-tab|picker-cell|breadcrumb-link)\b/.test(classStr)) {
652
+ return true;
653
+ }
654
+ if (/\bel-(?:menu-item|dropdown-menu__item|select-dropdown__item|tabs__item)\b/.test(classStr)) {
655
+ return true;
656
+ }
657
+ }
648
658
  return false;
649
659
  }
650
660
  /**
@@ -673,6 +683,7 @@ var GROUP_LABELS = {
673
683
  select: "[Select \u6D6E\u5C42]",
674
684
  datePicker: "[DatePicker \u6D6E\u5C42]",
675
685
  popconfirm: "[Popconfirm \u6D6E\u5C42]",
686
+ popover: "[Popover \u6D6E\u5C42]",
676
687
  dropdown: "[Dropdown \u6D6E\u5C42]",
677
688
  tooltip: "[Tooltip \u6D6E\u5C42]",
678
689
  message: "[Message \u6D6E\u5C42]"
@@ -686,6 +697,7 @@ var GROUP_SUGGESTIONS = {
686
697
  select: "Select \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
687
698
  datePicker: "DatePicker \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
688
699
  popconfirm: "Popconfirm \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
700
+ popover: "Popover \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
689
701
  dropdown: "Dropdown \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
690
702
  tooltip: "Tooltip \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548",
691
703
  message: "Message \u72EC\u7ACB\u8BA1\u6570\u5668\u81EA\u589E\u903B\u8F91\u5931\u6548"
@@ -784,6 +796,7 @@ var TestIdChecker = class {
784
796
  "select",
785
797
  "datePicker",
786
798
  "popconfirm",
799
+ "popover",
787
800
  "dropdown",
788
801
  "tooltip",
789
802
  "message"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testid/antd-testid-runtime",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "运行时兜底打标模块 — MutationObserver + 锚点计数器 + 浮层计数器 + ID 重复检测",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",