@yh-ui/components 0.1.21 → 0.1.22
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/README.md +2 -0
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.mjs +1 -1
- package/dist/icon/index.cjs +1 -1
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/loading/index.cjs +1 -1
- package/dist/loading/index.d.ts +1 -1
- package/dist/loading/index.mjs +1 -1
- package/dist/message/src/method.cjs +1 -1
- package/dist/message/src/method.d.ts +1 -1
- package/dist/message/src/method.mjs +1 -1
- package/dist/message-box/index.cjs +1 -1
- package/dist/message-box/index.d.ts +1 -1
- package/dist/message-box/index.mjs +1 -1
- package/dist/notification/src/method.cjs +1 -1
- package/dist/notification/src/method.d.ts +1 -1
- package/dist/notification/src/method.mjs +1 -1
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.ts +7 -5
- package/dist/resolver.mjs +1 -1
- package/dist/style.css +584 -0
- package/package.json +6 -6
- package/dist/affix/__tests__/affix.bottom.test.cjs +0 -101
- package/dist/affix/__tests__/affix.bottom.test.mjs +0 -88
- package/dist/affix/__tests__/affix.ssr.test.cjs +0 -38
- package/dist/affix/__tests__/affix.ssr.test.mjs +0 -51
- package/dist/affix/__tests__/affix.test.cjs +0 -185
- package/dist/affix/__tests__/affix.test.mjs +0 -180
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.cjs +0 -55
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.mjs +0 -39
- package/dist/ai-action-group/__tests__/ai-action-group.test.cjs +0 -235
- package/dist/ai-action-group/__tests__/ai-action-group.test.mjs +0 -157
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.cjs +0 -61
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.mjs +0 -65
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.cjs +0 -205
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.mjs +0 -133
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.cjs +0 -73
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.mjs +0 -68
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.cjs +0 -128
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.mjs +0 -109
- package/dist/ai-attachments/__tests__/ai-attachments.ssr.test.cjs +0 -50
- package/dist/ai-attachments/__tests__/ai-attachments.ssr.test.mjs +0 -33
- package/dist/ai-attachments/__tests__/ai-attachments.test.cjs +0 -113
- package/dist/ai-attachments/__tests__/ai-attachments.test.mjs +0 -81
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.cjs +0 -95
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.mjs +0 -66
- package/dist/ai-bubble/__tests__/ai-bubble.test.cjs +0 -624
- package/dist/ai-bubble/__tests__/ai-bubble.test.mjs +0 -393
- package/dist/ai-bubble-list/__tests__/ai-bubble-list.ssr.test.cjs +0 -51
- package/dist/ai-bubble-list/__tests__/ai-bubble-list.ssr.test.mjs +0 -51
- package/dist/ai-bubble-list/__tests__/ai-bubble-list.test.cjs +0 -138
- package/dist/ai-bubble-list/__tests__/ai-bubble-list.test.mjs +0 -112
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.cjs +0 -90
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.mjs +0 -77
- package/dist/ai-chat/__tests__/ai-chat.test.cjs +0 -177
- package/dist/ai-chat/__tests__/ai-chat.test.mjs +0 -129
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.cjs +0 -75
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.mjs +0 -57
- package/dist/ai-code-block/__tests__/ai-code-block.test.cjs +0 -174
- package/dist/ai-code-block/__tests__/ai-code-block.test.mjs +0 -108
- package/dist/ai-code-editor/__tests__/ai-code-editor.ssr.test.cjs +0 -46
- package/dist/ai-code-editor/__tests__/ai-code-editor.ssr.test.mjs +0 -39
- package/dist/ai-code-editor/__tests__/ai-code-editor.test.cjs +0 -90
- package/dist/ai-code-editor/__tests__/ai-code-editor.test.mjs +0 -78
- package/dist/ai-code-runner/__tests__/ai-code-runner.ssr.test.cjs +0 -28
- package/dist/ai-code-runner/__tests__/ai-code-runner.ssr.test.mjs +0 -26
- package/dist/ai-code-runner/__tests__/ai-code-runner.test.cjs +0 -69
- package/dist/ai-code-runner/__tests__/ai-code-runner.test.mjs +0 -66
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.cjs +0 -50
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.mjs +0 -42
- package/dist/ai-conversations/__tests__/ai-conversations.test.cjs +0 -67
- package/dist/ai-conversations/__tests__/ai-conversations.test.mjs +0 -51
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.cjs +0 -62
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.mjs +0 -50
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.cjs +0 -315
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.mjs +0 -226
- package/dist/ai-file-card/__tests__/ai-file-card.ssr.test.cjs +0 -45
- package/dist/ai-file-card/__tests__/ai-file-card.ssr.test.mjs +0 -29
- package/dist/ai-file-card/__tests__/ai-file-card.test.cjs +0 -160
- package/dist/ai-file-card/__tests__/ai-file-card.test.mjs +0 -109
- package/dist/ai-mention/__tests__/ai-mention.ssr.test.cjs +0 -38
- package/dist/ai-mention/__tests__/ai-mention.ssr.test.mjs +0 -37
- package/dist/ai-mention/__tests__/ai-mention.test.cjs +0 -113
- package/dist/ai-mention/__tests__/ai-mention.test.mjs +0 -84
- package/dist/ai-mermaid/__tests__/ai-mermaid.ssr.test.cjs +0 -43
- package/dist/ai-mermaid/__tests__/ai-mermaid.ssr.test.mjs +0 -33
- package/dist/ai-mermaid/__tests__/ai-mermaid.test.cjs +0 -113
- package/dist/ai-mermaid/__tests__/ai-mermaid.test.mjs +0 -92
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.cjs +0 -49
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.mjs +0 -41
- package/dist/ai-prompts/__tests__/ai-prompts.test.cjs +0 -54
- package/dist/ai-prompts/__tests__/ai-prompts.test.mjs +0 -38
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.cjs +0 -33
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.mjs +0 -34
- package/dist/ai-provider/__tests__/ai-provider.test.cjs +0 -38
- package/dist/ai-provider/__tests__/ai-provider.test.mjs +0 -33
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.cjs +0 -46
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.mjs +0 -37
- package/dist/ai-sender/__tests__/ai-sender.test.cjs +0 -511
- package/dist/ai-sender/__tests__/ai-sender.test.mjs +0 -322
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.cjs +0 -72
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.mjs +0 -82
- package/dist/ai-sources/__tests__/ai-sources.test.cjs +0 -200
- package/dist/ai-sources/__tests__/ai-sources.test.mjs +0 -160
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.cjs +0 -56
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.mjs +0 -42
- package/dist/ai-thinking/__tests__/ai-thinking.test.cjs +0 -151
- package/dist/ai-thinking/__tests__/ai-thinking.test.mjs +0 -96
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.cjs +0 -88
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.mjs +0 -55
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.cjs +0 -344
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.mjs +0 -237
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.cjs +0 -32
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.mjs +0 -25
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.cjs +0 -130
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.mjs +0 -103
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.cjs +0 -57
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.mjs +0 -39
- package/dist/ai-welcome/__tests__/ai-welcome.test.cjs +0 -169
- package/dist/ai-welcome/__tests__/ai-welcome.test.mjs +0 -113
- package/dist/alert/__tests__/alert.ssr.test.cjs +0 -28
- package/dist/alert/__tests__/alert.ssr.test.mjs +0 -29
- package/dist/alert/__tests__/alert.test.cjs +0 -123
- package/dist/alert/__tests__/alert.test.mjs +0 -110
- package/dist/autocomplete/__tests__/autocomplete.ssr.test.cjs +0 -54
- package/dist/autocomplete/__tests__/autocomplete.ssr.test.mjs +0 -47
- package/dist/autocomplete/__tests__/autocomplete.test.cjs +0 -299
- package/dist/autocomplete/__tests__/autocomplete.test.mjs +0 -263
- package/dist/avatar/__tests__/avatar.ssr.test.cjs +0 -103
- package/dist/avatar/__tests__/avatar.ssr.test.mjs +0 -108
- package/dist/avatar/__tests__/avatar.test.cjs +0 -146
- package/dist/avatar/__tests__/avatar.test.mjs +0 -125
- package/dist/back-top/__tests__/back-top.ssr.test.cjs +0 -13
- package/dist/back-top/__tests__/back-top.ssr.test.mjs +0 -10
- package/dist/back-top/__tests__/back-top.test.cjs +0 -88
- package/dist/back-top/__tests__/back-top.test.mjs +0 -76
- package/dist/badge/__tests__/badge.ssr.test.cjs +0 -36
- package/dist/badge/__tests__/badge.ssr.test.mjs +0 -33
- package/dist/badge/__tests__/badge.test.cjs +0 -115
- package/dist/badge/__tests__/badge.test.mjs +0 -112
- package/dist/breadcrumb/__tests__/breadcrumb.ssr.test.cjs +0 -22
- package/dist/breadcrumb/__tests__/breadcrumb.ssr.test.mjs +0 -20
- package/dist/breadcrumb/__tests__/breadcrumb.test.cjs +0 -64
- package/dist/breadcrumb/__tests__/breadcrumb.test.mjs +0 -51
- package/dist/button/__tests__/button.ssr.test.cjs +0 -52
- package/dist/button/__tests__/button.ssr.test.mjs +0 -55
- package/dist/button/__tests__/button.test.cjs +0 -207
- package/dist/button/__tests__/button.test.mjs +0 -141
- package/dist/calendar/__tests__/calendar.ssr.test.cjs +0 -65
- package/dist/calendar/__tests__/calendar.ssr.test.mjs +0 -63
- package/dist/calendar/__tests__/calendar.test.cjs +0 -263
- package/dist/calendar/__tests__/calendar.test.mjs +0 -255
- package/dist/card/__tests__/card.ssr.test.cjs +0 -37
- package/dist/card/__tests__/card.ssr.test.mjs +0 -40
- package/dist/card/__tests__/card.test.cjs +0 -131
- package/dist/card/__tests__/card.test.mjs +0 -124
- package/dist/carousel/__tests__/carousel.ssr.test.cjs +0 -27
- package/dist/carousel/__tests__/carousel.ssr.test.mjs +0 -27
- package/dist/carousel/__tests__/carousel.test.cjs +0 -115
- package/dist/carousel/__tests__/carousel.test.mjs +0 -98
- package/dist/cascader/__tests__/cascader-panel.test.cjs +0 -162
- package/dist/cascader/__tests__/cascader-panel.test.mjs +0 -151
- package/dist/cascader/__tests__/cascader.ssr.test.cjs +0 -61
- package/dist/cascader/__tests__/cascader.ssr.test.mjs +0 -55
- package/dist/cascader/__tests__/cascader.test.cjs +0 -342
- package/dist/cascader/__tests__/cascader.test.mjs +0 -316
- package/dist/category-nav/__tests__/category-nav.ssr.test.cjs +0 -35
- package/dist/category-nav/__tests__/category-nav.ssr.test.mjs +0 -21
- package/dist/category-nav/__tests__/category-nav.test.cjs +0 -53
- package/dist/category-nav/__tests__/category-nav.test.mjs +0 -33
- package/dist/checkbox/__tests__/checkbox.ssr.test.cjs +0 -52
- package/dist/checkbox/__tests__/checkbox.ssr.test.mjs +0 -57
- package/dist/checkbox/__tests__/checkbox.test.cjs +0 -173
- package/dist/checkbox/__tests__/checkbox.test.mjs +0 -133
- package/dist/col/__tests__/col.ssr.test.cjs +0 -44
- package/dist/col/__tests__/col.ssr.test.mjs +0 -42
- package/dist/col/__tests__/col.test.cjs +0 -128
- package/dist/col/__tests__/col.test.mjs +0 -116
- package/dist/color-picker/__tests__/color-picker.ssr.test.cjs +0 -34
- package/dist/color-picker/__tests__/color-picker.ssr.test.mjs +0 -39
- package/dist/color-picker/__tests__/color-picker.test.cjs +0 -227
- package/dist/color-picker/__tests__/color-picker.test.mjs +0 -176
- package/dist/config-provider/__tests__/config-provider.ssr.test.cjs +0 -43
- package/dist/config-provider/__tests__/config-provider.ssr.test.mjs +0 -42
- package/dist/config-provider/__tests__/config-provider.test.cjs +0 -75
- package/dist/config-provider/__tests__/config-provider.test.mjs +0 -64
- package/dist/container/__tests__/container.ssr.test.cjs +0 -71
- package/dist/container/__tests__/container.ssr.test.mjs +0 -50
- package/dist/container/__tests__/container.test.cjs +0 -111
- package/dist/container/__tests__/container.test.mjs +0 -84
- package/dist/countdown/__tests__/countdown.ssr.test.cjs +0 -86
- package/dist/countdown/__tests__/countdown.ssr.test.mjs +0 -78
- package/dist/countdown/__tests__/countdown.test.cjs +0 -767
- package/dist/countdown/__tests__/countdown.test.mjs +0 -722
- package/dist/coupon-card/__tests__/coupon-card.ssr.test.cjs +0 -21
- package/dist/coupon-card/__tests__/coupon-card.ssr.test.mjs +0 -18
- package/dist/coupon-card/__tests__/coupon-card.test.cjs +0 -67
- package/dist/coupon-card/__tests__/coupon-card.test.mjs +0 -64
- package/dist/date-picker/__tests__/date-picker-extended.test.cjs +0 -581
- package/dist/date-picker/__tests__/date-picker-extended.test.mjs +0 -455
- package/dist/date-picker/__tests__/date-picker.ssr.test.cjs +0 -26
- package/dist/date-picker/__tests__/date-picker.ssr.test.mjs +0 -23
- package/dist/date-picker/__tests__/date-picker.test.cjs +0 -170
- package/dist/date-picker/__tests__/date-picker.test.mjs +0 -136
- package/dist/descriptions/__tests__/descriptions.ssr.test.cjs +0 -67
- package/dist/descriptions/__tests__/descriptions.ssr.test.mjs +0 -72
- package/dist/descriptions/__tests__/descriptions.test.cjs +0 -150
- package/dist/descriptions/__tests__/descriptions.test.mjs +0 -130
- package/dist/dialog/__tests__/dialog.functional.test.cjs +0 -49
- package/dist/dialog/__tests__/dialog.functional.test.mjs +0 -49
- package/dist/dialog/__tests__/dialog.ssr.test.cjs +0 -31
- package/dist/dialog/__tests__/dialog.ssr.test.mjs +0 -29
- package/dist/dialog/__tests__/dialog.test.cjs +0 -561
- package/dist/dialog/__tests__/dialog.test.mjs +0 -388
- package/dist/divider/__tests__/divider.ssr.test.cjs +0 -41
- package/dist/divider/__tests__/divider.ssr.test.mjs +0 -44
- package/dist/divider/__tests__/divider.test.cjs +0 -71
- package/dist/divider/__tests__/divider.test.mjs +0 -68
- package/dist/drawer/__tests__/drawer.ssr.test.cjs +0 -25
- package/dist/drawer/__tests__/drawer.ssr.test.mjs +0 -23
- package/dist/drawer/__tests__/drawer.test.cjs +0 -145
- package/dist/drawer/__tests__/drawer.test.mjs +0 -122
- package/dist/dropdown/__tests__/dropdown.ssr.test.cjs +0 -49
- package/dist/dropdown/__tests__/dropdown.ssr.test.mjs +0 -64
- package/dist/dropdown/__tests__/dropdown.test.cjs +0 -310
- package/dist/dropdown/__tests__/dropdown.test.mjs +0 -269
- package/dist/empty/__tests__/empty.ssr.test.cjs +0 -96
- package/dist/empty/__tests__/empty.ssr.test.mjs +0 -99
- package/dist/empty/__tests__/empty.test.cjs +0 -110
- package/dist/empty/__tests__/empty.test.mjs +0 -101
- package/dist/filter-bar/__tests__/filter-bar.ssr.test.cjs +0 -29
- package/dist/filter-bar/__tests__/filter-bar.ssr.test.mjs +0 -16
- package/dist/filter-bar/__tests__/filter-bar.test.cjs +0 -51
- package/dist/filter-bar/__tests__/filter-bar.test.mjs +0 -29
- package/dist/form/__tests__/form-schema.test.cjs +0 -636
- package/dist/form/__tests__/form-schema.test.mjs +0 -366
- package/dist/form/__tests__/form.ssr.test.cjs +0 -74
- package/dist/form/__tests__/form.ssr.test.mjs +0 -73
- package/dist/form/__tests__/form.test.cjs +0 -208
- package/dist/form/__tests__/form.test.mjs +0 -128
- package/dist/gantt-chart/__tests__/debug_ssr.test.cjs +0 -51
- package/dist/gantt-chart/__tests__/debug_ssr.test.mjs +0 -37
- package/dist/gantt-chart/__tests__/gantt-chart.ssr.test.cjs +0 -95
- package/dist/gantt-chart/__tests__/gantt-chart.ssr.test.mjs +0 -94
- package/dist/gantt-chart/__tests__/gantt-chart.test.cjs +0 -86
- package/dist/gantt-chart/__tests__/gantt-chart.test.mjs +0 -79
- package/dist/grid/__tests__/grid.ssr.test.cjs +0 -81
- package/dist/grid/__tests__/grid.ssr.test.mjs +0 -63
- package/dist/grid/__tests__/grid.test.cjs +0 -142
- package/dist/grid/__tests__/grid.test.mjs +0 -89
- package/dist/icon/__tests__/icon.ssr.test.cjs +0 -35
- package/dist/icon/__tests__/icon.ssr.test.mjs +0 -26
- package/dist/icon/__tests__/icon.test.cjs +0 -144
- package/dist/icon/__tests__/icon.test.mjs +0 -123
- package/dist/image/__tests__/image-viewer.test.cjs +0 -101
- package/dist/image/__tests__/image-viewer.test.mjs +0 -94
- package/dist/image/__tests__/image.ssr.test.cjs +0 -73
- package/dist/image/__tests__/image.ssr.test.mjs +0 -72
- package/dist/image/__tests__/image.test.cjs +0 -171
- package/dist/image/__tests__/image.test.mjs +0 -159
- package/dist/image-magnifier/__tests__/image-magnifier.ssr.test.cjs +0 -54
- package/dist/image-magnifier/__tests__/image-magnifier.ssr.test.mjs +0 -35
- package/dist/image-magnifier/__tests__/image-magnifier.test.cjs +0 -257
- package/dist/image-magnifier/__tests__/image-magnifier.test.mjs +0 -177
- package/dist/infinite-scroll/__tests__/infinite-scroll.ssr.test.cjs +0 -59
- package/dist/infinite-scroll/__tests__/infinite-scroll.ssr.test.mjs +0 -84
- package/dist/infinite-scroll/__tests__/infinite-scroll.test.cjs +0 -255
- package/dist/infinite-scroll/__tests__/infinite-scroll.test.mjs +0 -187
- package/dist/input/__tests__/input-utils.test.cjs +0 -77
- package/dist/input/__tests__/input-utils.test.mjs +0 -75
- package/dist/input/__tests__/input.ssr.test.cjs +0 -100
- package/dist/input/__tests__/input.ssr.test.mjs +0 -85
- package/dist/input/__tests__/input.test.cjs +0 -127
- package/dist/input/__tests__/input.test.mjs +0 -112
- package/dist/input-number/__tests__/input-number.hydration.test.cjs +0 -24
- package/dist/input-number/__tests__/input-number.hydration.test.mjs +0 -21
- package/dist/input-number/__tests__/input-number.ssr.test.cjs +0 -95
- package/dist/input-number/__tests__/input-number.ssr.test.mjs +0 -92
- package/dist/input-number/__tests__/input-number.test.cjs +0 -199
- package/dist/input-number/__tests__/input-number.test.mjs +0 -173
- package/dist/input-tag/__tests__/input-tag.ssr.test.cjs +0 -47
- package/dist/input-tag/__tests__/input-tag.ssr.test.mjs +0 -41
- package/dist/input-tag/__tests__/input-tag.test.cjs +0 -268
- package/dist/input-tag/__tests__/input-tag.test.mjs +0 -201
- package/dist/loading/__tests__/loading.ssr.test.cjs +0 -37
- package/dist/loading/__tests__/loading.ssr.test.mjs +0 -27
- package/dist/loading/__tests__/loading.test.cjs +0 -91
- package/dist/loading/__tests__/loading.test.mjs +0 -75
- package/dist/lucky-draw/__tests__/lucky-draw.ssr.test.cjs +0 -33
- package/dist/lucky-draw/__tests__/lucky-draw.ssr.test.mjs +0 -31
- package/dist/lucky-draw/__tests__/lucky-draw.test.cjs +0 -56
- package/dist/lucky-draw/__tests__/lucky-draw.test.mjs +0 -48
- package/dist/marquee/__tests__/marquee.ssr.test.cjs +0 -59
- package/dist/marquee/__tests__/marquee.ssr.test.mjs +0 -60
- package/dist/marquee/__tests__/marquee.test.cjs +0 -94
- package/dist/marquee/__tests__/marquee.test.mjs +0 -92
- package/dist/mention/__tests__/mention.ssr.test.cjs +0 -92
- package/dist/mention/__tests__/mention.ssr.test.mjs +0 -70
- package/dist/mention/__tests__/mention.test.cjs +0 -650
- package/dist/mention/__tests__/mention.test.mjs +0 -523
- package/dist/menu/__tests__/menu.ssr.test.cjs +0 -92
- package/dist/menu/__tests__/menu.ssr.test.mjs +0 -124
- package/dist/menu/__tests__/menu.test.cjs +0 -209
- package/dist/menu/__tests__/menu.test.mjs +0 -182
- package/dist/message/__tests__/message.ssr.test.cjs +0 -29
- package/dist/message/__tests__/message.ssr.test.mjs +0 -23
- package/dist/message/__tests__/message.test.cjs +0 -170
- package/dist/message/__tests__/message.test.mjs +0 -154
- package/dist/message-box/__tests__/message-box.ssr.test.cjs +0 -33
- package/dist/message-box/__tests__/message-box.ssr.test.mjs +0 -30
- package/dist/message-box/__tests__/message-box.test.cjs +0 -100
- package/dist/message-box/__tests__/message-box.test.mjs +0 -95
- package/dist/notification/__tests__/notification.ssr.test.cjs +0 -31
- package/dist/notification/__tests__/notification.ssr.test.mjs +0 -25
- package/dist/notification/__tests__/notification.test.cjs +0 -248
- package/dist/notification/__tests__/notification.test.mjs +0 -206
- package/dist/pagination/__tests__/pagination.ssr.test.cjs +0 -61
- package/dist/pagination/__tests__/pagination.ssr.test.mjs +0 -59
- package/dist/pagination/__tests__/pagination.test.cjs +0 -135
- package/dist/pagination/__tests__/pagination.test.mjs +0 -131
- package/dist/popconfirm/__tests__/popconfirm.ssr.test.cjs +0 -48
- package/dist/popconfirm/__tests__/popconfirm.ssr.test.mjs +0 -63
- package/dist/popconfirm/__tests__/popconfirm.test.cjs +0 -62
- package/dist/popconfirm/__tests__/popconfirm.test.mjs +0 -56
- package/dist/popover/__tests__/popover.ssr.test.cjs +0 -48
- package/dist/popover/__tests__/popover.ssr.test.mjs +0 -63
- package/dist/popover/__tests__/popover.test.cjs +0 -107
- package/dist/popover/__tests__/popover.test.mjs +0 -93
- package/dist/price/__tests__/price.ssr.test.cjs +0 -20
- package/dist/price/__tests__/price.ssr.test.mjs +0 -19
- package/dist/price/__tests__/price.test.cjs +0 -45
- package/dist/price/__tests__/price.test.mjs +0 -42
- package/dist/product-card/__tests__/product-card.ssr.test.cjs +0 -21
- package/dist/product-card/__tests__/product-card.ssr.test.mjs +0 -18
- package/dist/product-card/__tests__/product-card.test.cjs +0 -54
- package/dist/product-card/__tests__/product-card.test.mjs +0 -53
- package/dist/progress/__tests__/progress.ssr.test.cjs +0 -31
- package/dist/progress/__tests__/progress.ssr.test.mjs +0 -29
- package/dist/progress/__tests__/progress.test.cjs +0 -119
- package/dist/progress/__tests__/progress.test.mjs +0 -77
- package/dist/radio/__tests__/radio-button.test.cjs +0 -99
- package/dist/radio/__tests__/radio-button.test.mjs +0 -83
- package/dist/radio/__tests__/radio.ssr.test.cjs +0 -132
- package/dist/radio/__tests__/radio.ssr.test.mjs +0 -165
- package/dist/radio/__tests__/radio.test.cjs +0 -170
- package/dist/radio/__tests__/radio.test.mjs +0 -143
- package/dist/rate/__tests__/rate.ssr.test.cjs +0 -106
- package/dist/rate/__tests__/rate.ssr.test.mjs +0 -103
- package/dist/rate/__tests__/rate.test.cjs +0 -88
- package/dist/rate/__tests__/rate.test.mjs +0 -85
- package/dist/result/__tests__/result.ssr.test.cjs +0 -62
- package/dist/result/__tests__/result.ssr.test.mjs +0 -51
- package/dist/result/__tests__/result.test.cjs +0 -135
- package/dist/result/__tests__/result.test.mjs +0 -92
- package/dist/row/__tests__/row.ssr.test.cjs +0 -29
- package/dist/row/__tests__/row.ssr.test.mjs +0 -30
- package/dist/row/__tests__/row.test.cjs +0 -89
- package/dist/row/__tests__/row.test.mjs +0 -86
- package/dist/row/__tests__/row_ts.test.cjs +0 -31
- package/dist/row/__tests__/row_ts.test.mjs +0 -28
- package/dist/scrollbar/__tests__/scrollbar.ssr.test.cjs +0 -49
- package/dist/scrollbar/__tests__/scrollbar.ssr.test.mjs +0 -54
- package/dist/scrollbar/__tests__/scrollbar.test.cjs +0 -43
- package/dist/scrollbar/__tests__/scrollbar.test.mjs +0 -40
- package/dist/select/__tests__/select.perf.test.cjs +0 -191
- package/dist/select/__tests__/select.perf.test.mjs +0 -185
- package/dist/select/__tests__/select.ssr.test.cjs +0 -58
- package/dist/select/__tests__/select.ssr.test.mjs +0 -52
- package/dist/select/__tests__/select.test.cjs +0 -414
- package/dist/select/__tests__/select.test.mjs +0 -345
- package/dist/skeleton/__tests__/skeleton.ssr.test.cjs +0 -81
- package/dist/skeleton/__tests__/skeleton.ssr.test.mjs +0 -83
- package/dist/skeleton/__tests__/skeleton.test.cjs +0 -72
- package/dist/skeleton/__tests__/skeleton.test.mjs +0 -65
- package/dist/sku-selector/__tests__/sku-selector.ssr.test.cjs +0 -32
- package/dist/sku-selector/__tests__/sku-selector.ssr.test.mjs +0 -19
- package/dist/sku-selector/__tests__/sku-selector.test.cjs +0 -64
- package/dist/sku-selector/__tests__/sku-selector.test.mjs +0 -53
- package/dist/slider/__tests__/repro.test.cjs +0 -25
- package/dist/slider/__tests__/repro.test.mjs +0 -22
- package/dist/slider/__tests__/slider.ssr.test.cjs +0 -118
- package/dist/slider/__tests__/slider.ssr.test.mjs +0 -115
- package/dist/slider/__tests__/slider.test.cjs +0 -155
- package/dist/slider/__tests__/slider.test.mjs +0 -120
- package/dist/smart-address/__tests__/smart-address.ssr.test.cjs +0 -28
- package/dist/smart-address/__tests__/smart-address.ssr.test.mjs +0 -25
- package/dist/smart-address/__tests__/smart-address.test.cjs +0 -68
- package/dist/smart-address/__tests__/smart-address.test.mjs +0 -56
- package/dist/space/__tests__/space.ssr.test.cjs +0 -115
- package/dist/space/__tests__/space.ssr.test.mjs +0 -150
- package/dist/space/__tests__/space.test.cjs +0 -227
- package/dist/space/__tests__/space.test.mjs +0 -187
- package/dist/spin/__tests__/spin.ssr.test.cjs +0 -46
- package/dist/spin/__tests__/spin.ssr.test.mjs +0 -43
- package/dist/spin/__tests__/spin.test.cjs +0 -65
- package/dist/spin/__tests__/spin.test.mjs +0 -63
- package/dist/steps/__tests__/steps.ssr.test.cjs +0 -73
- package/dist/steps/__tests__/steps.ssr.test.mjs +0 -55
- package/dist/steps/__tests__/steps.test.cjs +0 -152
- package/dist/steps/__tests__/steps.test.mjs +0 -123
- package/dist/submit-bar/__tests__/submit-bar.ssr.test.cjs +0 -21
- package/dist/submit-bar/__tests__/submit-bar.ssr.test.mjs +0 -18
- package/dist/submit-bar/__tests__/submit-bar.test.cjs +0 -50
- package/dist/submit-bar/__tests__/submit-bar.test.mjs +0 -36
- package/dist/switch/__tests__/switch.ssr.test.cjs +0 -105
- package/dist/switch/__tests__/switch.ssr.test.mjs +0 -102
- package/dist/switch/__tests__/switch.test.cjs +0 -251
- package/dist/switch/__tests__/switch.test.mjs +0 -193
- package/dist/table/__tests__/table-advance.test.cjs +0 -180
- package/dist/table/__tests__/table-advance.test.mjs +0 -118
- package/dist/table/__tests__/table-interaction.test.cjs +0 -236
- package/dist/table/__tests__/table-interaction.test.mjs +0 -162
- package/dist/table/__tests__/table-utils.test.cjs +0 -690
- package/dist/table/__tests__/table-utils.test.mjs +0 -485
- package/dist/table/__tests__/table.perf.test.cjs +0 -231
- package/dist/table/__tests__/table.perf.test.mjs +0 -225
- package/dist/table/__tests__/table.ssr.test.cjs +0 -296
- package/dist/table/__tests__/table.ssr.test.mjs +0 -265
- package/dist/table/__tests__/table.test.cjs +0 -682
- package/dist/table/__tests__/table.test.mjs +0 -617
- package/dist/table/__tests__/use-column-drag.test.cjs +0 -238
- package/dist/table/__tests__/use-column-drag.test.mjs +0 -150
- package/dist/table/__tests__/use-table-export.test.cjs +0 -179
- package/dist/table/__tests__/use-table-export.test.mjs +0 -105
- package/dist/table/__tests__/use-table-import.test.cjs +0 -206
- package/dist/table/__tests__/use-table-import.test.mjs +0 -144
- package/dist/table/__tests__/use-table-print.test.cjs +0 -190
- package/dist/table/__tests__/use-table-print.test.mjs +0 -134
- package/dist/table/__tests__/use-virtual-scroll.test.cjs +0 -286
- package/dist/table/__tests__/use-virtual-scroll.test.mjs +0 -196
- package/dist/tabs/__tests__/tabs.ssr.test.cjs +0 -57
- package/dist/tabs/__tests__/tabs.ssr.test.mjs +0 -41
- package/dist/tabs/__tests__/tabs.test.cjs +0 -171
- package/dist/tabs/__tests__/tabs.test.mjs +0 -134
- package/dist/tag/__tests__/tag.ssr.test.cjs +0 -45
- package/dist/tag/__tests__/tag.ssr.test.mjs +0 -48
- package/dist/tag/__tests__/tag.test.cjs +0 -194
- package/dist/tag/__tests__/tag.test.mjs +0 -167
- package/dist/time-picker/__tests__/time-picker.ssr.test.cjs +0 -46
- package/dist/time-picker/__tests__/time-picker.ssr.test.mjs +0 -43
- package/dist/time-picker/__tests__/time-picker.test.cjs +0 -228
- package/dist/time-picker/__tests__/time-picker.test.mjs +0 -218
- package/dist/time-picker/__tests__/time-spinner.test.cjs +0 -196
- package/dist/time-picker/__tests__/time-spinner.test.mjs +0 -162
- package/dist/time-select/__tests__/time-select.ssr.test.cjs +0 -42
- package/dist/time-select/__tests__/time-select.ssr.test.mjs +0 -37
- package/dist/time-select/__tests__/time-select.test.cjs +0 -390
- package/dist/time-select/__tests__/time-select.test.mjs +0 -374
- package/dist/tooltip/__tests__/tooltip.ssr.test.cjs +0 -55
- package/dist/tooltip/__tests__/tooltip.ssr.test.mjs +0 -76
- package/dist/tooltip/__tests__/tooltip.test.cjs +0 -132
- package/dist/tooltip/__tests__/tooltip.test.mjs +0 -121
- package/dist/transfer/__tests__/transfer.ssr.test.cjs +0 -47
- package/dist/transfer/__tests__/transfer.ssr.test.mjs +0 -44
- package/dist/transfer/__tests__/transfer.test.cjs +0 -422
- package/dist/transfer/__tests__/transfer.test.mjs +0 -405
- package/dist/tree/__tests__/tree.perf.test.cjs +0 -182
- package/dist/tree/__tests__/tree.perf.test.mjs +0 -198
- package/dist/tree/__tests__/tree.ssr.test.cjs +0 -56
- package/dist/tree/__tests__/tree.ssr.test.mjs +0 -45
- package/dist/tree/__tests__/tree.test.cjs +0 -488
- package/dist/tree/__tests__/tree.test.mjs +0 -333
- package/dist/tree-select/__tests__/tree-select.ssr.test.cjs +0 -52
- package/dist/tree-select/__tests__/tree-select.ssr.test.mjs +0 -55
- package/dist/tree-select/__tests__/tree-select.test.cjs +0 -231
- package/dist/tree-select/__tests__/tree-select.test.mjs +0 -189
- package/dist/typography/__tests__/typography.ssr.test.cjs +0 -85
- package/dist/typography/__tests__/typography.ssr.test.mjs +0 -63
- package/dist/typography/__tests__/typography.test.cjs +0 -362
- package/dist/typography/__tests__/typography.test.mjs +0 -161
- package/dist/upload/__tests__/upload.ssr.test.cjs +0 -28
- package/dist/upload/__tests__/upload.ssr.test.mjs +0 -26
- package/dist/upload/__tests__/upload.test.cjs +0 -467
- package/dist/upload/__tests__/upload.test.mjs +0 -336
- package/dist/waterfall/__tests__/waterfall.ssr.test.cjs +0 -38
- package/dist/waterfall/__tests__/waterfall.ssr.test.mjs +0 -39
- package/dist/waterfall/__tests__/waterfall.test.cjs +0 -122
- package/dist/waterfall/__tests__/waterfall.test.mjs +0 -85
- package/dist/watermark/__tests__/watermark.ssr.test.cjs +0 -32
- package/dist/watermark/__tests__/watermark.ssr.test.mjs +0 -30
- package/dist/watermark/__tests__/watermark.test.cjs +0 -127
- package/dist/watermark/__tests__/watermark.test.mjs +0 -124
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import Title from "../src/title.vue";
|
|
4
|
-
import Text from "../src/text.vue";
|
|
5
|
-
import Paragraph from "../src/paragraph.vue";
|
|
6
|
-
import Link from "../src/link.vue";
|
|
7
|
-
describe("YhTypographyTitle", () => {
|
|
8
|
-
it("\u5E94\u8BE5\u6E32\u67D3\u6B63\u786E\u7684\u6807\u9898\u7EA7\u522B", () => {
|
|
9
|
-
const wrapper = mount(Title, { props: { level: 2 }, slots: { default: "\u6807\u9898" } });
|
|
10
|
-
expect(wrapper.find("h2").exists()).toBe(true);
|
|
11
|
-
expect(wrapper.text()).toBe("\u6807\u9898");
|
|
12
|
-
});
|
|
13
|
-
it("\u9ED8\u8BA4\u6E32\u67D3 h1", () => {
|
|
14
|
-
const wrapper = mount(Title, { slots: { default: "\u6807\u9898" } });
|
|
15
|
-
expect(wrapper.find("h1").exists()).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
it("\u5E94\u8BE5\u652F\u6301 h1-h6 \u5168\u90E8\u7EA7\u522B", () => {
|
|
18
|
-
for (let level = 1; level <= 6; level++) {
|
|
19
|
-
const wrapper = mount(Title, {
|
|
20
|
-
props: { level },
|
|
21
|
-
slots: { default: "T" }
|
|
22
|
-
});
|
|
23
|
-
expect(wrapper.find(`h${level}`).exists()).toBe(true);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
it("\u5E94\u8BE5\u652F\u6301 type \u7C7B\u578B", () => {
|
|
27
|
-
const wrapper = mount(Title, { props: { type: "danger" }, slots: { default: "\u9519\u8BEF" } });
|
|
28
|
-
expect(wrapper.find("h1").classes()).toContain("yh-typography__title--danger");
|
|
29
|
-
});
|
|
30
|
-
it("\u5E94\u8BE5\u652F\u6301 bold \u4FEE\u9970", () => {
|
|
31
|
-
const wrapper = mount(Title, { props: { bold: true }, slots: { default: "\u52A0\u7C97" } });
|
|
32
|
-
expect(wrapper.find("h1").classes()).toContain("is-bold");
|
|
33
|
-
});
|
|
34
|
-
it("\u5E94\u8BE5\u652F\u6301 delete \u4FEE\u9970", () => {
|
|
35
|
-
const wrapper = mount(Title, { props: { delete: true }, slots: { default: "\u5220\u9664" } });
|
|
36
|
-
expect(wrapper.find("h1").classes()).toContain("is-delete");
|
|
37
|
-
});
|
|
38
|
-
it("\u5E94\u8BE5\u652F\u6301 italic \u4FEE\u9970", () => {
|
|
39
|
-
const wrapper = mount(Title, { props: { italic: true }, slots: { default: "\u659C\u4F53" } });
|
|
40
|
-
expect(wrapper.find("h1").classes()).toContain("is-italic");
|
|
41
|
-
});
|
|
42
|
-
it("\u5E94\u8BE5\u652F\u6301 mark \u6807\u8BB0", () => {
|
|
43
|
-
const wrapper = mount(Title, { props: { mark: true }, slots: { default: "\u6807\u8BB0" } });
|
|
44
|
-
expect(wrapper.find("mark").exists()).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
it("\u5E94\u8BE5\u652F\u6301 code \u4EE3\u7801", () => {
|
|
47
|
-
const wrapper = mount(Title, { props: { code: true }, slots: { default: "\u4EE3\u7801" } });
|
|
48
|
-
expect(wrapper.find("code").exists()).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
it("\u5E94\u8BE5\u652F\u6301 ellipsis \u7701\u7565", () => {
|
|
51
|
-
const wrapper = mount(Title, { props: { ellipsis: true }, slots: { default: "\u7701\u7565" } });
|
|
52
|
-
expect(wrapper.find("h1").classes()).toContain("is-ellipsis");
|
|
53
|
-
});
|
|
54
|
-
it("\u5E94\u8BE5\u652F\u6301\u81EA\u5B9A\u4E49 tag", () => {
|
|
55
|
-
const wrapper = mount(Title, { props: { tag: "div" }, slots: { default: "\u81EA\u5B9A\u4E49" } });
|
|
56
|
-
expect(wrapper.find("div").exists()).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe("YhTypographyText", () => {
|
|
60
|
-
it("\u5E94\u8BE5\u9ED8\u8BA4\u6E32\u67D3 span", () => {
|
|
61
|
-
const wrapper = mount(Text, { slots: { default: "\u6587\u672C" } });
|
|
62
|
-
expect(wrapper.find("span").exists()).toBe(true);
|
|
63
|
-
expect(wrapper.text()).toBe("\u6587\u672C");
|
|
64
|
-
});
|
|
65
|
-
it("\u5E94\u8BE5\u652F\u6301 type", () => {
|
|
66
|
-
const wrapper = mount(Text, { props: { type: "success" }, slots: { default: "\u6210\u529F" } });
|
|
67
|
-
expect(wrapper.find("span").classes()).toContain("yh-typography__text--success");
|
|
68
|
-
});
|
|
69
|
-
it("\u5E94\u8BE5\u652F\u6301 size", () => {
|
|
70
|
-
const wrapper = mount(Text, { props: { size: "large" }, slots: { default: "\u5927\u53F7" } });
|
|
71
|
-
expect(wrapper.find("span").classes()).toContain("yh-typography__text--large");
|
|
72
|
-
});
|
|
73
|
-
it("\u5E94\u8BE5\u652F\u6301 keyboard \u6837\u5F0F", () => {
|
|
74
|
-
const wrapper = mount(Text, { props: { keyboard: true }, slots: { default: "Ctrl" } });
|
|
75
|
-
expect(wrapper.find("kbd").exists()).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
it("\u5E94\u8BE5\u652F\u6301 bold \u4FEE\u9970", () => {
|
|
78
|
-
const wrapper = mount(Text, { props: { bold: true }, slots: { default: "\u52A0\u7C97" } });
|
|
79
|
-
expect(wrapper.find("span").classes()).toContain("is-bold");
|
|
80
|
-
});
|
|
81
|
-
it("\u5E94\u8BE5\u652F\u6301 mark \u6807\u8BB0", () => {
|
|
82
|
-
const wrapper = mount(Text, { props: { mark: true }, slots: { default: "\u6807\u8BB0" } });
|
|
83
|
-
expect(wrapper.find("mark").exists()).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
it("\u5E94\u8BE5\u652F\u6301\u81EA\u5B9A\u4E49 tag", () => {
|
|
86
|
-
const wrapper = mount(Text, { props: { tag: "strong" }, slots: { default: "\u5F3A\u8C03" } });
|
|
87
|
-
expect(wrapper.find("strong").exists()).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe("YhTypographyParagraph", () => {
|
|
91
|
-
it("\u5E94\u8BE5\u6E32\u67D3 p \u6807\u7B7E", () => {
|
|
92
|
-
const wrapper = mount(Paragraph, { slots: { default: "\u6BB5\u843D" } });
|
|
93
|
-
expect(wrapper.find("p").exists()).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
it("\u5E94\u8BE5\u652F\u6301 type", () => {
|
|
96
|
-
const wrapper = mount(Paragraph, { props: { type: "warning" }, slots: { default: "\u8B66\u544A" } });
|
|
97
|
-
expect(wrapper.find("p").classes()).toContain("yh-typography__paragraph--warning");
|
|
98
|
-
});
|
|
99
|
-
it("\u5E94\u8BE5\u652F\u6301 align", () => {
|
|
100
|
-
const wrapper = mount(Paragraph, { props: { align: "center" }, slots: { default: "\u5C45\u4E2D" } });
|
|
101
|
-
expect(wrapper.find("p").classes()).toContain("yh-typography__paragraph--center");
|
|
102
|
-
});
|
|
103
|
-
it("\u5E94\u8BE5\u652F\u6301 spacing", () => {
|
|
104
|
-
const wrapper = mount(Paragraph, { props: { spacing: "compact" }, slots: { default: "\u7D27\u51D1" } });
|
|
105
|
-
expect(wrapper.find("p").classes()).toContain("yh-typography__paragraph--compact");
|
|
106
|
-
});
|
|
107
|
-
it("\u5E94\u8BE5\u652F\u6301 mark \u6807\u8BB0", () => {
|
|
108
|
-
const wrapper = mount(Paragraph, { props: { mark: true }, slots: { default: "\u9AD8\u4EAE" } });
|
|
109
|
-
expect(wrapper.find("mark").exists()).toBe(true);
|
|
110
|
-
});
|
|
111
|
-
it("\u5E94\u8BE5\u652F\u6301\u591A\u884C\u7701\u7565 (number)", () => {
|
|
112
|
-
const wrapper = mount(Paragraph, { props: { ellipsis: 3 }, slots: { default: "\u591A\u884C\u7701\u7565" } });
|
|
113
|
-
const style = wrapper.find("p").attributes("style") || "";
|
|
114
|
-
expect(style).toContain("overflow: hidden");
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
describe("YhTypographyLink", () => {
|
|
118
|
-
it("\u5E94\u8BE5\u6E32\u67D3 a \u6807\u7B7E", () => {
|
|
119
|
-
const wrapper = mount(Link, {
|
|
120
|
-
props: { href: "https://example.com" },
|
|
121
|
-
slots: { default: "\u94FE\u63A5" }
|
|
122
|
-
});
|
|
123
|
-
expect(wrapper.find("a").exists()).toBe(true);
|
|
124
|
-
expect(wrapper.find("a").attributes("href")).toBe("https://example.com");
|
|
125
|
-
});
|
|
126
|
-
it("\u5E94\u8BE5\u652F\u6301 target", () => {
|
|
127
|
-
const wrapper = mount(Link, {
|
|
128
|
-
props: { href: "#", target: "_blank" },
|
|
129
|
-
slots: { default: "\u65B0\u7A97\u53E3" }
|
|
130
|
-
});
|
|
131
|
-
expect(wrapper.find("a").attributes("target")).toBe("_blank");
|
|
132
|
-
});
|
|
133
|
-
it("\u5E94\u8BE5\u652F\u6301 underline", () => {
|
|
134
|
-
const wrapper = mount(Link, { props: { underline: true }, slots: { default: "\u4E0B\u5212\u7EBF" } });
|
|
135
|
-
expect(wrapper.find("a").classes()).toContain("is-underline");
|
|
136
|
-
});
|
|
137
|
-
it("\u5E94\u8BE5\u652F\u6301 disabled", () => {
|
|
138
|
-
const wrapper = mount(Link, {
|
|
139
|
-
props: { href: "#", disabled: true },
|
|
140
|
-
slots: { default: "\u7981\u7528" }
|
|
141
|
-
});
|
|
142
|
-
expect(wrapper.find("a").classes()).toContain("is-disabled");
|
|
143
|
-
expect(wrapper.find("a").attributes("href")).toBeUndefined();
|
|
144
|
-
expect(wrapper.find("a").attributes("aria-disabled")).toBe("true");
|
|
145
|
-
expect(wrapper.find("a").attributes("tabindex")).toBe("-1");
|
|
146
|
-
});
|
|
147
|
-
it("\u5E94\u8BE5\u652F\u6301 type", () => {
|
|
148
|
-
const wrapper = mount(Link, { props: { type: "danger" }, slots: { default: "\u5371\u9669" } });
|
|
149
|
-
expect(wrapper.find("a").classes()).toContain("yh-typography__link--danger");
|
|
150
|
-
});
|
|
151
|
-
it("\u7981\u7528\u65F6\u70B9\u51FB\u4E0D\u89E6\u53D1\u4E8B\u4EF6", async () => {
|
|
152
|
-
const wrapper = mount(Link, { props: { disabled: true }, slots: { default: "\u7981\u7528" } });
|
|
153
|
-
await wrapper.find("a").trigger("click");
|
|
154
|
-
expect(wrapper.emitted("click")).toBeFalsy();
|
|
155
|
-
});
|
|
156
|
-
it("\u542F\u7528\u65F6\u70B9\u51FB\u5E94\u89E6\u53D1\u4E8B\u4EF6", async () => {
|
|
157
|
-
const wrapper = mount(Link, { props: { href: "#" }, slots: { default: "\u94FE\u63A5" } });
|
|
158
|
-
await wrapper.find("a").trigger("click");
|
|
159
|
-
expect(wrapper.emitted("click")).toBeTruthy();
|
|
160
|
-
});
|
|
161
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _serverRenderer = require("@vue/server-renderer");
|
|
5
|
-
var _testUtils = require("@vue/test-utils");
|
|
6
|
-
var _index = require("../index.cjs");
|
|
7
|
-
(0, _vitest.describe)("Upload SSR", () => {
|
|
8
|
-
(0, _vitest.it)("should render correctly on server", async () => {
|
|
9
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
10
|
-
props: {
|
|
11
|
-
action: "http://localhost/upload"
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const html = await (0, _serverRenderer.renderToString)(wrapper.vm.$.vnode);
|
|
15
|
-
(0, _vitest.expect)(html).toContain("yh-upload");
|
|
16
|
-
(0, _vitest.expect)(html).toContain('type="file"');
|
|
17
|
-
});
|
|
18
|
-
(0, _vitest.it)("should render picture-card mode correctly on server", async () => {
|
|
19
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
20
|
-
props: {
|
|
21
|
-
action: "#",
|
|
22
|
-
listType: "picture-card"
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const html = await (0, _serverRenderer.renderToString)(wrapper.vm.$.vnode);
|
|
26
|
-
(0, _vitest.expect)(html).toContain("yh-upload--picture-card");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { renderToString } from "@vue/server-renderer";
|
|
3
|
-
import { mount } from "@vue/test-utils";
|
|
4
|
-
import { YhUpload } from "../index.mjs";
|
|
5
|
-
describe("Upload SSR", () => {
|
|
6
|
-
it("should render correctly on server", async () => {
|
|
7
|
-
const wrapper = mount(YhUpload, {
|
|
8
|
-
props: {
|
|
9
|
-
action: "http://localhost/upload"
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const html = await renderToString(wrapper.vm.$.vnode);
|
|
13
|
-
expect(html).toContain("yh-upload");
|
|
14
|
-
expect(html).toContain('type="file"');
|
|
15
|
-
});
|
|
16
|
-
it("should render picture-card mode correctly on server", async () => {
|
|
17
|
-
const wrapper = mount(YhUpload, {
|
|
18
|
-
props: {
|
|
19
|
-
action: "#",
|
|
20
|
-
listType: "picture-card"
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const html = await renderToString(wrapper.vm.$.vnode);
|
|
24
|
-
expect(html).toContain("yh-upload--picture-card");
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _testUtils = require("@vue/test-utils");
|
|
4
|
-
var _vitest = require("vitest");
|
|
5
|
-
var _index = require("../index.cjs");
|
|
6
|
-
var _vue = require("vue");
|
|
7
|
-
global.URL.createObjectURL = _vitest.vi.fn(() => "blob:test-url");
|
|
8
|
-
global.URL.revokeObjectURL = _vitest.vi.fn();
|
|
9
|
-
(0, _vitest.describe)("Upload", () => {
|
|
10
|
-
(0, _vitest.beforeEach)(() => {
|
|
11
|
-
_vitest.vi.clearAllMocks();
|
|
12
|
-
const xhrMock = {
|
|
13
|
-
open: _vitest.vi.fn(),
|
|
14
|
-
send: _vitest.vi.fn(),
|
|
15
|
-
setRequestHeader: _vitest.vi.fn(),
|
|
16
|
-
upload: {
|
|
17
|
-
onprogress: null
|
|
18
|
-
},
|
|
19
|
-
readyState: 4,
|
|
20
|
-
status: 200,
|
|
21
|
-
responseText: '{"status":"success"}',
|
|
22
|
-
onload: null,
|
|
23
|
-
onerror: null
|
|
24
|
-
};
|
|
25
|
-
function MockXHR() {
|
|
26
|
-
return xhrMock;
|
|
27
|
-
}
|
|
28
|
-
_vitest.vi.stubGlobal("XMLHttpRequest", MockXHR);
|
|
29
|
-
});
|
|
30
|
-
(0, _vitest.afterEach)(() => {
|
|
31
|
-
_vitest.vi.unstubAllGlobals();
|
|
32
|
-
});
|
|
33
|
-
(0, _vitest.it)("render test", () => {
|
|
34
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
35
|
-
props: {
|
|
36
|
-
fileList: []
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
(0, _vitest.expect)(wrapper.find(".yh-upload").exists()).toBe(true);
|
|
40
|
-
(0, _vitest.expect)(wrapper.find('input[type="file"]').exists()).toBe(true);
|
|
41
|
-
});
|
|
42
|
-
(0, _vitest.it)("trigger input click when trigger area clicked", async () => {
|
|
43
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload);
|
|
44
|
-
const input = wrapper.find('input[type="file"]').element;
|
|
45
|
-
const spy = _vitest.vi.spyOn(input, "click");
|
|
46
|
-
await wrapper.find(".yh-upload__trigger").trigger("click");
|
|
47
|
-
(0, _vitest.expect)(spy).toHaveBeenCalled();
|
|
48
|
-
});
|
|
49
|
-
(0, _vitest.it)("handle file change and auto upload", async () => {
|
|
50
|
-
const file = new File(["test content"], "test.png", {
|
|
51
|
-
type: "image/png"
|
|
52
|
-
});
|
|
53
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
54
|
-
props: {
|
|
55
|
-
fileList: [],
|
|
56
|
-
autoUpload: true,
|
|
57
|
-
action: "/upload"
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const input = wrapper.find('input[type="file"]');
|
|
61
|
-
Object.defineProperty(input.element, "files", {
|
|
62
|
-
value: [file]
|
|
63
|
-
});
|
|
64
|
-
await input.trigger("change");
|
|
65
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeTruthy();
|
|
66
|
-
});
|
|
67
|
-
(0, _vitest.it)("validate file with accept prop", async () => {
|
|
68
|
-
const warnSpy = _vitest.vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
69
|
-
const file = new File(["test"], "test.txt", {
|
|
70
|
-
type: "text/plain"
|
|
71
|
-
});
|
|
72
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
73
|
-
props: {
|
|
74
|
-
fileList: [],
|
|
75
|
-
accept: "image/*"
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const input = wrapper.find('input[type="file"]');
|
|
79
|
-
Object.defineProperty(input.element, "files", {
|
|
80
|
-
value: [file]
|
|
81
|
-
});
|
|
82
|
-
await input.trigger("change");
|
|
83
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
84
|
-
warnSpy.mockRestore();
|
|
85
|
-
});
|
|
86
|
-
(0, _vitest.it)("validate file size with maxSize prop", async () => {
|
|
87
|
-
const warnSpy = _vitest.vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
88
|
-
const file = new File(["test content"], "big.png", {
|
|
89
|
-
type: "image/png"
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(file, "size", {
|
|
92
|
-
value: 2e6,
|
|
93
|
-
configurable: true
|
|
94
|
-
});
|
|
95
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
96
|
-
props: {
|
|
97
|
-
fileList: [],
|
|
98
|
-
maxSize: 1024
|
|
99
|
-
// 1MB limit
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const input = wrapper.find('input[type="file"]');
|
|
103
|
-
Object.defineProperty(input.element, "files", {
|
|
104
|
-
value: [file]
|
|
105
|
-
});
|
|
106
|
-
await input.trigger("change");
|
|
107
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
108
|
-
warnSpy.mockRestore();
|
|
109
|
-
});
|
|
110
|
-
(0, _vitest.it)("handle limit and exceed event", async () => {
|
|
111
|
-
const file1 = new File(["1"], "1.png", {
|
|
112
|
-
type: "image/png"
|
|
113
|
-
});
|
|
114
|
-
const file2 = new File(["2"], "2.png", {
|
|
115
|
-
type: "image/png"
|
|
116
|
-
});
|
|
117
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
118
|
-
props: {
|
|
119
|
-
fileList: [{
|
|
120
|
-
name: "existing.png",
|
|
121
|
-
uid: 99,
|
|
122
|
-
status: "success"
|
|
123
|
-
}],
|
|
124
|
-
limit: 2
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
const input = wrapper.find('input[type="file"]');
|
|
128
|
-
Object.defineProperty(input.element, "files", {
|
|
129
|
-
value: [file1, file2]
|
|
130
|
-
});
|
|
131
|
-
await input.trigger("change");
|
|
132
|
-
(0, _vitest.expect)(wrapper.emitted("exceed")).toBeTruthy();
|
|
133
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
134
|
-
});
|
|
135
|
-
(0, _vitest.it)("beforeUpload returning false should cancel upload", async () => {
|
|
136
|
-
const file = new File(["test"], "test.png", {
|
|
137
|
-
type: "image/png"
|
|
138
|
-
});
|
|
139
|
-
const beforeUpload = _vitest.vi.fn().mockReturnValue(false);
|
|
140
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
141
|
-
props: {
|
|
142
|
-
fileList: [],
|
|
143
|
-
beforeUpload
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
const input = wrapper.find('input[type="file"]');
|
|
147
|
-
Object.defineProperty(input.element, "files", {
|
|
148
|
-
value: [file]
|
|
149
|
-
});
|
|
150
|
-
await input.trigger("change");
|
|
151
|
-
await (0, _vue.nextTick)();
|
|
152
|
-
(0, _vitest.expect)(beforeUpload).toHaveBeenCalled();
|
|
153
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
154
|
-
});
|
|
155
|
-
(0, _vitest.it)("beforeUpload throwing error should cancel upload", async () => {
|
|
156
|
-
const file = new File(["test"], "test.png", {
|
|
157
|
-
type: "image/png"
|
|
158
|
-
});
|
|
159
|
-
const beforeUpload = _vitest.vi.fn().mockRejectedValue(new Error("error"));
|
|
160
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
161
|
-
props: {
|
|
162
|
-
fileList: [],
|
|
163
|
-
beforeUpload
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
const input = wrapper.find('input[type="file"]');
|
|
167
|
-
Object.defineProperty(input.element, "files", {
|
|
168
|
-
value: [file]
|
|
169
|
-
});
|
|
170
|
-
await input.trigger("change");
|
|
171
|
-
await (0, _vue.nextTick)();
|
|
172
|
-
await (0, _vue.nextTick)();
|
|
173
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
174
|
-
});
|
|
175
|
-
(0, _vitest.it)("beforeUpload can transform files", async () => {
|
|
176
|
-
const file = new File(["test"], "test.png", {
|
|
177
|
-
type: "image/png"
|
|
178
|
-
});
|
|
179
|
-
const newBlob = new Blob(["transformed-content"], {
|
|
180
|
-
type: "image/png"
|
|
181
|
-
});
|
|
182
|
-
const beforeUpload = _vitest.vi.fn().mockResolvedValue(newBlob);
|
|
183
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
184
|
-
props: {
|
|
185
|
-
fileList: [],
|
|
186
|
-
beforeUpload,
|
|
187
|
-
action: "/upload"
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
const input = wrapper.find('input[type="file"]');
|
|
191
|
-
Object.defineProperty(input.element, "files", {
|
|
192
|
-
value: [file]
|
|
193
|
-
});
|
|
194
|
-
await input.trigger("change");
|
|
195
|
-
await (0, _vue.nextTick)();
|
|
196
|
-
await (0, _vue.nextTick)();
|
|
197
|
-
await (0, _vue.nextTick)();
|
|
198
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeTruthy();
|
|
199
|
-
const emitted = wrapper.emitted("update:fileList")[0][0];
|
|
200
|
-
(0, _vitest.expect)(emitted[0].raw.size).toBe(newBlob.size);
|
|
201
|
-
});
|
|
202
|
-
(0, _vitest.it)("handle file removal with beforeRemove", async () => {
|
|
203
|
-
const file = {
|
|
204
|
-
name: "test.png",
|
|
205
|
-
uid: 1,
|
|
206
|
-
status: "success",
|
|
207
|
-
url: "blob:test"
|
|
208
|
-
};
|
|
209
|
-
const beforeRemove = _vitest.vi.fn().mockResolvedValue(false);
|
|
210
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
211
|
-
props: {
|
|
212
|
-
fileList: [file],
|
|
213
|
-
beforeRemove
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
await wrapper.find(".yh-upload__delete-btn").trigger("click");
|
|
217
|
-
(0, _vitest.expect)(beforeRemove).toHaveBeenCalled();
|
|
218
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeFalsy();
|
|
219
|
-
await wrapper.setProps({
|
|
220
|
-
beforeRemove: () => true
|
|
221
|
-
});
|
|
222
|
-
await wrapper.find(".yh-upload__delete-btn").trigger("click");
|
|
223
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeTruthy();
|
|
224
|
-
});
|
|
225
|
-
(0, _vitest.it)("picture-card actions work", async () => {
|
|
226
|
-
const file = {
|
|
227
|
-
name: "test.png",
|
|
228
|
-
uid: 1,
|
|
229
|
-
status: "success",
|
|
230
|
-
url: "blob:test"
|
|
231
|
-
};
|
|
232
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
233
|
-
props: {
|
|
234
|
-
fileList: [file],
|
|
235
|
-
listType: "picture-card",
|
|
236
|
-
showDownload: true
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
const actions = wrapper.find(".yh-upload__actions");
|
|
240
|
-
const actionIcons = actions.findAll("span");
|
|
241
|
-
await actionIcons[0].trigger("click");
|
|
242
|
-
(0, _vitest.expect)(wrapper.emitted("preview")).toBeTruthy();
|
|
243
|
-
await actionIcons[2].trigger("click");
|
|
244
|
-
(0, _vitest.expect)(wrapper.emitted("remove")).toBeTruthy();
|
|
245
|
-
});
|
|
246
|
-
(0, _vitest.it)("retry upload when status is fail", async () => {
|
|
247
|
-
const rawFile = new File(["fail"], "fail.png", {
|
|
248
|
-
type: "image/png"
|
|
249
|
-
});
|
|
250
|
-
const file = {
|
|
251
|
-
name: "fail.png",
|
|
252
|
-
uid: 123,
|
|
253
|
-
status: "fail",
|
|
254
|
-
raw: rawFile
|
|
255
|
-
};
|
|
256
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
257
|
-
props: {
|
|
258
|
-
fileList: [file],
|
|
259
|
-
action: "/upload",
|
|
260
|
-
autoUpload: false
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
const retryBtn = wrapper.find(".yh-upload__retry-btn");
|
|
264
|
-
await retryBtn.trigger("click");
|
|
265
|
-
(0, _vitest.expect)(file.status).toBe("uploading");
|
|
266
|
-
});
|
|
267
|
-
(0, _vitest.it)("drag and drop events", async () => {
|
|
268
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
269
|
-
props: {
|
|
270
|
-
drag: true
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
const dragger = wrapper.find(".yh-upload__dragger");
|
|
274
|
-
await dragger.trigger("dragover");
|
|
275
|
-
(0, _vitest.expect)(dragger.classes()).toContain("is-dragover");
|
|
276
|
-
const file = new File(["drag test"], "drag.png", {
|
|
277
|
-
type: "image/png"
|
|
278
|
-
});
|
|
279
|
-
const dropEvent = {
|
|
280
|
-
dataTransfer: {
|
|
281
|
-
items: [{
|
|
282
|
-
webkitGetAsEntry: () => ({
|
|
283
|
-
isFile: true,
|
|
284
|
-
isDirectory: false,
|
|
285
|
-
file: cb => cb(file)
|
|
286
|
-
})
|
|
287
|
-
}]
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
await dragger.trigger("drop", dropEvent);
|
|
291
|
-
await (0, _vue.nextTick)();
|
|
292
|
-
await (0, _vue.nextTick)();
|
|
293
|
-
await (0, _vue.nextTick)();
|
|
294
|
-
(0, _vitest.expect)(wrapper.emitted("update:fileList")).toBeTruthy();
|
|
295
|
-
});
|
|
296
|
-
(0, _vitest.it)("custom httpRequest support", async () => {
|
|
297
|
-
const file = new File(["test"], "test.png", {
|
|
298
|
-
type: "image/png"
|
|
299
|
-
});
|
|
300
|
-
const httpRequest = _vitest.vi.fn();
|
|
301
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
302
|
-
props: {
|
|
303
|
-
fileList: [],
|
|
304
|
-
httpRequest,
|
|
305
|
-
autoUpload: true,
|
|
306
|
-
action: "/upload"
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
const input = wrapper.find('input[type="file"]');
|
|
310
|
-
Object.defineProperty(input.element, "files", {
|
|
311
|
-
value: [file]
|
|
312
|
-
});
|
|
313
|
-
await input.trigger("change");
|
|
314
|
-
await (0, _vue.nextTick)();
|
|
315
|
-
await (0, _vue.nextTick)();
|
|
316
|
-
(0, _vitest.expect)(httpRequest).toHaveBeenCalled();
|
|
317
|
-
});
|
|
318
|
-
(0, _vitest.it)("custom fileIcon prop", async () => {
|
|
319
|
-
const file = {
|
|
320
|
-
name: "test.zip",
|
|
321
|
-
uid: 1,
|
|
322
|
-
status: "success"
|
|
323
|
-
};
|
|
324
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
325
|
-
props: {
|
|
326
|
-
fileList: [file],
|
|
327
|
-
fileIcon: "custom-icon"
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
const icon = wrapper.findComponent({
|
|
331
|
-
name: "YhIcon"
|
|
332
|
-
});
|
|
333
|
-
(0, _vitest.expect)(icon.props("name")).toBe("custom-icon");
|
|
334
|
-
});
|
|
335
|
-
(0, _vitest.it)("slots test", () => {
|
|
336
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
337
|
-
props: {
|
|
338
|
-
fileList: [{
|
|
339
|
-
name: "test.png",
|
|
340
|
-
uid: 1,
|
|
341
|
-
status: "success"
|
|
342
|
-
}]
|
|
343
|
-
},
|
|
344
|
-
slots: {
|
|
345
|
-
tip: '<div class="custom-tip">Help</div>'
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
(0, _vitest.expect)(wrapper.find(".custom-tip").text()).toBe("Help");
|
|
349
|
-
});
|
|
350
|
-
(0, _vitest.it)("expose methods", async () => {
|
|
351
|
-
const rawFile = new File(["ready"], "ready.png", {
|
|
352
|
-
type: "image/png"
|
|
353
|
-
});
|
|
354
|
-
const file = {
|
|
355
|
-
name: "ready.png",
|
|
356
|
-
uid: 1,
|
|
357
|
-
status: "ready",
|
|
358
|
-
raw: rawFile
|
|
359
|
-
};
|
|
360
|
-
const httpRequest = _vitest.vi.fn();
|
|
361
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
362
|
-
props: {
|
|
363
|
-
fileList: [file],
|
|
364
|
-
httpRequest,
|
|
365
|
-
autoUpload: false,
|
|
366
|
-
action: "/upload"
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
wrapper.vm.submit();
|
|
370
|
-
(0, _vitest.expect)(httpRequest).toHaveBeenCalled();
|
|
371
|
-
});
|
|
372
|
-
(0, _vitest.it)("handle upload progress and error", async () => {
|
|
373
|
-
let onProgressCb;
|
|
374
|
-
let onErrorCb;
|
|
375
|
-
let onSuccessCb;
|
|
376
|
-
const httpRequest = options => {
|
|
377
|
-
onProgressCb = options.onProgress;
|
|
378
|
-
onErrorCb = options.onError;
|
|
379
|
-
onSuccessCb = options.onSuccess;
|
|
380
|
-
};
|
|
381
|
-
const file = {
|
|
382
|
-
name: "test.png",
|
|
383
|
-
uid: 1,
|
|
384
|
-
status: "ready",
|
|
385
|
-
raw: new File([], "test.png")
|
|
386
|
-
};
|
|
387
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
388
|
-
props: {
|
|
389
|
-
fileList: [file],
|
|
390
|
-
httpRequest,
|
|
391
|
-
action: "/upload"
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
wrapper.vm.submit();
|
|
395
|
-
onProgressCb({
|
|
396
|
-
percent: 50
|
|
397
|
-
});
|
|
398
|
-
(0, _vitest.expect)(file.percentage).toBe(50);
|
|
399
|
-
(0, _vitest.expect)(wrapper.emitted("progress")).toBeTruthy();
|
|
400
|
-
onErrorCb(new Error("fail"));
|
|
401
|
-
(0, _vitest.expect)(file.status).toBe("fail");
|
|
402
|
-
(0, _vitest.expect)(wrapper.emitted("error")).toBeTruthy();
|
|
403
|
-
file.status = "ready";
|
|
404
|
-
wrapper.vm.submit();
|
|
405
|
-
onSuccessCb({
|
|
406
|
-
data: "ok"
|
|
407
|
-
});
|
|
408
|
-
(0, _vitest.expect)(file.status).toBe("success");
|
|
409
|
-
(0, _vitest.expect)(wrapper.emitted("success")).toBeTruthy();
|
|
410
|
-
});
|
|
411
|
-
(0, _vitest.it)("handle download", async () => {
|
|
412
|
-
const file = {
|
|
413
|
-
name: "test.png",
|
|
414
|
-
uid: 1,
|
|
415
|
-
status: "success",
|
|
416
|
-
url: "blob:test"
|
|
417
|
-
};
|
|
418
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
419
|
-
props: {
|
|
420
|
-
fileList: [file],
|
|
421
|
-
showDownload: true
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
const spy = _vitest.vi.spyOn(document, "createElement");
|
|
425
|
-
await wrapper.find(".yh-upload__download-btn").trigger("click");
|
|
426
|
-
(0, _vitest.expect)(wrapper.emitted("download")).toBeTruthy();
|
|
427
|
-
(0, _vitest.expect)(spy).toHaveBeenCalledWith("a");
|
|
428
|
-
});
|
|
429
|
-
(0, _vitest.it)("support thumbnailRequest", async () => {
|
|
430
|
-
const file = new File([""], "test.png", {
|
|
431
|
-
type: "image/png"
|
|
432
|
-
});
|
|
433
|
-
const thumbnailRequest = _vitest.vi.fn().mockResolvedValue("custom-thumb");
|
|
434
|
-
const wrapper = (0, _testUtils.mount)(_index.YhUpload, {
|
|
435
|
-
props: {
|
|
436
|
-
fileList: [],
|
|
437
|
-
listType: "picture",
|
|
438
|
-
thumbnailRequest
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
const input = wrapper.find('input[type="file"]');
|
|
442
|
-
Object.defineProperty(input.element, "files", {
|
|
443
|
-
value: [file]
|
|
444
|
-
});
|
|
445
|
-
await input.trigger("change");
|
|
446
|
-
await (0, _vue.nextTick)();
|
|
447
|
-
await (0, _vue.nextTick)();
|
|
448
|
-
await (0, _vue.nextTick)();
|
|
449
|
-
const emitted = wrapper.emitted("update:fileList")[0][0];
|
|
450
|
-
(0, _vitest.expect)(emitted[0].url).toBe("custom-thumb");
|
|
451
|
-
});
|
|
452
|
-
(0, _vitest.it)("support fileIcon as function", () => {
|
|
453
|
-
const file = {
|
|
454
|
-
name: "test.txt",
|
|
455
|
-
uid: 1,
|
|
456
|
-
status: "success"
|
|
457
|
-
};
|
|
458
|
-
const fileIcon = _vitest.vi.fn().mockReturnValue("func-icon");
|
|
459
|
-
(0, _testUtils.mount)(_index.YhUpload, {
|
|
460
|
-
props: {
|
|
461
|
-
fileList: [file],
|
|
462
|
-
fileIcon
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
(0, _vitest.expect)(fileIcon).toHaveBeenCalled();
|
|
466
|
-
});
|
|
467
|
-
});
|