koel/resources/assets/js/components/layout/app-footer/FooterExtraControls.spec.ts

36 lines
1 KiB
TypeScript
Raw Normal View History

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'
import FooterExtraControls from './FooterExtraControls.vue'
2022-05-13 17:58:38 +00:00
new class extends UnitTestCase {
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')
})
}
2024-04-23 21:01:27 +00:00
private renderComponent () {
return this.render(FooterExtraControls, {
global: {
stubs: {
Equalizer: this.stub('Equalizer'),
Volume: this.stub('Volume'),
},
},
2024-04-23 21:01:27 +00:00
})
}
}