2022-07-21 09:32:09 +00:00
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-11-29 10:18:58 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
2022-07-21 09:32:09 +00:00
|
|
|
import CheckBox from './CheckBox.vue'
|
|
|
|
|
|
|
|
new class extends UnitTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('renders unchecked state', () => expect(this.render(CheckBox).html()).toMatchSnapshot())
|
|
|
|
|
|
|
|
it('renders checked state', () => expect(this.render(CheckBox, {
|
|
|
|
props: {
|
2024-10-13 17:37:01 +00:00
|
|
|
modelValue: true,
|
|
|
|
},
|
2022-07-21 09:32:09 +00:00
|
|
|
}).html()).toMatchSnapshot())
|
|
|
|
|
|
|
|
it('emits the input event', async () => {
|
2022-11-29 10:18:58 +00:00
|
|
|
const { emitted } = this.render(CheckBox)
|
2022-07-21 09:32:09 +00:00
|
|
|
|
2024-04-22 21:56:56 +00:00
|
|
|
await this.trigger(screen.getByRole('checkbox'), 'click')
|
2022-07-21 09:32:09 +00:00
|
|
|
|
|
|
|
expect(emitted()['update:modelValue']).toBeTruthy()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|