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-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-06-10 10:47:46 +00:00
|
|
|
import ScreenControlsToggle from './ScreenControlsToggle.vue'
|
2022-05-11 17:16:31 +00:00
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-05-11 17:16:31 +00:00
|
|
|
protected test () {
|
|
|
|
it('renders and emits an event on mobile', async () => {
|
|
|
|
isMobile.phone = true
|
2022-06-10 10:47:46 +00:00
|
|
|
const { emitted, getByTestId } = this.render(ScreenControlsToggle)
|
2022-05-11 17:16:31 +00:00
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
await fireEvent.click(getByTestId('controls-toggle'))
|
2022-05-11 17:16:31 +00:00
|
|
|
|
|
|
|
expect(emitted().toggleControls).toBeTruthy()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|