koel/resources/assets/js/components/ui/BtnCloseModal.spec.ts

19 lines
531 B
TypeScript
Raw Normal View History

import { expect, it } from 'vitest'
import { screen } from '@testing-library/vue'
2022-05-13 17:58:38 +00:00
import UnitTestCase from '@/__tests__/UnitTestCase'
import BtnCloseModal from './BtnCloseModal.vue'
2022-05-13 17:58:38 +00:00
new class extends UnitTestCase {
protected test () {
it('renders', () => expect(this.render(BtnCloseModal).html()).toMatchSnapshot())
it('emits the event', async () => {
const { emitted } = this.render(BtnCloseModal)
await this.user.click(screen.getByRole('button'))
expect(emitted().click).toBeTruthy()
})
}
}