@yh-ui/components 0.1.21 → 0.1.23

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.
Files changed (485) hide show
  1. package/README.md +2 -0
  2. package/dist/breadcrumb/src/breadcrumb-item.vue +10 -6
  3. package/dist/form/index.cjs +1 -1
  4. package/dist/form/index.d.ts +1 -1
  5. package/dist/form/index.mjs +1 -1
  6. package/dist/icon/index.cjs +1 -1
  7. package/dist/icon/index.d.ts +1 -1
  8. package/dist/icon/index.mjs +1 -1
  9. package/dist/loading/index.cjs +1 -1
  10. package/dist/loading/index.d.ts +1 -1
  11. package/dist/loading/index.mjs +1 -1
  12. package/dist/message/src/method.cjs +1 -1
  13. package/dist/message/src/method.d.ts +1 -1
  14. package/dist/message/src/method.mjs +1 -1
  15. package/dist/message-box/index.cjs +1 -1
  16. package/dist/message-box/index.d.ts +1 -1
  17. package/dist/message-box/index.mjs +1 -1
  18. package/dist/notification/src/method.cjs +1 -1
  19. package/dist/notification/src/method.d.ts +1 -1
  20. package/dist/notification/src/method.mjs +1 -1
  21. package/dist/resolver.cjs +1 -1
  22. package/dist/resolver.d.ts +7 -5
  23. package/dist/resolver.mjs +1 -1
  24. package/dist/style.css +584 -0
  25. package/package.json +9 -8
  26. package/dist/affix/__tests__/affix.bottom.test.cjs +0 -101
  27. package/dist/affix/__tests__/affix.bottom.test.mjs +0 -88
  28. package/dist/affix/__tests__/affix.ssr.test.cjs +0 -38
  29. package/dist/affix/__tests__/affix.ssr.test.mjs +0 -51
  30. package/dist/affix/__tests__/affix.test.cjs +0 -185
  31. package/dist/affix/__tests__/affix.test.mjs +0 -180
  32. package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.cjs +0 -55
  33. package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.mjs +0 -39
  34. package/dist/ai-action-group/__tests__/ai-action-group.test.cjs +0 -235
  35. package/dist/ai-action-group/__tests__/ai-action-group.test.mjs +0 -157
  36. package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.cjs +0 -61
  37. package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.mjs +0 -65
  38. package/dist/ai-agent-card/__tests__/ai-agent-card.test.cjs +0 -205
  39. package/dist/ai-agent-card/__tests__/ai-agent-card.test.mjs +0 -133
  40. package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.cjs +0 -73
  41. package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.mjs +0 -68
  42. package/dist/ai-artifacts/__tests__/ai-artifacts.test.cjs +0 -128
  43. package/dist/ai-artifacts/__tests__/ai-artifacts.test.mjs +0 -109
  44. package/dist/ai-attachments/__tests__/ai-attachments.ssr.test.cjs +0 -50
  45. package/dist/ai-attachments/__tests__/ai-attachments.ssr.test.mjs +0 -33
  46. package/dist/ai-attachments/__tests__/ai-attachments.test.cjs +0 -113
  47. package/dist/ai-attachments/__tests__/ai-attachments.test.mjs +0 -81
  48. package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.cjs +0 -95
  49. package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.mjs +0 -66
  50. package/dist/ai-bubble/__tests__/ai-bubble.test.cjs +0 -624
  51. package/dist/ai-bubble/__tests__/ai-bubble.test.mjs +0 -393
  52. package/dist/ai-bubble-list/__tests__/ai-bubble-list.ssr.test.cjs +0 -51
  53. package/dist/ai-bubble-list/__tests__/ai-bubble-list.ssr.test.mjs +0 -51
  54. package/dist/ai-bubble-list/__tests__/ai-bubble-list.test.cjs +0 -138
  55. package/dist/ai-bubble-list/__tests__/ai-bubble-list.test.mjs +0 -112
  56. package/dist/ai-chat/__tests__/ai-chat.ssr.test.cjs +0 -90
  57. package/dist/ai-chat/__tests__/ai-chat.ssr.test.mjs +0 -77
  58. package/dist/ai-chat/__tests__/ai-chat.test.cjs +0 -177
  59. package/dist/ai-chat/__tests__/ai-chat.test.mjs +0 -129
  60. package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.cjs +0 -75
  61. package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.mjs +0 -57
  62. package/dist/ai-code-block/__tests__/ai-code-block.test.cjs +0 -174
  63. package/dist/ai-code-block/__tests__/ai-code-block.test.mjs +0 -108
  64. package/dist/ai-code-editor/__tests__/ai-code-editor.ssr.test.cjs +0 -46
  65. package/dist/ai-code-editor/__tests__/ai-code-editor.ssr.test.mjs +0 -39
  66. package/dist/ai-code-editor/__tests__/ai-code-editor.test.cjs +0 -90
  67. package/dist/ai-code-editor/__tests__/ai-code-editor.test.mjs +0 -78
  68. package/dist/ai-code-runner/__tests__/ai-code-runner.ssr.test.cjs +0 -28
  69. package/dist/ai-code-runner/__tests__/ai-code-runner.ssr.test.mjs +0 -26
  70. package/dist/ai-code-runner/__tests__/ai-code-runner.test.cjs +0 -69
  71. package/dist/ai-code-runner/__tests__/ai-code-runner.test.mjs +0 -66
  72. package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.cjs +0 -50
  73. package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.mjs +0 -42
  74. package/dist/ai-conversations/__tests__/ai-conversations.test.cjs +0 -67
  75. package/dist/ai-conversations/__tests__/ai-conversations.test.mjs +0 -51
  76. package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.cjs +0 -62
  77. package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.mjs +0 -50
  78. package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.cjs +0 -315
  79. package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.mjs +0 -226
  80. package/dist/ai-file-card/__tests__/ai-file-card.ssr.test.cjs +0 -45
  81. package/dist/ai-file-card/__tests__/ai-file-card.ssr.test.mjs +0 -29
  82. package/dist/ai-file-card/__tests__/ai-file-card.test.cjs +0 -160
  83. package/dist/ai-file-card/__tests__/ai-file-card.test.mjs +0 -109
  84. package/dist/ai-mention/__tests__/ai-mention.ssr.test.cjs +0 -38
  85. package/dist/ai-mention/__tests__/ai-mention.ssr.test.mjs +0 -37
  86. package/dist/ai-mention/__tests__/ai-mention.test.cjs +0 -113
  87. package/dist/ai-mention/__tests__/ai-mention.test.mjs +0 -84
  88. package/dist/ai-mermaid/__tests__/ai-mermaid.ssr.test.cjs +0 -43
  89. package/dist/ai-mermaid/__tests__/ai-mermaid.ssr.test.mjs +0 -33
  90. package/dist/ai-mermaid/__tests__/ai-mermaid.test.cjs +0 -113
  91. package/dist/ai-mermaid/__tests__/ai-mermaid.test.mjs +0 -92
  92. package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.cjs +0 -49
  93. package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.mjs +0 -41
  94. package/dist/ai-prompts/__tests__/ai-prompts.test.cjs +0 -54
  95. package/dist/ai-prompts/__tests__/ai-prompts.test.mjs +0 -38
  96. package/dist/ai-provider/__tests__/ai-provider.ssr.test.cjs +0 -33
  97. package/dist/ai-provider/__tests__/ai-provider.ssr.test.mjs +0 -34
  98. package/dist/ai-provider/__tests__/ai-provider.test.cjs +0 -38
  99. package/dist/ai-provider/__tests__/ai-provider.test.mjs +0 -33
  100. package/dist/ai-sender/__tests__/ai-sender.ssr.test.cjs +0 -46
  101. package/dist/ai-sender/__tests__/ai-sender.ssr.test.mjs +0 -37
  102. package/dist/ai-sender/__tests__/ai-sender.test.cjs +0 -511
  103. package/dist/ai-sender/__tests__/ai-sender.test.mjs +0 -322
  104. package/dist/ai-sources/__tests__/ai-sources.ssr.test.cjs +0 -72
  105. package/dist/ai-sources/__tests__/ai-sources.ssr.test.mjs +0 -82
  106. package/dist/ai-sources/__tests__/ai-sources.test.cjs +0 -200
  107. package/dist/ai-sources/__tests__/ai-sources.test.mjs +0 -160
  108. package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.cjs +0 -56
  109. package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.mjs +0 -42
  110. package/dist/ai-thinking/__tests__/ai-thinking.test.cjs +0 -151
  111. package/dist/ai-thinking/__tests__/ai-thinking.test.mjs +0 -96
  112. package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.cjs +0 -88
  113. package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.mjs +0 -55
  114. package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.cjs +0 -344
  115. package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.mjs +0 -237
  116. package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.cjs +0 -32
  117. package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.mjs +0 -25
  118. package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.cjs +0 -130
  119. package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.mjs +0 -103
  120. package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.cjs +0 -57
  121. package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.mjs +0 -39
  122. package/dist/ai-welcome/__tests__/ai-welcome.test.cjs +0 -169
  123. package/dist/ai-welcome/__tests__/ai-welcome.test.mjs +0 -113
  124. package/dist/alert/__tests__/alert.ssr.test.cjs +0 -28
  125. package/dist/alert/__tests__/alert.ssr.test.mjs +0 -29
  126. package/dist/alert/__tests__/alert.test.cjs +0 -123
  127. package/dist/alert/__tests__/alert.test.mjs +0 -110
  128. package/dist/autocomplete/__tests__/autocomplete.ssr.test.cjs +0 -54
  129. package/dist/autocomplete/__tests__/autocomplete.ssr.test.mjs +0 -47
  130. package/dist/autocomplete/__tests__/autocomplete.test.cjs +0 -299
  131. package/dist/autocomplete/__tests__/autocomplete.test.mjs +0 -263
  132. package/dist/avatar/__tests__/avatar.ssr.test.cjs +0 -103
  133. package/dist/avatar/__tests__/avatar.ssr.test.mjs +0 -108
  134. package/dist/avatar/__tests__/avatar.test.cjs +0 -146
  135. package/dist/avatar/__tests__/avatar.test.mjs +0 -125
  136. package/dist/back-top/__tests__/back-top.ssr.test.cjs +0 -13
  137. package/dist/back-top/__tests__/back-top.ssr.test.mjs +0 -10
  138. package/dist/back-top/__tests__/back-top.test.cjs +0 -88
  139. package/dist/back-top/__tests__/back-top.test.mjs +0 -76
  140. package/dist/badge/__tests__/badge.ssr.test.cjs +0 -36
  141. package/dist/badge/__tests__/badge.ssr.test.mjs +0 -33
  142. package/dist/badge/__tests__/badge.test.cjs +0 -115
  143. package/dist/badge/__tests__/badge.test.mjs +0 -112
  144. package/dist/breadcrumb/__tests__/breadcrumb.ssr.test.cjs +0 -22
  145. package/dist/breadcrumb/__tests__/breadcrumb.ssr.test.mjs +0 -20
  146. package/dist/breadcrumb/__tests__/breadcrumb.test.cjs +0 -64
  147. package/dist/breadcrumb/__tests__/breadcrumb.test.mjs +0 -51
  148. package/dist/button/__tests__/button.ssr.test.cjs +0 -52
  149. package/dist/button/__tests__/button.ssr.test.mjs +0 -55
  150. package/dist/button/__tests__/button.test.cjs +0 -207
  151. package/dist/button/__tests__/button.test.mjs +0 -141
  152. package/dist/calendar/__tests__/calendar.ssr.test.cjs +0 -65
  153. package/dist/calendar/__tests__/calendar.ssr.test.mjs +0 -63
  154. package/dist/calendar/__tests__/calendar.test.cjs +0 -263
  155. package/dist/calendar/__tests__/calendar.test.mjs +0 -255
  156. package/dist/card/__tests__/card.ssr.test.cjs +0 -37
  157. package/dist/card/__tests__/card.ssr.test.mjs +0 -40
  158. package/dist/card/__tests__/card.test.cjs +0 -131
  159. package/dist/card/__tests__/card.test.mjs +0 -124
  160. package/dist/carousel/__tests__/carousel.ssr.test.cjs +0 -27
  161. package/dist/carousel/__tests__/carousel.ssr.test.mjs +0 -27
  162. package/dist/carousel/__tests__/carousel.test.cjs +0 -115
  163. package/dist/carousel/__tests__/carousel.test.mjs +0 -98
  164. package/dist/cascader/__tests__/cascader-panel.test.cjs +0 -162
  165. package/dist/cascader/__tests__/cascader-panel.test.mjs +0 -151
  166. package/dist/cascader/__tests__/cascader.ssr.test.cjs +0 -61
  167. package/dist/cascader/__tests__/cascader.ssr.test.mjs +0 -55
  168. package/dist/cascader/__tests__/cascader.test.cjs +0 -342
  169. package/dist/cascader/__tests__/cascader.test.mjs +0 -316
  170. package/dist/category-nav/__tests__/category-nav.ssr.test.cjs +0 -35
  171. package/dist/category-nav/__tests__/category-nav.ssr.test.mjs +0 -21
  172. package/dist/category-nav/__tests__/category-nav.test.cjs +0 -53
  173. package/dist/category-nav/__tests__/category-nav.test.mjs +0 -33
  174. package/dist/checkbox/__tests__/checkbox.ssr.test.cjs +0 -52
  175. package/dist/checkbox/__tests__/checkbox.ssr.test.mjs +0 -57
  176. package/dist/checkbox/__tests__/checkbox.test.cjs +0 -173
  177. package/dist/checkbox/__tests__/checkbox.test.mjs +0 -133
  178. package/dist/col/__tests__/col.ssr.test.cjs +0 -44
  179. package/dist/col/__tests__/col.ssr.test.mjs +0 -42
  180. package/dist/col/__tests__/col.test.cjs +0 -128
  181. package/dist/col/__tests__/col.test.mjs +0 -116
  182. package/dist/color-picker/__tests__/color-picker.ssr.test.cjs +0 -34
  183. package/dist/color-picker/__tests__/color-picker.ssr.test.mjs +0 -39
  184. package/dist/color-picker/__tests__/color-picker.test.cjs +0 -227
  185. package/dist/color-picker/__tests__/color-picker.test.mjs +0 -176
  186. package/dist/config-provider/__tests__/config-provider.ssr.test.cjs +0 -43
  187. package/dist/config-provider/__tests__/config-provider.ssr.test.mjs +0 -42
  188. package/dist/config-provider/__tests__/config-provider.test.cjs +0 -75
  189. package/dist/config-provider/__tests__/config-provider.test.mjs +0 -64
  190. package/dist/container/__tests__/container.ssr.test.cjs +0 -71
  191. package/dist/container/__tests__/container.ssr.test.mjs +0 -50
  192. package/dist/container/__tests__/container.test.cjs +0 -111
  193. package/dist/container/__tests__/container.test.mjs +0 -84
  194. package/dist/countdown/__tests__/countdown.ssr.test.cjs +0 -86
  195. package/dist/countdown/__tests__/countdown.ssr.test.mjs +0 -78
  196. package/dist/countdown/__tests__/countdown.test.cjs +0 -767
  197. package/dist/countdown/__tests__/countdown.test.mjs +0 -722
  198. package/dist/coupon-card/__tests__/coupon-card.ssr.test.cjs +0 -21
  199. package/dist/coupon-card/__tests__/coupon-card.ssr.test.mjs +0 -18
  200. package/dist/coupon-card/__tests__/coupon-card.test.cjs +0 -67
  201. package/dist/coupon-card/__tests__/coupon-card.test.mjs +0 -64
  202. package/dist/date-picker/__tests__/date-picker-extended.test.cjs +0 -581
  203. package/dist/date-picker/__tests__/date-picker-extended.test.mjs +0 -455
  204. package/dist/date-picker/__tests__/date-picker.ssr.test.cjs +0 -26
  205. package/dist/date-picker/__tests__/date-picker.ssr.test.mjs +0 -23
  206. package/dist/date-picker/__tests__/date-picker.test.cjs +0 -170
  207. package/dist/date-picker/__tests__/date-picker.test.mjs +0 -136
  208. package/dist/descriptions/__tests__/descriptions.ssr.test.cjs +0 -67
  209. package/dist/descriptions/__tests__/descriptions.ssr.test.mjs +0 -72
  210. package/dist/descriptions/__tests__/descriptions.test.cjs +0 -150
  211. package/dist/descriptions/__tests__/descriptions.test.mjs +0 -130
  212. package/dist/dialog/__tests__/dialog.functional.test.cjs +0 -49
  213. package/dist/dialog/__tests__/dialog.functional.test.mjs +0 -49
  214. package/dist/dialog/__tests__/dialog.ssr.test.cjs +0 -31
  215. package/dist/dialog/__tests__/dialog.ssr.test.mjs +0 -29
  216. package/dist/dialog/__tests__/dialog.test.cjs +0 -561
  217. package/dist/dialog/__tests__/dialog.test.mjs +0 -388
  218. package/dist/divider/__tests__/divider.ssr.test.cjs +0 -41
  219. package/dist/divider/__tests__/divider.ssr.test.mjs +0 -44
  220. package/dist/divider/__tests__/divider.test.cjs +0 -71
  221. package/dist/divider/__tests__/divider.test.mjs +0 -68
  222. package/dist/drawer/__tests__/drawer.ssr.test.cjs +0 -25
  223. package/dist/drawer/__tests__/drawer.ssr.test.mjs +0 -23
  224. package/dist/drawer/__tests__/drawer.test.cjs +0 -145
  225. package/dist/drawer/__tests__/drawer.test.mjs +0 -122
  226. package/dist/dropdown/__tests__/dropdown.ssr.test.cjs +0 -49
  227. package/dist/dropdown/__tests__/dropdown.ssr.test.mjs +0 -64
  228. package/dist/dropdown/__tests__/dropdown.test.cjs +0 -310
  229. package/dist/dropdown/__tests__/dropdown.test.mjs +0 -269
  230. package/dist/empty/__tests__/empty.ssr.test.cjs +0 -96
  231. package/dist/empty/__tests__/empty.ssr.test.mjs +0 -99
  232. package/dist/empty/__tests__/empty.test.cjs +0 -110
  233. package/dist/empty/__tests__/empty.test.mjs +0 -101
  234. package/dist/filter-bar/__tests__/filter-bar.ssr.test.cjs +0 -29
  235. package/dist/filter-bar/__tests__/filter-bar.ssr.test.mjs +0 -16
  236. package/dist/filter-bar/__tests__/filter-bar.test.cjs +0 -51
  237. package/dist/filter-bar/__tests__/filter-bar.test.mjs +0 -29
  238. package/dist/form/__tests__/form-schema.test.cjs +0 -636
  239. package/dist/form/__tests__/form-schema.test.mjs +0 -366
  240. package/dist/form/__tests__/form.ssr.test.cjs +0 -74
  241. package/dist/form/__tests__/form.ssr.test.mjs +0 -73
  242. package/dist/form/__tests__/form.test.cjs +0 -208
  243. package/dist/form/__tests__/form.test.mjs +0 -128
  244. package/dist/gantt-chart/__tests__/debug_ssr.test.cjs +0 -51
  245. package/dist/gantt-chart/__tests__/debug_ssr.test.mjs +0 -37
  246. package/dist/gantt-chart/__tests__/gantt-chart.ssr.test.cjs +0 -95
  247. package/dist/gantt-chart/__tests__/gantt-chart.ssr.test.mjs +0 -94
  248. package/dist/gantt-chart/__tests__/gantt-chart.test.cjs +0 -86
  249. package/dist/gantt-chart/__tests__/gantt-chart.test.mjs +0 -79
  250. package/dist/grid/__tests__/grid.ssr.test.cjs +0 -81
  251. package/dist/grid/__tests__/grid.ssr.test.mjs +0 -63
  252. package/dist/grid/__tests__/grid.test.cjs +0 -142
  253. package/dist/grid/__tests__/grid.test.mjs +0 -89
  254. package/dist/icon/__tests__/icon.ssr.test.cjs +0 -35
  255. package/dist/icon/__tests__/icon.ssr.test.mjs +0 -26
  256. package/dist/icon/__tests__/icon.test.cjs +0 -144
  257. package/dist/icon/__tests__/icon.test.mjs +0 -123
  258. package/dist/image/__tests__/image-viewer.test.cjs +0 -101
  259. package/dist/image/__tests__/image-viewer.test.mjs +0 -94
  260. package/dist/image/__tests__/image.ssr.test.cjs +0 -73
  261. package/dist/image/__tests__/image.ssr.test.mjs +0 -72
  262. package/dist/image/__tests__/image.test.cjs +0 -171
  263. package/dist/image/__tests__/image.test.mjs +0 -159
  264. package/dist/image-magnifier/__tests__/image-magnifier.ssr.test.cjs +0 -54
  265. package/dist/image-magnifier/__tests__/image-magnifier.ssr.test.mjs +0 -35
  266. package/dist/image-magnifier/__tests__/image-magnifier.test.cjs +0 -257
  267. package/dist/image-magnifier/__tests__/image-magnifier.test.mjs +0 -177
  268. package/dist/infinite-scroll/__tests__/infinite-scroll.ssr.test.cjs +0 -59
  269. package/dist/infinite-scroll/__tests__/infinite-scroll.ssr.test.mjs +0 -84
  270. package/dist/infinite-scroll/__tests__/infinite-scroll.test.cjs +0 -255
  271. package/dist/infinite-scroll/__tests__/infinite-scroll.test.mjs +0 -187
  272. package/dist/input/__tests__/input-utils.test.cjs +0 -77
  273. package/dist/input/__tests__/input-utils.test.mjs +0 -75
  274. package/dist/input/__tests__/input.ssr.test.cjs +0 -100
  275. package/dist/input/__tests__/input.ssr.test.mjs +0 -85
  276. package/dist/input/__tests__/input.test.cjs +0 -127
  277. package/dist/input/__tests__/input.test.mjs +0 -112
  278. package/dist/input-number/__tests__/input-number.hydration.test.cjs +0 -24
  279. package/dist/input-number/__tests__/input-number.hydration.test.mjs +0 -21
  280. package/dist/input-number/__tests__/input-number.ssr.test.cjs +0 -95
  281. package/dist/input-number/__tests__/input-number.ssr.test.mjs +0 -92
  282. package/dist/input-number/__tests__/input-number.test.cjs +0 -199
  283. package/dist/input-number/__tests__/input-number.test.mjs +0 -173
  284. package/dist/input-tag/__tests__/input-tag.ssr.test.cjs +0 -47
  285. package/dist/input-tag/__tests__/input-tag.ssr.test.mjs +0 -41
  286. package/dist/input-tag/__tests__/input-tag.test.cjs +0 -268
  287. package/dist/input-tag/__tests__/input-tag.test.mjs +0 -201
  288. package/dist/loading/__tests__/loading.ssr.test.cjs +0 -37
  289. package/dist/loading/__tests__/loading.ssr.test.mjs +0 -27
  290. package/dist/loading/__tests__/loading.test.cjs +0 -91
  291. package/dist/loading/__tests__/loading.test.mjs +0 -75
  292. package/dist/lucky-draw/__tests__/lucky-draw.ssr.test.cjs +0 -33
  293. package/dist/lucky-draw/__tests__/lucky-draw.ssr.test.mjs +0 -31
  294. package/dist/lucky-draw/__tests__/lucky-draw.test.cjs +0 -56
  295. package/dist/lucky-draw/__tests__/lucky-draw.test.mjs +0 -48
  296. package/dist/marquee/__tests__/marquee.ssr.test.cjs +0 -59
  297. package/dist/marquee/__tests__/marquee.ssr.test.mjs +0 -60
  298. package/dist/marquee/__tests__/marquee.test.cjs +0 -94
  299. package/dist/marquee/__tests__/marquee.test.mjs +0 -92
  300. package/dist/mention/__tests__/mention.ssr.test.cjs +0 -92
  301. package/dist/mention/__tests__/mention.ssr.test.mjs +0 -70
  302. package/dist/mention/__tests__/mention.test.cjs +0 -650
  303. package/dist/mention/__tests__/mention.test.mjs +0 -523
  304. package/dist/menu/__tests__/menu.ssr.test.cjs +0 -92
  305. package/dist/menu/__tests__/menu.ssr.test.mjs +0 -124
  306. package/dist/menu/__tests__/menu.test.cjs +0 -209
  307. package/dist/menu/__tests__/menu.test.mjs +0 -182
  308. package/dist/message/__tests__/message.ssr.test.cjs +0 -29
  309. package/dist/message/__tests__/message.ssr.test.mjs +0 -23
  310. package/dist/message/__tests__/message.test.cjs +0 -170
  311. package/dist/message/__tests__/message.test.mjs +0 -154
  312. package/dist/message-box/__tests__/message-box.ssr.test.cjs +0 -33
  313. package/dist/message-box/__tests__/message-box.ssr.test.mjs +0 -30
  314. package/dist/message-box/__tests__/message-box.test.cjs +0 -100
  315. package/dist/message-box/__tests__/message-box.test.mjs +0 -95
  316. package/dist/notification/__tests__/notification.ssr.test.cjs +0 -31
  317. package/dist/notification/__tests__/notification.ssr.test.mjs +0 -25
  318. package/dist/notification/__tests__/notification.test.cjs +0 -248
  319. package/dist/notification/__tests__/notification.test.mjs +0 -206
  320. package/dist/pagination/__tests__/pagination.ssr.test.cjs +0 -61
  321. package/dist/pagination/__tests__/pagination.ssr.test.mjs +0 -59
  322. package/dist/pagination/__tests__/pagination.test.cjs +0 -135
  323. package/dist/pagination/__tests__/pagination.test.mjs +0 -131
  324. package/dist/popconfirm/__tests__/popconfirm.ssr.test.cjs +0 -48
  325. package/dist/popconfirm/__tests__/popconfirm.ssr.test.mjs +0 -63
  326. package/dist/popconfirm/__tests__/popconfirm.test.cjs +0 -62
  327. package/dist/popconfirm/__tests__/popconfirm.test.mjs +0 -56
  328. package/dist/popover/__tests__/popover.ssr.test.cjs +0 -48
  329. package/dist/popover/__tests__/popover.ssr.test.mjs +0 -63
  330. package/dist/popover/__tests__/popover.test.cjs +0 -107
  331. package/dist/popover/__tests__/popover.test.mjs +0 -93
  332. package/dist/price/__tests__/price.ssr.test.cjs +0 -20
  333. package/dist/price/__tests__/price.ssr.test.mjs +0 -19
  334. package/dist/price/__tests__/price.test.cjs +0 -45
  335. package/dist/price/__tests__/price.test.mjs +0 -42
  336. package/dist/product-card/__tests__/product-card.ssr.test.cjs +0 -21
  337. package/dist/product-card/__tests__/product-card.ssr.test.mjs +0 -18
  338. package/dist/product-card/__tests__/product-card.test.cjs +0 -54
  339. package/dist/product-card/__tests__/product-card.test.mjs +0 -53
  340. package/dist/progress/__tests__/progress.ssr.test.cjs +0 -31
  341. package/dist/progress/__tests__/progress.ssr.test.mjs +0 -29
  342. package/dist/progress/__tests__/progress.test.cjs +0 -119
  343. package/dist/progress/__tests__/progress.test.mjs +0 -77
  344. package/dist/radio/__tests__/radio-button.test.cjs +0 -99
  345. package/dist/radio/__tests__/radio-button.test.mjs +0 -83
  346. package/dist/radio/__tests__/radio.ssr.test.cjs +0 -132
  347. package/dist/radio/__tests__/radio.ssr.test.mjs +0 -165
  348. package/dist/radio/__tests__/radio.test.cjs +0 -170
  349. package/dist/radio/__tests__/radio.test.mjs +0 -143
  350. package/dist/rate/__tests__/rate.ssr.test.cjs +0 -106
  351. package/dist/rate/__tests__/rate.ssr.test.mjs +0 -103
  352. package/dist/rate/__tests__/rate.test.cjs +0 -88
  353. package/dist/rate/__tests__/rate.test.mjs +0 -85
  354. package/dist/result/__tests__/result.ssr.test.cjs +0 -62
  355. package/dist/result/__tests__/result.ssr.test.mjs +0 -51
  356. package/dist/result/__tests__/result.test.cjs +0 -135
  357. package/dist/result/__tests__/result.test.mjs +0 -92
  358. package/dist/row/__tests__/row.ssr.test.cjs +0 -29
  359. package/dist/row/__tests__/row.ssr.test.mjs +0 -30
  360. package/dist/row/__tests__/row.test.cjs +0 -89
  361. package/dist/row/__tests__/row.test.mjs +0 -86
  362. package/dist/row/__tests__/row_ts.test.cjs +0 -31
  363. package/dist/row/__tests__/row_ts.test.mjs +0 -28
  364. package/dist/scrollbar/__tests__/scrollbar.ssr.test.cjs +0 -49
  365. package/dist/scrollbar/__tests__/scrollbar.ssr.test.mjs +0 -54
  366. package/dist/scrollbar/__tests__/scrollbar.test.cjs +0 -43
  367. package/dist/scrollbar/__tests__/scrollbar.test.mjs +0 -40
  368. package/dist/select/__tests__/select.perf.test.cjs +0 -191
  369. package/dist/select/__tests__/select.perf.test.mjs +0 -185
  370. package/dist/select/__tests__/select.ssr.test.cjs +0 -58
  371. package/dist/select/__tests__/select.ssr.test.mjs +0 -52
  372. package/dist/select/__tests__/select.test.cjs +0 -414
  373. package/dist/select/__tests__/select.test.mjs +0 -345
  374. package/dist/skeleton/__tests__/skeleton.ssr.test.cjs +0 -81
  375. package/dist/skeleton/__tests__/skeleton.ssr.test.mjs +0 -83
  376. package/dist/skeleton/__tests__/skeleton.test.cjs +0 -72
  377. package/dist/skeleton/__tests__/skeleton.test.mjs +0 -65
  378. package/dist/sku-selector/__tests__/sku-selector.ssr.test.cjs +0 -32
  379. package/dist/sku-selector/__tests__/sku-selector.ssr.test.mjs +0 -19
  380. package/dist/sku-selector/__tests__/sku-selector.test.cjs +0 -64
  381. package/dist/sku-selector/__tests__/sku-selector.test.mjs +0 -53
  382. package/dist/slider/__tests__/repro.test.cjs +0 -25
  383. package/dist/slider/__tests__/repro.test.mjs +0 -22
  384. package/dist/slider/__tests__/slider.ssr.test.cjs +0 -118
  385. package/dist/slider/__tests__/slider.ssr.test.mjs +0 -115
  386. package/dist/slider/__tests__/slider.test.cjs +0 -155
  387. package/dist/slider/__tests__/slider.test.mjs +0 -120
  388. package/dist/smart-address/__tests__/smart-address.ssr.test.cjs +0 -28
  389. package/dist/smart-address/__tests__/smart-address.ssr.test.mjs +0 -25
  390. package/dist/smart-address/__tests__/smart-address.test.cjs +0 -68
  391. package/dist/smart-address/__tests__/smart-address.test.mjs +0 -56
  392. package/dist/space/__tests__/space.ssr.test.cjs +0 -115
  393. package/dist/space/__tests__/space.ssr.test.mjs +0 -150
  394. package/dist/space/__tests__/space.test.cjs +0 -227
  395. package/dist/space/__tests__/space.test.mjs +0 -187
  396. package/dist/spin/__tests__/spin.ssr.test.cjs +0 -46
  397. package/dist/spin/__tests__/spin.ssr.test.mjs +0 -43
  398. package/dist/spin/__tests__/spin.test.cjs +0 -65
  399. package/dist/spin/__tests__/spin.test.mjs +0 -63
  400. package/dist/steps/__tests__/steps.ssr.test.cjs +0 -73
  401. package/dist/steps/__tests__/steps.ssr.test.mjs +0 -55
  402. package/dist/steps/__tests__/steps.test.cjs +0 -152
  403. package/dist/steps/__tests__/steps.test.mjs +0 -123
  404. package/dist/submit-bar/__tests__/submit-bar.ssr.test.cjs +0 -21
  405. package/dist/submit-bar/__tests__/submit-bar.ssr.test.mjs +0 -18
  406. package/dist/submit-bar/__tests__/submit-bar.test.cjs +0 -50
  407. package/dist/submit-bar/__tests__/submit-bar.test.mjs +0 -36
  408. package/dist/switch/__tests__/switch.ssr.test.cjs +0 -105
  409. package/dist/switch/__tests__/switch.ssr.test.mjs +0 -102
  410. package/dist/switch/__tests__/switch.test.cjs +0 -251
  411. package/dist/switch/__tests__/switch.test.mjs +0 -193
  412. package/dist/table/__tests__/table-advance.test.cjs +0 -180
  413. package/dist/table/__tests__/table-advance.test.mjs +0 -118
  414. package/dist/table/__tests__/table-interaction.test.cjs +0 -236
  415. package/dist/table/__tests__/table-interaction.test.mjs +0 -162
  416. package/dist/table/__tests__/table-utils.test.cjs +0 -690
  417. package/dist/table/__tests__/table-utils.test.mjs +0 -485
  418. package/dist/table/__tests__/table.perf.test.cjs +0 -231
  419. package/dist/table/__tests__/table.perf.test.mjs +0 -225
  420. package/dist/table/__tests__/table.ssr.test.cjs +0 -296
  421. package/dist/table/__tests__/table.ssr.test.mjs +0 -265
  422. package/dist/table/__tests__/table.test.cjs +0 -682
  423. package/dist/table/__tests__/table.test.mjs +0 -617
  424. package/dist/table/__tests__/use-column-drag.test.cjs +0 -238
  425. package/dist/table/__tests__/use-column-drag.test.mjs +0 -150
  426. package/dist/table/__tests__/use-table-export.test.cjs +0 -179
  427. package/dist/table/__tests__/use-table-export.test.mjs +0 -105
  428. package/dist/table/__tests__/use-table-import.test.cjs +0 -206
  429. package/dist/table/__tests__/use-table-import.test.mjs +0 -144
  430. package/dist/table/__tests__/use-table-print.test.cjs +0 -190
  431. package/dist/table/__tests__/use-table-print.test.mjs +0 -134
  432. package/dist/table/__tests__/use-virtual-scroll.test.cjs +0 -286
  433. package/dist/table/__tests__/use-virtual-scroll.test.mjs +0 -196
  434. package/dist/tabs/__tests__/tabs.ssr.test.cjs +0 -57
  435. package/dist/tabs/__tests__/tabs.ssr.test.mjs +0 -41
  436. package/dist/tabs/__tests__/tabs.test.cjs +0 -171
  437. package/dist/tabs/__tests__/tabs.test.mjs +0 -134
  438. package/dist/tag/__tests__/tag.ssr.test.cjs +0 -45
  439. package/dist/tag/__tests__/tag.ssr.test.mjs +0 -48
  440. package/dist/tag/__tests__/tag.test.cjs +0 -194
  441. package/dist/tag/__tests__/tag.test.mjs +0 -167
  442. package/dist/time-picker/__tests__/time-picker.ssr.test.cjs +0 -46
  443. package/dist/time-picker/__tests__/time-picker.ssr.test.mjs +0 -43
  444. package/dist/time-picker/__tests__/time-picker.test.cjs +0 -228
  445. package/dist/time-picker/__tests__/time-picker.test.mjs +0 -218
  446. package/dist/time-picker/__tests__/time-spinner.test.cjs +0 -196
  447. package/dist/time-picker/__tests__/time-spinner.test.mjs +0 -162
  448. package/dist/time-select/__tests__/time-select.ssr.test.cjs +0 -42
  449. package/dist/time-select/__tests__/time-select.ssr.test.mjs +0 -37
  450. package/dist/time-select/__tests__/time-select.test.cjs +0 -390
  451. package/dist/time-select/__tests__/time-select.test.mjs +0 -374
  452. package/dist/tooltip/__tests__/tooltip.ssr.test.cjs +0 -55
  453. package/dist/tooltip/__tests__/tooltip.ssr.test.mjs +0 -76
  454. package/dist/tooltip/__tests__/tooltip.test.cjs +0 -132
  455. package/dist/tooltip/__tests__/tooltip.test.mjs +0 -121
  456. package/dist/transfer/__tests__/transfer.ssr.test.cjs +0 -47
  457. package/dist/transfer/__tests__/transfer.ssr.test.mjs +0 -44
  458. package/dist/transfer/__tests__/transfer.test.cjs +0 -422
  459. package/dist/transfer/__tests__/transfer.test.mjs +0 -405
  460. package/dist/tree/__tests__/tree.perf.test.cjs +0 -182
  461. package/dist/tree/__tests__/tree.perf.test.mjs +0 -198
  462. package/dist/tree/__tests__/tree.ssr.test.cjs +0 -56
  463. package/dist/tree/__tests__/tree.ssr.test.mjs +0 -45
  464. package/dist/tree/__tests__/tree.test.cjs +0 -488
  465. package/dist/tree/__tests__/tree.test.mjs +0 -333
  466. package/dist/tree-select/__tests__/tree-select.ssr.test.cjs +0 -52
  467. package/dist/tree-select/__tests__/tree-select.ssr.test.mjs +0 -55
  468. package/dist/tree-select/__tests__/tree-select.test.cjs +0 -231
  469. package/dist/tree-select/__tests__/tree-select.test.mjs +0 -189
  470. package/dist/typography/__tests__/typography.ssr.test.cjs +0 -85
  471. package/dist/typography/__tests__/typography.ssr.test.mjs +0 -63
  472. package/dist/typography/__tests__/typography.test.cjs +0 -362
  473. package/dist/typography/__tests__/typography.test.mjs +0 -161
  474. package/dist/upload/__tests__/upload.ssr.test.cjs +0 -28
  475. package/dist/upload/__tests__/upload.ssr.test.mjs +0 -26
  476. package/dist/upload/__tests__/upload.test.cjs +0 -467
  477. package/dist/upload/__tests__/upload.test.mjs +0 -336
  478. package/dist/waterfall/__tests__/waterfall.ssr.test.cjs +0 -38
  479. package/dist/waterfall/__tests__/waterfall.ssr.test.mjs +0 -39
  480. package/dist/waterfall/__tests__/waterfall.test.cjs +0 -122
  481. package/dist/waterfall/__tests__/waterfall.test.mjs +0 -85
  482. package/dist/watermark/__tests__/watermark.ssr.test.cjs +0 -32
  483. package/dist/watermark/__tests__/watermark.ssr.test.mjs +0 -30
  484. package/dist/watermark/__tests__/watermark.test.cjs +0 -127
  485. package/dist/watermark/__tests__/watermark.test.mjs +0 -124
