feat: feat

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-01-11 00:11:27 +08:00
parent 3283a2d975
commit 3e429b95a2
32 changed files with 793 additions and 1377 deletions

41
__test__/Lottery.test.ts Normal file
View File

@@ -0,0 +1,41 @@
import Button from '@/components/Button/index.vue'
import { shallowMount } from '@vue/test-utils'
import { describe, expect, test } from 'vitest'
// 测试分组
describe('Button', () => {
// mount
test('Buttons slot text', () => {
// @vue/test-utils
const wrapper = shallowMount(Button, {
slots: {
default: 'Button',
},
})
// 断言
expect(wrapper.text()).toBe('Button')
})
test('Button click', () => {
const wrapper = shallowMount(Button)
wrapper.trigger('click')
expect(wrapper.emitted('click')).toBeTruthy()
})
test('Button disabled', () => {
const wrapper = shallowMount(Button, {
props: {
disabled: true,
},
})
wrapper.trigger('click')
expect(wrapper.emitted('click')).toBeFalsy()
})
test('Button not disabled', () => {
const wrapper = shallowMount(Button, {
props: {
disabled: false,
},
})
wrapper.trigger('click')
expect(wrapper.emitted('click')).toBeTruthy()
})
})