2021-12-24 vitesse-lite clone

This commit is contained in:
2021-12-24 11:43:10 +09:00
parent f7a10ba944
commit a454ae4664
35 changed files with 4439 additions and 17 deletions

22
test/component.test.ts Normal file
View File

@@ -0,0 +1,22 @@
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import Counter from '../src/components/Counter.vue'
describe('Counter.vue', () => {
it('should render', () => {
const wrapper = mount(Counter, { props: { initial: 10 } })
expect(wrapper.text()).toContain('10')
expect(wrapper.html()).toMatchSnapshot()
})
it('should be interactive', async() => {
const wrapper = mount(Counter, { props: { initial: 0 } })
expect(wrapper.text()).toContain('0')
expect(wrapper.find('.inc').exists()).toBe(true)
await wrapper.get('button').trigger('click')
expect(wrapper.text()).toContain('1')
})
})