2022-05-09 09:59:31 +00:00
|
|
|
import { expect, it } from 'vitest'
|
2022-05-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-12-23 15:44:34 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
|
|
|
import { eventBus } from '@/utils'
|
2022-05-09 09:59:31 +00:00
|
|
|
import FooterExtraControls from './FooterExtraControls.vue'
|
2022-05-04 22:41:47 +00:00
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-12-23 15:44:34 +00:00
|
|
|
private renderComponent () {
|
|
|
|
return this.render(FooterExtraControls, {
|
|
|
|
global: {
|
|
|
|
stubs: {
|
|
|
|
Equalizer: this.stub('Equalizer'),
|
|
|
|
Volume: this.stub('Volume')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-05-09 09:59:31 +00:00
|
|
|
protected test () {
|
|
|
|
it('renders', () => {
|
2022-12-23 15:44:34 +00:00
|
|
|
this.setReadOnlyProperty(document, 'fullscreenEnabled', undefined)
|
|
|
|
expect(this.renderComponent().html()).toMatchSnapshot()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('toggles fullscreen mode', async () => {
|
|
|
|
this.setReadOnlyProperty(document, 'fullscreenEnabled', true)
|
|
|
|
this.renderComponent()
|
|
|
|
const emitMock = this.mock(eventBus, 'emit')
|
|
|
|
|
|
|
|
await this.user.click(screen.getByTitle('Enter fullscreen mode'))
|
|
|
|
|
|
|
|
expect(emitMock).toHaveBeenCalledWith('FULLSCREEN_TOGGLE')
|
2022-05-09 09:59:31 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|