@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,57 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from "vitest";
|
|
2
|
-
import { renderToString } from "@vue/server-renderer";
|
|
3
|
-
import { h } from "vue";
|
|
4
|
-
vi.mock("highlight.js", () => ({
|
|
5
|
-
default: {
|
|
6
|
-
getLanguage: (lang) => lang === "typescript",
|
|
7
|
-
highlight: vi.fn(() => ({ value: "highlighted" })),
|
|
8
|
-
highlightAuto: vi.fn(() => ({ value: "auto" }))
|
|
9
|
-
}
|
|
10
|
-
}));
|
|
11
|
-
vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
12
|
-
vi.mock("monaco-editor", () => {
|
|
13
|
-
return {
|
|
14
|
-
editor: {
|
|
15
|
-
create: vi.fn(),
|
|
16
|
-
setModelLanguage: vi.fn(),
|
|
17
|
-
setTheme: vi.fn()
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
const { default: AiCodeBlock } = await import("../src/ai-code-block.vue");
|
|
22
|
-
describe("YhAiCodeBlock SSR", () => {
|
|
23
|
-
it("should render to string on server", async () => {
|
|
24
|
-
const html = await renderToString(
|
|
25
|
-
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
26
|
-
);
|
|
27
|
-
expect(html).toContain("yh-ai-code-block");
|
|
28
|
-
});
|
|
29
|
-
it("should render filename in header on server", async () => {
|
|
30
|
-
const html = await renderToString(h(AiCodeBlock, { code: "const x = 1", filename: "utils.ts" }));
|
|
31
|
-
expect(html).toContain("utils.ts");
|
|
32
|
-
expect(html).toContain("yh-ai-code-block__lang");
|
|
33
|
-
});
|
|
34
|
-
it("should render language in header when no filename on server", async () => {
|
|
35
|
-
const html = await renderToString(
|
|
36
|
-
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
37
|
-
);
|
|
38
|
-
expect(html).toContain("typescript");
|
|
39
|
-
});
|
|
40
|
-
it("should render language class in code element on server", async () => {
|
|
41
|
-
const html = await renderToString(
|
|
42
|
-
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
43
|
-
);
|
|
44
|
-
expect(html).toContain("language-typescript");
|
|
45
|
-
});
|
|
46
|
-
it("should render code body on server", async () => {
|
|
47
|
-
const html = await renderToString(
|
|
48
|
-
h(AiCodeBlock, { code: "sample code", language: "text", highlight: false })
|
|
49
|
-
);
|
|
50
|
-
expect(html).toContain("sample code");
|
|
51
|
-
expect(html).toContain("yh-ai-code-block__body");
|
|
52
|
-
});
|
|
53
|
-
it("should render copy button on server", async () => {
|
|
54
|
-
const html = await renderToString(h(AiCodeBlock, { code: "code" }));
|
|
55
|
-
expect(html).toContain("yh-ai-code-block__actions");
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _testUtils = require("@vue/test-utils");
|
|
5
|
-
_vitest.vi.mock("highlight.js", () => ({
|
|
6
|
-
default: {
|
|
7
|
-
getLanguage: lang => lang === "typescript" || lang === "javascript" || lang === "python",
|
|
8
|
-
highlight: _vitest.vi.fn((_code, _opts) => ({
|
|
9
|
-
value: '<span class="hljs-keyword">const</span>'
|
|
10
|
-
})),
|
|
11
|
-
highlightAuto: _vitest.vi.fn(() => ({
|
|
12
|
-
value: "<span>auto</span>"
|
|
13
|
-
}))
|
|
14
|
-
}
|
|
15
|
-
}));
|
|
16
|
-
_vitest.vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
17
|
-
const {
|
|
18
|
-
default: AiCodeBlock
|
|
19
|
-
} = await Promise.resolve().then(() => require("../src/ai-code-block.vue"));
|
|
20
|
-
(0, _vitest.describe)("YhAiCodeBlock", () => {
|
|
21
|
-
(0, _vitest.beforeEach)(() => {
|
|
22
|
-
const mockClipboard = {
|
|
23
|
-
writeText: _vitest.vi.fn().mockResolvedValue(void 0)
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(navigator, "clipboard", {
|
|
26
|
-
value: mockClipboard,
|
|
27
|
-
writable: true,
|
|
28
|
-
configurable: true
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
(0, _vitest.it)("should render with base class", () => {
|
|
32
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
33
|
-
props: {
|
|
34
|
-
code: "const x = 1"
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block").exists()).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
(0, _vitest.it)("should render header and body", () => {
|
|
40
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
41
|
-
props: {
|
|
42
|
-
code: "const x = 1"
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__header").exists()).toBe(true);
|
|
46
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__body").exists()).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
(0, _vitest.it)("should show filename in lang label when filename provided", () => {
|
|
49
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
50
|
-
props: {
|
|
51
|
-
code: "const x = 1",
|
|
52
|
-
language: "typescript",
|
|
53
|
-
filename: "utils.ts"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("utils.ts");
|
|
57
|
-
});
|
|
58
|
-
(0, _vitest.it)("should show language in lang label when filename not provided", () => {
|
|
59
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
60
|
-
props: {
|
|
61
|
-
code: "const x = 1",
|
|
62
|
-
language: "typescript"
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("typescript");
|
|
66
|
-
});
|
|
67
|
-
(0, _vitest.it)("should show text as default language", () => {
|
|
68
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
69
|
-
props: {
|
|
70
|
-
code: "plain text"
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("text");
|
|
74
|
-
});
|
|
75
|
-
(0, _vitest.it)("should render code element with language class", () => {
|
|
76
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
77
|
-
props: {
|
|
78
|
-
code: "const x = 1",
|
|
79
|
-
language: "typescript"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const code = wrapper.find("code");
|
|
83
|
-
(0, _vitest.expect)(code.classes()).toContain("language-typescript");
|
|
84
|
-
});
|
|
85
|
-
(0, _vitest.it)("should render code content", () => {
|
|
86
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
87
|
-
props: {
|
|
88
|
-
code: "hello world",
|
|
89
|
-
language: "text",
|
|
90
|
-
highlight: false
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
(0, _vitest.expect)(wrapper.html()).toContain("hello world");
|
|
94
|
-
});
|
|
95
|
-
(0, _vitest.it)("should apply hljs class to code element", () => {
|
|
96
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
97
|
-
props: {
|
|
98
|
-
code: "const x = 1"
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
(0, _vitest.expect)(wrapper.find("code").classes()).toContain("hljs");
|
|
102
|
-
});
|
|
103
|
-
(0, _vitest.it)("should render highlighted code when highlight=true and language recognized", () => {
|
|
104
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
105
|
-
props: {
|
|
106
|
-
code: "const x = 1",
|
|
107
|
-
language: "typescript",
|
|
108
|
-
highlight: true
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
(0, _vitest.expect)(wrapper.find("code").html()).toContain("hljs-keyword");
|
|
112
|
-
});
|
|
113
|
-
(0, _vitest.it)("should render raw code when highlight=false", () => {
|
|
114
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
115
|
-
props: {
|
|
116
|
-
code: "raw code here",
|
|
117
|
-
language: "typescript",
|
|
118
|
-
highlight: false
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
(0, _vitest.expect)(wrapper.find("code").html()).toContain("raw code here");
|
|
122
|
-
});
|
|
123
|
-
(0, _vitest.it)("should show copy button", () => {
|
|
124
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
125
|
-
props: {
|
|
126
|
-
code: "const x = 1"
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__actions .yh-button").exists()).toBe(true);
|
|
130
|
-
});
|
|
131
|
-
(0, _vitest.it)("should emit copy event and call clipboard on copy click", async () => {
|
|
132
|
-
const code = "const x = 1";
|
|
133
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
134
|
-
props: {
|
|
135
|
-
code
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
139
|
-
(0, _vitest.expect)(navigator.clipboard.writeText).toHaveBeenCalledWith(code);
|
|
140
|
-
(0, _vitest.expect)(wrapper.emitted("copy")).toBeTruthy();
|
|
141
|
-
(0, _vitest.expect)(wrapper.emitted("copy")[0][0]).toBe(code);
|
|
142
|
-
});
|
|
143
|
-
(0, _vitest.it)("should NOT emit copy when code is empty", async () => {
|
|
144
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
145
|
-
props: {
|
|
146
|
-
code: ""
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
150
|
-
(0, _vitest.expect)(wrapper.emitted("copy")).toBeFalsy();
|
|
151
|
-
});
|
|
152
|
-
(0, _vitest.it)("should render default slot instead of code when slot provided", () => {
|
|
153
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
154
|
-
props: {
|
|
155
|
-
code: "ignored code"
|
|
156
|
-
},
|
|
157
|
-
slots: {
|
|
158
|
-
default: '<em class="custom-code">custom</em>'
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
(0, _vitest.expect)(wrapper.find(".custom-code").exists()).toBe(true);
|
|
162
|
-
});
|
|
163
|
-
(0, _vitest.it)("should render actions slot", () => {
|
|
164
|
-
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
165
|
-
props: {
|
|
166
|
-
code: "code"
|
|
167
|
-
},
|
|
168
|
-
slots: {
|
|
169
|
-
actions: '<button class="extra-action">Run</button>'
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
(0, _vitest.expect)(wrapper.find(".extra-action").exists()).toBe(true);
|
|
173
|
-
});
|
|
174
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
vi.mock("highlight.js", () => ({
|
|
4
|
-
default: {
|
|
5
|
-
getLanguage: (lang) => lang === "typescript" || lang === "javascript" || lang === "python",
|
|
6
|
-
highlight: vi.fn((_code, _opts) => ({
|
|
7
|
-
value: '<span class="hljs-keyword">const</span>'
|
|
8
|
-
})),
|
|
9
|
-
highlightAuto: vi.fn(() => ({ value: "<span>auto</span>" }))
|
|
10
|
-
}
|
|
11
|
-
}));
|
|
12
|
-
vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
13
|
-
const { default: AiCodeBlock } = await import("../src/ai-code-block.vue");
|
|
14
|
-
describe("YhAiCodeBlock", () => {
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
const mockClipboard = { writeText: vi.fn().mockResolvedValue(void 0) };
|
|
17
|
-
Object.defineProperty(navigator, "clipboard", {
|
|
18
|
-
value: mockClipboard,
|
|
19
|
-
writable: true,
|
|
20
|
-
configurable: true
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it("should render with base class", () => {
|
|
24
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
25
|
-
expect(wrapper.find(".yh-ai-code-block").exists()).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
it("should render header and body", () => {
|
|
28
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
29
|
-
expect(wrapper.find(".yh-ai-code-block__header").exists()).toBe(true);
|
|
30
|
-
expect(wrapper.find(".yh-ai-code-block__body").exists()).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
it("should show filename in lang label when filename provided", () => {
|
|
33
|
-
const wrapper = mount(AiCodeBlock, {
|
|
34
|
-
props: { code: "const x = 1", language: "typescript", filename: "utils.ts" }
|
|
35
|
-
});
|
|
36
|
-
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("utils.ts");
|
|
37
|
-
});
|
|
38
|
-
it("should show language in lang label when filename not provided", () => {
|
|
39
|
-
const wrapper = mount(AiCodeBlock, {
|
|
40
|
-
props: { code: "const x = 1", language: "typescript" }
|
|
41
|
-
});
|
|
42
|
-
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("typescript");
|
|
43
|
-
});
|
|
44
|
-
it("should show text as default language", () => {
|
|
45
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "plain text" } });
|
|
46
|
-
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("text");
|
|
47
|
-
});
|
|
48
|
-
it("should render code element with language class", () => {
|
|
49
|
-
const wrapper = mount(AiCodeBlock, {
|
|
50
|
-
props: { code: "const x = 1", language: "typescript" }
|
|
51
|
-
});
|
|
52
|
-
const code = wrapper.find("code");
|
|
53
|
-
expect(code.classes()).toContain("language-typescript");
|
|
54
|
-
});
|
|
55
|
-
it("should render code content", () => {
|
|
56
|
-
const wrapper = mount(AiCodeBlock, {
|
|
57
|
-
props: { code: "hello world", language: "text", highlight: false }
|
|
58
|
-
});
|
|
59
|
-
expect(wrapper.html()).toContain("hello world");
|
|
60
|
-
});
|
|
61
|
-
it("should apply hljs class to code element", () => {
|
|
62
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
63
|
-
expect(wrapper.find("code").classes()).toContain("hljs");
|
|
64
|
-
});
|
|
65
|
-
it("should render highlighted code when highlight=true and language recognized", () => {
|
|
66
|
-
const wrapper = mount(AiCodeBlock, {
|
|
67
|
-
props: { code: "const x = 1", language: "typescript", highlight: true }
|
|
68
|
-
});
|
|
69
|
-
expect(wrapper.find("code").html()).toContain("hljs-keyword");
|
|
70
|
-
});
|
|
71
|
-
it("should render raw code when highlight=false", () => {
|
|
72
|
-
const wrapper = mount(AiCodeBlock, {
|
|
73
|
-
props: { code: "raw code here", language: "typescript", highlight: false }
|
|
74
|
-
});
|
|
75
|
-
expect(wrapper.find("code").html()).toContain("raw code here");
|
|
76
|
-
});
|
|
77
|
-
it("should show copy button", () => {
|
|
78
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
79
|
-
expect(wrapper.find(".yh-ai-code-block__actions .yh-button").exists()).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
it("should emit copy event and call clipboard on copy click", async () => {
|
|
82
|
-
const code = "const x = 1";
|
|
83
|
-
const wrapper = mount(AiCodeBlock, { props: { code } });
|
|
84
|
-
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
85
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(code);
|
|
86
|
-
expect(wrapper.emitted("copy")).toBeTruthy();
|
|
87
|
-
expect(wrapper.emitted("copy")[0][0]).toBe(code);
|
|
88
|
-
});
|
|
89
|
-
it("should NOT emit copy when code is empty", async () => {
|
|
90
|
-
const wrapper = mount(AiCodeBlock, { props: { code: "" } });
|
|
91
|
-
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
92
|
-
expect(wrapper.emitted("copy")).toBeFalsy();
|
|
93
|
-
});
|
|
94
|
-
it("should render default slot instead of code when slot provided", () => {
|
|
95
|
-
const wrapper = mount(AiCodeBlock, {
|
|
96
|
-
props: { code: "ignored code" },
|
|
97
|
-
slots: { default: '<em class="custom-code">custom</em>' }
|
|
98
|
-
});
|
|
99
|
-
expect(wrapper.find(".custom-code").exists()).toBe(true);
|
|
100
|
-
});
|
|
101
|
-
it("should render actions slot", () => {
|
|
102
|
-
const wrapper = mount(AiCodeBlock, {
|
|
103
|
-
props: { code: "code" },
|
|
104
|
-
slots: { actions: '<button class="extra-action">Run</button>' }
|
|
105
|
-
});
|
|
106
|
-
expect(wrapper.find(".extra-action").exists()).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _serverRenderer = require("@vue/server-renderer");
|
|
5
|
-
var _vue = require("vue");
|
|
6
|
-
_vitest.vi.mock("monaco-editor", () => ({
|
|
7
|
-
editor: {
|
|
8
|
-
create: _vitest.vi.fn(),
|
|
9
|
-
setModelLanguage: _vitest.vi.fn(),
|
|
10
|
-
setTheme: _vitest.vi.fn()
|
|
11
|
-
}
|
|
12
|
-
}));
|
|
13
|
-
_vitest.vi.mock("monaco-editor/esm/vs/editor/editor.worker?worker", () => ({
|
|
14
|
-
default: class {}
|
|
15
|
-
}));
|
|
16
|
-
_vitest.vi.mock("monaco-editor/esm/vs/language/json/json.worker?worker", () => ({
|
|
17
|
-
default: class {}
|
|
18
|
-
}));
|
|
19
|
-
_vitest.vi.mock("monaco-editor/esm/vs/language/css/css.worker?worker", () => ({
|
|
20
|
-
default: class {}
|
|
21
|
-
}));
|
|
22
|
-
_vitest.vi.mock("monaco-editor/esm/vs/language/html/html.worker?worker", () => ({
|
|
23
|
-
default: class {}
|
|
24
|
-
}));
|
|
25
|
-
_vitest.vi.mock("monaco-editor/esm/vs/language/typescript/ts.worker?worker", () => ({
|
|
26
|
-
default: class {}
|
|
27
|
-
}));
|
|
28
|
-
_vitest.vi.mock("@yh-ui/theme", () => ({
|
|
29
|
-
useComponentTheme: () => ({
|
|
30
|
-
themeStyle: {}
|
|
31
|
-
})
|
|
32
|
-
}));
|
|
33
|
-
const {
|
|
34
|
-
default: AiCodeEditor
|
|
35
|
-
} = await Promise.resolve().then(() => require("../src/ai-code-editor.vue"));
|
|
36
|
-
(0, _vitest.describe)("YhAiCodeEditor SSR", () => {
|
|
37
|
-
(0, _vitest.it)("should render container on server", async () => {
|
|
38
|
-
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeEditor, {
|
|
39
|
-
modelValue: "const a = 1;",
|
|
40
|
-
height: 400
|
|
41
|
-
}));
|
|
42
|
-
(0, _vitest.expect)(html).toContain("yh-ai-code-editor");
|
|
43
|
-
(0, _vitest.expect)(html).toContain("yh-ai-code-editor__container");
|
|
44
|
-
(0, _vitest.expect)(html).toContain("height:400px");
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from "vitest";
|
|
2
|
-
import { renderToString } from "@vue/server-renderer";
|
|
3
|
-
import { h } from "vue";
|
|
4
|
-
vi.mock("monaco-editor", () => ({
|
|
5
|
-
editor: {
|
|
6
|
-
create: vi.fn(),
|
|
7
|
-
setModelLanguage: vi.fn(),
|
|
8
|
-
setTheme: vi.fn()
|
|
9
|
-
}
|
|
10
|
-
}));
|
|
11
|
-
vi.mock("monaco-editor/esm/vs/editor/editor.worker?worker", () => ({ default: class {
|
|
12
|
-
} }));
|
|
13
|
-
vi.mock("monaco-editor/esm/vs/language/json/json.worker?worker", () => ({ default: class {
|
|
14
|
-
} }));
|
|
15
|
-
vi.mock("monaco-editor/esm/vs/language/css/css.worker?worker", () => ({ default: class {
|
|
16
|
-
} }));
|
|
17
|
-
vi.mock("monaco-editor/esm/vs/language/html/html.worker?worker", () => ({ default: class {
|
|
18
|
-
} }));
|
|
19
|
-
vi.mock("monaco-editor/esm/vs/language/typescript/ts.worker?worker", () => ({ default: class {
|
|
20
|
-
} }));
|
|
21
|
-
vi.mock("@yh-ui/theme", () => ({
|
|
22
|
-
useComponentTheme: () => ({
|
|
23
|
-
themeStyle: {}
|
|
24
|
-
})
|
|
25
|
-
}));
|
|
26
|
-
const { default: AiCodeEditor } = await import("../src/ai-code-editor.vue");
|
|
27
|
-
describe("YhAiCodeEditor SSR", () => {
|
|
28
|
-
it("should render container on server", async () => {
|
|
29
|
-
const html = await renderToString(
|
|
30
|
-
h(AiCodeEditor, {
|
|
31
|
-
modelValue: "const a = 1;",
|
|
32
|
-
height: 400
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
expect(html).toContain("yh-ai-code-editor");
|
|
36
|
-
expect(html).toContain("yh-ai-code-editor__container");
|
|
37
|
-
expect(html).toContain("height:400px");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _testUtils = require("@vue/test-utils");
|
|
5
|
-
var _aiCodeEditor = _interopRequireDefault(require("../src/ai-code-editor.vue"));
|
|
6
|
-
var monaco = _interopRequireWildcard(require("monaco-editor"));
|
|
7
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
8
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
_vitest.vi.mock("monaco-editor", () => {
|
|
11
|
-
const editor = {
|
|
12
|
-
dispose: _vitest.vi.fn(),
|
|
13
|
-
getValue: _vitest.vi.fn(() => "test content"),
|
|
14
|
-
setValue: _vitest.vi.fn(),
|
|
15
|
-
onDidChangeModelContent: _vitest.vi.fn(cb => ({
|
|
16
|
-
dispose: _vitest.vi.fn(),
|
|
17
|
-
callback: cb
|
|
18
|
-
})),
|
|
19
|
-
layout: _vitest.vi.fn(),
|
|
20
|
-
focus: _vitest.vi.fn(),
|
|
21
|
-
updateOptions: _vitest.vi.fn(),
|
|
22
|
-
getModel: _vitest.vi.fn(() => ({})),
|
|
23
|
-
render: _vitest.vi.fn()
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
editor: {
|
|
27
|
-
create: _vitest.vi.fn(() => editor),
|
|
28
|
-
setModelLanguage: _vitest.vi.fn(),
|
|
29
|
-
setTheme: _vitest.vi.fn()
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
global.requestAnimationFrame = _vitest.vi.fn(cb => setTimeout(cb, 0));
|
|
34
|
-
global.cancelAnimationFrame = _vitest.vi.fn(id => clearTimeout(id));
|
|
35
|
-
global.ResizeObserver = class {
|
|
36
|
-
constructor(callback) {
|
|
37
|
-
this.callback = callback;
|
|
38
|
-
}
|
|
39
|
-
observe = _vitest.vi.fn();
|
|
40
|
-
unobserve = _vitest.vi.fn();
|
|
41
|
-
disconnect = _vitest.vi.fn();
|
|
42
|
-
};
|
|
43
|
-
(0, _vitest.describe)("YhAiCodeEditor", () => {
|
|
44
|
-
(0, _vitest.beforeEach)(() => {
|
|
45
|
-
_vitest.vi.clearAllMocks();
|
|
46
|
-
});
|
|
47
|
-
(0, _vitest.it)("should render container", () => {
|
|
48
|
-
const wrapper = (0, _testUtils.mount)(_aiCodeEditor.default, {
|
|
49
|
-
props: {
|
|
50
|
-
modelValue: "hello"
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
(0, _vitest.expect)(wrapper.find(".yh-ai-code-editor__container").exists()).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
(0, _vitest.it)("should initialize monaco editor", async () => {
|
|
56
|
-
(0, _testUtils.mount)(_aiCodeEditor.default, {
|
|
57
|
-
props: {
|
|
58
|
-
modelValue: "hello world",
|
|
59
|
-
language: "javascript"
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
63
|
-
(0, _vitest.expect)(monaco.editor.create).toHaveBeenCalled();
|
|
64
|
-
});
|
|
65
|
-
(0, _vitest.it)("should update value on prop change", async () => {
|
|
66
|
-
const wrapper = (0, _testUtils.mount)(_aiCodeEditor.default, {
|
|
67
|
-
props: {
|
|
68
|
-
modelValue: "first"
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
72
|
-
const editorInstance = _vitest.vi.mocked(monaco.editor.create).mock.results[0].value;
|
|
73
|
-
await wrapper.setProps({
|
|
74
|
-
modelValue: "second"
|
|
75
|
-
});
|
|
76
|
-
(0, _vitest.expect)(editorInstance.setValue).toHaveBeenCalledWith("second");
|
|
77
|
-
});
|
|
78
|
-
(0, _vitest.it)("should change language on prop change", async () => {
|
|
79
|
-
const wrapper = (0, _testUtils.mount)(_aiCodeEditor.default, {
|
|
80
|
-
props: {
|
|
81
|
-
language: "javascript"
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
85
|
-
await wrapper.setProps({
|
|
86
|
-
language: "typescript"
|
|
87
|
-
});
|
|
88
|
-
(0, _vitest.expect)(monaco.editor.setModelLanguage).toHaveBeenCalled();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import AiCodeEditor from "../src/ai-code-editor.vue";
|
|
4
|
-
import * as monaco from "monaco-editor";
|
|
5
|
-
vi.mock("monaco-editor", () => {
|
|
6
|
-
const editor = {
|
|
7
|
-
dispose: vi.fn(),
|
|
8
|
-
getValue: vi.fn(() => "test content"),
|
|
9
|
-
setValue: vi.fn(),
|
|
10
|
-
onDidChangeModelContent: vi.fn((cb) => ({ dispose: vi.fn(), callback: cb })),
|
|
11
|
-
layout: vi.fn(),
|
|
12
|
-
focus: vi.fn(),
|
|
13
|
-
updateOptions: vi.fn(),
|
|
14
|
-
getModel: vi.fn(() => ({})),
|
|
15
|
-
render: vi.fn()
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
editor: {
|
|
19
|
-
create: vi.fn(() => editor),
|
|
20
|
-
setModelLanguage: vi.fn(),
|
|
21
|
-
setTheme: vi.fn()
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
global.requestAnimationFrame = vi.fn((cb) => setTimeout(cb, 0));
|
|
26
|
-
global.cancelAnimationFrame = vi.fn((id) => clearTimeout(id));
|
|
27
|
-
global.ResizeObserver = class {
|
|
28
|
-
constructor(callback) {
|
|
29
|
-
this.callback = callback;
|
|
30
|
-
}
|
|
31
|
-
observe = vi.fn();
|
|
32
|
-
unobserve = vi.fn();
|
|
33
|
-
disconnect = vi.fn();
|
|
34
|
-
};
|
|
35
|
-
describe("YhAiCodeEditor", () => {
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
vi.clearAllMocks();
|
|
38
|
-
});
|
|
39
|
-
it("should render container", () => {
|
|
40
|
-
const wrapper = mount(AiCodeEditor, {
|
|
41
|
-
props: {
|
|
42
|
-
modelValue: "hello"
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
expect(wrapper.find(".yh-ai-code-editor__container").exists()).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
it("should initialize monaco editor", async () => {
|
|
48
|
-
mount(AiCodeEditor, {
|
|
49
|
-
props: {
|
|
50
|
-
modelValue: "hello world",
|
|
51
|
-
language: "javascript"
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
55
|
-
expect(monaco.editor.create).toHaveBeenCalled();
|
|
56
|
-
});
|
|
57
|
-
it("should update value on prop change", async () => {
|
|
58
|
-
const wrapper = mount(AiCodeEditor, {
|
|
59
|
-
props: {
|
|
60
|
-
modelValue: "first"
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
64
|
-
const editorInstance = vi.mocked(monaco.editor.create).mock.results[0].value;
|
|
65
|
-
await wrapper.setProps({ modelValue: "second" });
|
|
66
|
-
expect(editorInstance.setValue).toHaveBeenCalledWith("second");
|
|
67
|
-
});
|
|
68
|
-
it("should change language on prop change", async () => {
|
|
69
|
-
const wrapper = mount(AiCodeEditor, {
|
|
70
|
-
props: {
|
|
71
|
-
language: "javascript"
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
75
|
-
await wrapper.setProps({ language: "typescript" });
|
|
76
|
-
expect(monaco.editor.setModelLanguage).toHaveBeenCalled();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _serverRenderer = require("@vue/server-renderer");
|
|
5
|
-
var _vue = require("vue");
|
|
6
|
-
_vitest.vi.mock("../src/webcontainer", () => ({
|
|
7
|
-
getWebContainerInstance: _vitest.vi.fn()
|
|
8
|
-
}));
|
|
9
|
-
_vitest.vi.mock("@yh-ui/theme", () => ({
|
|
10
|
-
useComponentTheme: () => ({
|
|
11
|
-
themeStyle: {}
|
|
12
|
-
})
|
|
13
|
-
}));
|
|
14
|
-
const {
|
|
15
|
-
default: AiCodeRunner
|
|
16
|
-
} = await Promise.resolve().then(() => require("../src/ai-code-runner.vue"));
|
|
17
|
-
(0, _vitest.describe)("YhAiCodeRunner SSR", () => {
|
|
18
|
-
(0, _vitest.it)("should render toolbar and terminal on server", async () => {
|
|
19
|
-
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeRunner, {
|
|
20
|
-
code: 'console.log("ssr")',
|
|
21
|
-
height: 300
|
|
22
|
-
}));
|
|
23
|
-
(0, _vitest.expect)(html).toContain("yh-ai-code-runner");
|
|
24
|
-
(0, _vitest.expect)(html).toContain("yh-ai-code-runner__toolbar");
|
|
25
|
-
(0, _vitest.expect)(html).toContain("yh-ai-code-runner__terminal");
|
|
26
|
-
(0, _vitest.expect)(html).toContain("height:300px");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from "vitest";
|
|
2
|
-
import { renderToString } from "@vue/server-renderer";
|
|
3
|
-
import { h } from "vue";
|
|
4
|
-
vi.mock("../src/webcontainer", () => ({
|
|
5
|
-
getWebContainerInstance: vi.fn()
|
|
6
|
-
}));
|
|
7
|
-
vi.mock("@yh-ui/theme", () => ({
|
|
8
|
-
useComponentTheme: () => ({
|
|
9
|
-
themeStyle: {}
|
|
10
|
-
})
|
|
11
|
-
}));
|
|
12
|
-
const { default: AiCodeRunner } = await import("../src/ai-code-runner.vue");
|
|
13
|
-
describe("YhAiCodeRunner SSR", () => {
|
|
14
|
-
it("should render toolbar and terminal on server", async () => {
|
|
15
|
-
const html = await renderToString(
|
|
16
|
-
h(AiCodeRunner, {
|
|
17
|
-
code: 'console.log("ssr")',
|
|
18
|
-
height: 300
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
expect(html).toContain("yh-ai-code-runner");
|
|
22
|
-
expect(html).toContain("yh-ai-code-runner__toolbar");
|
|
23
|
-
expect(html).toContain("yh-ai-code-runner__terminal");
|
|
24
|
-
expect(html).toContain("height:300px");
|
|
25
|
-
});
|
|
26
|
-
});
|