mirror of
https://github.com/linshenkx/prompt-optimizer.git
synced 2026-07-02 07:24:28 +08:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { ActionButtonUI, ContentCardUI } from '../../src'
|
|
|
|
describe('基础UI组件测试', () => {
|
|
describe('ActionButtonUI', () => {
|
|
it('应该正确渲染按钮文本', () => {
|
|
const buttonText = '测试按钮'
|
|
const wrapper = mount(ActionButtonUI, {
|
|
props: {
|
|
text: buttonText,
|
|
icon: '??'
|
|
}
|
|
})
|
|
expect(wrapper.text()).toContain(buttonText)
|
|
})
|
|
|
|
it('应该正确处理loading状态', async () => {
|
|
const wrapper = mount(ActionButtonUI, {
|
|
props: {
|
|
text: '测试按钮',
|
|
icon: '??',
|
|
loading: false
|
|
}
|
|
})
|
|
|
|
expect(wrapper.props('loading')).toBe(false)
|
|
|
|
await wrapper.setProps({ loading: true })
|
|
expect(wrapper.props('loading')).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('ContentCardUI', () => {
|
|
it('应该正确渲染slot内容', () => {
|
|
const slotContent = '测试内容'
|
|
const wrapper = mount(ContentCardUI, {
|
|
slots: {
|
|
default: slotContent
|
|
}
|
|
})
|
|
expect(wrapper.text()).toContain(slotContent)
|
|
})
|
|
})
|
|
})
|
|
|