2022-05-11 17:16:31 +00:00
|
|
|
import isMobile from 'ismobilejs'
|
|
|
|
import { expect, it } from 'vitest'
|
2022-05-12 08:46:41 +00:00
|
|
|
import { fireEvent } from '@testing-library/vue'
|
2022-05-11 17:16:31 +00:00
|
|
|
import ComponentTestCase from '@/__tests__/ComponentTestCase'
|
|
|
|
import ScreenControlsToggler from './ScreenControlsToggler.vue'
|
|
|
|
|
|
|
|
new class extends ComponentTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('renders and emits an event on mobile', async () => {
|
|
|
|
isMobile.phone = true
|
|
|
|
const { emitted, getByTestId } = this.render(ScreenControlsToggler)
|
|
|
|
|
|
|
|
await fireEvent.click(getByTestId('controls-toggler'))
|
|
|
|
|
|
|
|
expect(emitted().toggleControls).toBeTruthy()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|