koel/resources/assets/js/components/ui/ScreenControlsToggler.spec.ts

19 lines
582 B
TypeScript
Raw Normal View History

import isMobile from 'ismobilejs'
import { expect, it } from 'vitest'
import { fireEvent } from '@testing-library/vue'
2022-05-13 17:58:38 +00:00
import UnitTestCase from '@/__tests__/UnitTestCase'
import ScreenControlsToggler from './ScreenControlsToggler.vue'
2022-05-13 17:58:38 +00:00
new class extends UnitTestCase {
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()
})
}
}