@@ -1,366 +0,0 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, it, expect, vi } from "vitest";
3
- import YhFormSchema from "../src/form-schema.vue";
4
- import { nextTick, h } from "vue";
5
- const YhInput = {
6
- name: "YhInput",
7
- props: ["modelValue", "placeholder", "disabled"],
8
- template: `<input class="yh-input" :value="modelValue" @input="$emit('update:modelValue', $event.target.value)" :placeholder="placeholder" :disabled="disabled" />`
9
- };
10
- const YhSelect = {
11
- name: "YhSelect",
12
- props: ["modelValue", "options", "loading"],
13
- template: `<select class="yh-select" :value="modelValue" @change="$emit('update:modelValue', $event.target.value)"><option v-for="opt in options" :key="opt.value" :value="opt.value">{{opt.label}}</option></select>`
14
- };
15
- const YhSwitch = {
16
- name: "YhSwitch",
17
- props: ["modelValue"],
18
- template: `<input type="checkbox" class="yh-switch" :checked="modelValue" @change="$emit('update:modelValue', $event.target.checked)" />`
19
- };
20
- const YhButton = {
21
- name: "YhButton",
22
- props: ["type", "text", "disabled"],
23
- emits: ["click"],
24
- template: `<button class="yh-button" :disabled="disabled" @click="$emit('click')"><slot /></button>`
25
- };
26
- const globalComponents = {
27
- "yh-input": YhInput,
28
- "yh-select": YhSelect,
29
- "yh-switch": YhSwitch,
30
- "yh-button": YhButton
31
- };
32
- describe("FormSchema", () => {
33
- it("\u57FA\u7840\u6E32\u67D3 - \u6309 schema \u6E32\u67D3\u8868\u5355\u9879", async () => {
34
- const model = { username: "ant", role: "" };
35
- const schema = [
36
- {
37
- field: "username",
38
- label: "Username",
39
- component: "input",
40
- props: { placeholder: "Enter username" }
41
- }
42
- ];
43
- const wrapper = mount(YhFormSchema, {
44
- props: { modelValue: model, schema },
45
- global: { components: globalComponents }
46
- });
47
- expect(wrapper.find(".yh-form").exists()).toBe(true);
48
- const input = wrapper.find("input");
49
- expect(input.attributes("placeholder")).toBe("Enter username");
50
- });
51
- it("\u53CC\u5411\u7ED1\u5B9A - v-model \u540C\u6B65\u66F4\u65B0", async () => {
52
- const model = { username: "" };
53
- const schema = [{ field: "username", component: "input" }];
54
- const wrapper = mount(YhFormSchema, {
55
- props: { modelValue: model, schema },
56
- global: { components: globalComponents }
57
- });
58
- const input = wrapper.find("input");
59
- await input.setValue("new_user");
60
- expect(wrapper.emitted("update:modelValue")).toBeTruthy();
61
- const lastEmitted = wrapper.emitted("update:modelValue").slice(-1)[0][0];
62
- expect(lastEmitted.username).toBe("new_user");
63
- });
64
- it("change \u4E8B\u4EF6 - \u89E6\u53D1 change \u5E76\u5305\u542B field \u548C val", async () => {
65
- const wrapper = mount(YhFormSchema, {
66
- props: { modelValue: { name: "" }, schema: [{ field: "name", component: "input" }] },
67
- global: { components: globalComponents }
68
- });
69
- await wrapper.find("input").setValue("test");
70
- const changeEvents = wrapper.emitted("change");
71
- expect(changeEvents.length).toBeGreaterThan(0);
72
- expect(changeEvents[0][0]).toBe("name");
73
- expect(changeEvents[0][1]).toBe("test");
74
- });
75
- it("\u52A8\u6001\u663E\u9690 - hidden \u51FD\u6570\u652F\u6301\u8054\u52A8", async () => {
76
- const schema = [
77
- { field: "showExtra", component: "input" },
78
- {
79
- field: "extra",
80
- label: "Extra Label",
81
- component: "input",
82
- hidden: (m) => !m.showExtra
83
- }
84
- ];
85
- const wrapper = mount(YhFormSchema, {
86
- props: { modelValue: { showExtra: false, extra: "" }, schema },
87
- global: { components: globalComponents }
88
- });
89
- expect(wrapper.text()).not.toContain("Extra Label");
90
- await wrapper.setProps({ modelValue: { showExtra: true, extra: "visible" } });
91
- await nextTick();
92
- expect(wrapper.text()).toContain("Extra Label");
93
- });
94
- it("\u52A8\u6001\u8054\u52A8 - required \u548C rules \u652F\u6301\u4F20\u5165\u51FD\u6570\u8BA1\u7B97", async () => {
95
- const schema = [
96
- { field: "type", component: "input" },
97
- {
98
- field: "reason",
99
- component: "input",
100
- required: (model) => model.type === "other",
101
- rules: (model) => {
102
- return model.type === "other" ? [{ min: 5, message: "\u81F3\u5C11 5 \u4E2A\u5B57\u7B26", trigger: "blur" }] : [];
103
- }
104
- }
105
- ];
106
- const wrapper = mount(YhFormSchema, {
107
- props: { modelValue: { type: "normal", reason: "" }, schema },
108
- global: { components: globalComponents }
109
- });
110
- const reasonItem = wrapper.findAll(".yh-form-item")[1];
111
- expect(reasonItem.classes()).not.toContain("is-required");
112
- await wrapper.setProps({ modelValue: { type: "other", reason: "" } });
113
- expect(reasonItem.classes()).toContain("is-required");
114
- });
115
- it("\u5206\u7EC4\u6E32\u67D3 - \u5C55\u793A group title \u5E76\u652F\u6301\u6298\u53E0", async () => {
116
- const schema = [
117
- {
118
- title: "Basic Info",
119
- items: [{ field: "name", component: "input" }],
120
- collapsible: true
121
- }
122
- ];
123
- const wrapper = mount(YhFormSchema, {
124
- props: { modelValue: { name: "" }, schema },
125
- global: { components: globalComponents }
126
- });
127
- expect(wrapper.find(".yh-form-schema__group-title").text()).toContain("Basic Info");
128
- await wrapper.find(".yh-form-schema__group-title").trigger("click");
129
- expect(wrapper.find(".yh-form-schema__group").classes()).toContain("is-collapsed");
130
- });
131
- it("\u5F02\u6B65\u9009\u9879 - asyncOptions \u81EA\u52A8\u52A0\u8F7D\u5E76\u6CE8\u5165", async () => {
132
- const asyncOptions = vi.fn().mockResolvedValue([{ label: "Option A", value: "a" }]);
133
- const schema = [{ field: "type", component: "select", asyncOptions }];
134
- const wrapper = mount(YhFormSchema, {
135
- props: { modelValue: { type: "" }, schema },
136
- global: { components: globalComponents }
137
- });
138
- await nextTick();
139
- await nextTick();
140
- await nextTick();
141
- expect(asyncOptions).toHaveBeenCalled();
142
- const options = wrapper.findAll("option");
143
- expect(options.length).toBeGreaterThan(0);
144
- });
145
- it("render \u51FD\u6570 - \u81EA\u5B9A\u4E49\u6E32\u67D3", () => {
146
- const schema = [
147
- {
148
- field: "custom",
149
- render: (m) => h("div", { class: "custom-render" }, `Val: ${m.custom}`)
150
- }
151
- ];
152
- const wrapper = mount(YhFormSchema, {
153
- props: { modelValue: { custom: "hello" }, schema },
154
- global: { components: globalComponents }
155
- });
156
- expect(wrapper.find(".custom-render").text()).toBe("Val: hello");
157
- });
158
- it("\u66B4\u9732 API - validate/resetFields/clearValidate/getModel/setFieldValue", () => {
159
- const wrapper = mount(YhFormSchema, {
160
- props: { modelValue: {}, schema: [] },
161
- global: { components: globalComponents }
162
- });
163
- const vm = wrapper.vm;
164
- expect(typeof vm.validate).toBe("function");
165
- expect(typeof vm.resetFields).toBe("function");
166
- expect(typeof vm.clearValidate).toBe("function");
167
- expect(typeof vm.getModel).toBe("function");
168
- expect(typeof vm.setFieldValue).toBe("function");
169
- });
170
- it("getModel - \u8FD4\u56DE\u5F53\u524D\u5B8C\u6574 model \u5FEB\u7167", async () => {
171
- const wrapper = mount(YhFormSchema, {
172
- props: { modelValue: { city: "BJ" }, schema: [{ field: "city", component: "input" }] },
173
- global: { components: globalComponents }
174
- });
175
- const model = wrapper.vm.getModel();
176
- expect(model.city).toBe("BJ");
177
- });
178
- it("setFieldValue - \u52A8\u6001\u66F4\u65B0\u5355\u5B57\u6BB5\u503C", async () => {
179
- const wrapper = mount(YhFormSchema, {
180
- props: { modelValue: { city: "" }, schema: [{ field: "city", component: "input" }] },
181
- global: { components: globalComponents }
182
- });
183
- wrapper.vm.setFieldValue("city", "SH");
184
- await nextTick();
185
- const emitted = wrapper.emitted("update:modelValue");
186
- const last = emitted[emitted.length - 1][0];
187
- expect(last.city).toBe("SH");
188
- });
189
- it("required \u7B80\u5199 - \u81EA\u52A8\u6DFB\u52A0\u5FC5\u586B\u89C4\u5219\u5E76\u89E6\u53D1\u6821\u9A8C", async () => {
190
- const schema = [{ field: "name", label: "\u59D3\u540D", component: "input", required: true }];
191
- const wrapper = mount(YhFormSchema, {
192
- props: { modelValue: { name: "" }, schema },
193
- global: { components: globalComponents }
194
- });
195
- let isValid = true;
196
- try {
197
- isValid = await wrapper.vm.validate();
198
- } catch (_) {
199
- isValid = false;
200
- }
201
- expect(isValid).toBe(false);
202
- });
203
- it("type divider - \u6E32\u67D3\u5206\u9694\u7EBF", () => {
204
- const schema = [{ type: "divider", label: "\u57FA\u672C\u4FE1\u606F", field: "_d" }];
205
- const wrapper = mount(YhFormSchema, {
206
- props: { modelValue: {}, schema },
207
- global: { components: globalComponents }
208
- });
209
- expect(wrapper.find(".yh-form-schema__divider").exists()).toBe(true);
210
- expect(wrapper.find(".yh-form-schema__divider-label").text()).toBe("\u57FA\u672C\u4FE1\u606F");
211
- });
212
- it("type text - \u53EA\u8BFB\u663E\u793A\u5B57\u6BB5\u503C", () => {
213
- const schema = [{ type: "text", label: "\u59D3\u540D", field: "name" }];
214
- const wrapper = mount(YhFormSchema, {
215
- props: { modelValue: { name: "Alice" }, schema },
216
- global: { components: globalComponents }
217
- });
218
- expect(wrapper.find(".yh-form-schema__text-value").text()).toBe("Alice");
219
- });
220
- it("type text - emptyValue \u7A7A\u6001\u5360\u4F4D\u7B26", async () => {
221
- const schema = [
222
- { type: "text", label: "\u7535\u8BDD", field: "phone", emptyValue: "\u6682\u65E0" },
223
- { type: "text", label: "\u5730\u5740", field: "addr" }
224
- ];
225
- const wrapper = mount(YhFormSchema, {
226
- props: { modelValue: { phone: null, addr: void 0 }, schema },
227
- global: { components: globalComponents }
228
- });
229
- await nextTick();
230
- const items = wrapper.findAll(".yh-form-schema__text-value");
231
- expect(items[0].text()).toBe("\u6682\u65E0");
232
- expect(items[1].text()).toBe("-");
233
- });
234
- it("defaultValue - \u672A\u8BBE\u7F6E\u5B57\u6BB5\u65F6\u586B\u5145\u9ED8\u8BA4\u503C", async () => {
235
- const schema = [{ field: "city", component: "input", defaultValue: "Beijing" }];
236
- const wrapper = mount(YhFormSchema, {
237
- props: { modelValue: {}, schema },
238
- global: { components: globalComponents }
239
- });
240
- await nextTick();
241
- const emitted = wrapper.emitted("update:modelValue");
242
- expect(emitted).toBeTruthy();
243
- const last = emitted[emitted.length - 1][0];
244
- expect(last.city).toBe("Beijing");
245
- });
246
- it("disabled \u51FD\u6570 - \u6839\u636E model \u52A8\u6001\u7981\u7528\u5B57\u6BB5", async () => {
247
- const schema = [
248
- { field: "toggle", component: "switch" },
249
- {
250
- field: "target",
251
- component: "input",
252
- disabled: (m) => !m.toggle
253
- }
254
- ];
255
- const wrapper = mount(YhFormSchema, {
256
- props: { modelValue: { toggle: false, target: "" }, schema },
257
- global: { components: globalComponents }
258
- });
259
- const input = wrapper.find('input[type="text"], input:not([type="checkbox"])').element;
260
- expect(input.disabled).toBe(true);
261
- });
262
- it("\u5916\u90E8 modelValue \u66F4\u65B0 - localModel \u540C\u6B65\u54CD\u5E94", async () => {
263
- const wrapper = mount(YhFormSchema, {
264
- props: { modelValue: { name: "old" }, schema: [{ field: "name", component: "input" }] },
265
- global: { components: globalComponents }
266
- });
267
- await wrapper.setProps({ modelValue: { name: "new" } });
268
- await nextTick();
269
- const input = wrapper.find("input");
270
- expect(input.element.value).toBe("new");
271
- });
272
- describe("type list - \u52A8\u6001\u589E\u51CF\u5217\u8868", () => {
273
- const listSchema = [
274
- { field: "name", label: "\u59D3\u540D", component: "input" },
275
- { field: "phone", label: "\u7535\u8BDD", component: "input" }
276
- ];
277
- it("\u521D\u59CB\u6E32\u67D3 - \u6309\u5DF2\u6709\u5217\u8868\u6570\u636E\u6E32\u67D3\u884C", async () => {
278
- const schema = [
279
- { field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
280
- ];
281
- const wrapper = mount(YhFormSchema, {
282
- props: {
283
- modelValue: {
284
- contacts: [
285
- { name: "Alice", phone: "111" },
286
- { name: "Bob", phone: "222" }
287
- ]
288
- },
289
- schema
290
- },
291
- global: { components: globalComponents }
292
- });
293
- await nextTick();
294
- expect(wrapper.findAll(".yh-form-schema__list-row").length).toBe(2);
295
- });
296
- it("\u6DFB\u52A0\u5217\u8868\u9879 - \u70B9\u51FB\u6DFB\u52A0\u6309\u94AE\u589E\u52A0\u4E00\u884C", async () => {
297
- const schema = [
298
- { field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
299
- ];
300
- const wrapper = mount(YhFormSchema, {
301
- props: { modelValue: { contacts: [] }, schema },
302
- global: { components: globalComponents }
303
- });
304
- await wrapper.find(".yh-form-schema__list-add").trigger("click");
305
- await nextTick();
306
- const emitted = wrapper.emitted("update:modelValue");
307
- const last = emitted[emitted.length - 1][0];
308
- expect(last.contacts.length).toBe(1);
309
- });
310
- it("\u5220\u9664\u5217\u8868\u9879 - \u70B9\u51FB\u5220\u9664\u6309\u94AE\u79FB\u9664\u5BF9\u5E94\u884C", async () => {
311
- const schema = [
312
- { field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
313
- ];
314
- const wrapper = mount(YhFormSchema, {
315
- props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
316
- global: { components: globalComponents }
317
- });
318
- await nextTick();
319
- await wrapper.find(".yh-form-schema__list-delete").trigger("click");
320
- await nextTick();
321
- const emitted = wrapper.emitted("update:modelValue");
322
- const last = emitted[emitted.length - 1][0];
323
- expect(last.contacts.length).toBe(0);
324
- });
325
- it("max \u9650\u5236 - \u8D85\u51FA\u6700\u5927\u6570\u91CF\u65F6\u7981\u7528\u6DFB\u52A0\u6309\u94AE", async () => {
326
- const schema = [
327
- { field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: { max: 1 } }
328
- ];
329
- const wrapper = mount(YhFormSchema, {
330
- props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
331
- global: { components: globalComponents }
332
- });
333
- await nextTick();
334
- const addBtn = wrapper.find(".yh-form-schema__list-add");
335
- expect(addBtn.attributes("disabled")).toBeDefined();
336
- });
337
- it("min \u9650\u5236 - \u672A\u8FBE\u5230\u6700\u5C0F\u6570\u91CF\u65F6\u7981\u7528\u5220\u9664\u6309\u94AE", async () => {
338
- const schema = [
339
- { field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: { min: 1 } }
340
- ];
341
- const wrapper = mount(YhFormSchema, {
342
- props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
343
- global: { components: globalComponents }
344
- });
345
- await nextTick();
346
- const delBtn = wrapper.find(".yh-form-schema__list-delete");
347
- expect(delBtn.attributes("disabled")).toBeDefined();
348
- });
349
- it("addButtonText - \u81EA\u5B9A\u4E49\u6DFB\u52A0\u6309\u94AE\u6587\u6848", async () => {
350
- const schema = [
351
- {
352
- field: "contacts",
353
- label: "\u8054\u7CFB\u4EBA",
354
- type: "list",
355
- listSchema,
356
- listProps: { addButtonText: "\u65B0\u589E\u8054\u7CFB\u4EBA" }
357
- }
358
- ];
359
- const wrapper = mount(YhFormSchema, {
360
- props: { modelValue: { contacts: [] }, schema },
361
- global: { components: globalComponents }
362
- });
363
- expect(wrapper.find(".yh-form-schema__list-add").text()).toContain("\u65B0\u589E\u8054\u7CFB\u4EBA");
364
- });
365
- });
366
- });
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _form = _interopRequireDefault(require("../src/form.vue"));
5
- var _formItem = _interopRequireDefault(require("../src/form-item.vue"));
6
- var _input = _interopRequireDefault(require("../../input/src/input.vue"));
7
- var _ssr = require("../../__tests__/utils/ssr.cjs");
8
- var _vue = require("vue");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- (0, _vitest.describe)("YhForm SSR", () => {
11
- (0, _vitest.it)("should render form correctly in SSR", async () => {
12
- const html = await (0, _ssr.renderSSR)(_form.default, {
13
- model: {
14
- name: ""
15
- },
16
- labelWidth: "100px"
17
- }, {
18
- default: () => (0, _vue.h)(_formItem.default, {
19
- label: "Name",
20
- prop: "name"
21
- }, {
22
- default: () => (0, _vue.h)(_input.default, {
23
- modelValue: ""
24
- })
25
- })
26
- });
27
- (0, _ssr.expectSSRHasClass)(html, "yh-form");
28
- (0, _vitest.expect)(html).toContain("Name");
29
- });
30
- (0, _vitest.it)("should render inline form in SSR", async () => {
31
- const html = await (0, _ssr.renderSSR)(_form.default, {
32
- layout: "inline",
33
- model: {}
34
- });
35
- (0, _ssr.expectSSRHasClass)(html, "yh-form--inline");
36
- });
37
- (0, _vitest.it)("should render different label positions in SSR", async () => {
38
- const positions = ["left", "right", "top"];
39
- for (const pos of positions) {
40
- const html = await (0, _ssr.renderSSR)(_form.default, {
41
- labelPosition: pos,
42
- model: {}
43
- });
44
- (0, _ssr.expectSSRHasClass)(html, `yh-form--label-${pos}`);
45
- }
46
- });
47
- (0, _vitest.it)("should hydrate form without mismatch", async () => {
48
- const result = await (0, _ssr.testHydration)(_form.default, {
49
- model: {
50
- test: "123"
51
- }
52
- }, {
53
- default: () => (0, _vue.h)(_formItem.default, {
54
- label: "Test",
55
- prop: "test"
56
- }, {
57
- default: () => (0, _vue.h)(_input.default, {
58
- modelValue: "123"
59
- })
60
- })
61
- });
62
- (0, _vitest.expect)(result.isMatch).toBe(true);
63
- });
64
- (0, _vitest.it)("should render validation states in SSR", async () => {
65
- const html = await (0, _ssr.renderSSR)(_formItem.default, {
66
- label: "Email",
67
- error: "Invalid email",
68
- showMessage: true,
69
- validateStatus: "error"
70
- });
71
- (0, _ssr.expectSSRHasClass)(html, "is-error");
72
- (0, _vitest.expect)(html).toContain("Invalid email");
73
- });
74
- });
@@ -1,73 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import Form from "../src/form.vue";
3
- import FormItem from "../src/form-item.vue";
4
- import Input from "../../input/src/input.vue";
5
- import { renderSSR, expectSSRHasClass, testHydration } from "../../__tests__/utils/ssr.mjs";
6
- import { h } from "vue";
7
- describe("YhForm SSR", () => {
8
- it("should render form correctly in SSR", async () => {
9
- const html = await renderSSR(
10
- Form,
11
- {
12
- model: { name: "" },
13
- labelWidth: "100px"
14
- },
15
- {
16
- default: () => h(
17
- FormItem,
18
- { label: "Name", prop: "name" },
19
- {
20
- default: () => h(Input, { modelValue: "" })
21
- }
22
- )
23
- }
24
- );
25
- expectSSRHasClass(html, "yh-form");
26
- expect(html).toContain("Name");
27
- });
28
- it("should render inline form in SSR", async () => {
29
- const html = await renderSSR(Form, {
30
- layout: "inline",
31
- model: {}
32
- });
33
- expectSSRHasClass(html, "yh-form--inline");
34
- });
35
- it("should render different label positions in SSR", async () => {
36
- const positions = ["left", "right", "top"];
37
- for (const pos of positions) {
38
- const html = await renderSSR(Form, {
39
- labelPosition: pos,
40
- model: {}
41
- });
42
- expectSSRHasClass(html, `yh-form--label-${pos}`);
43
- }
44
- });
45
- it("should hydrate form without mismatch", async () => {
46
- const result = await testHydration(
47
- Form,
48
- {
49
- model: { test: "123" }
50
- },
51
- {
52
- default: () => h(
53
- FormItem,
54
- { label: "Test", prop: "test" },
55
- {
56
- default: () => h(Input, { modelValue: "123" })
57
- }
58
- )
59
- }
60
- );
61
- expect(result.isMatch).toBe(true);
62
- });
63
- it("should render validation states in SSR", async () => {
64
- const html = await renderSSR(FormItem, {
65
- label: "Email",
66
- error: "Invalid email",
67
- showMessage: true,
68
- validateStatus: "error"
69
- });
70
- expectSSRHasClass(html, "is-error");
71
- expect(html).toContain("Invalid email");
72
- });
73
- });