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