2022-07-21 10:45:23 +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 10:45:23 +00:00
|
|
|
import Magnifier from './Magnifier.vue'
|
|
|
|
|
|
|
|
new class extends UnitTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('renders and functions', async () => {
|
2022-11-29 10:18:58 +00:00
|
|
|
const { html, emitted } = this.render(Magnifier)
|
2022-07-21 10:45:23 +00:00
|
|
|
|
2022-11-29 10:18:58 +00:00
|
|
|
await this.user.click(screen.getByRole('button', { name: 'Zoom in' }))
|
|
|
|
expect(emitted().in).toBeTruthy()
|
2022-07-21 10:45:23 +00:00
|
|
|
|
2022-11-29 10:18:58 +00:00
|
|
|
await this.user.click(screen.getByRole('button', { name: 'Zoom out' }))
|
2022-07-21 10:45:23 +00:00
|
|
|
expect(emitted().out).toBeTruthy()
|
|
|
|
|
|
|
|
expect(html()).toMatchSnapshot()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|