mirror of
https://github.com/koel/koel
synced 2024-12-20 17:43:36 +00:00
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { expect, it } from 'vitest'
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
import { commonStore } from '@/stores'
|
|
import { screen } from '@testing-library/vue'
|
|
import ExtraDrawerTabHeader from './ExtraDrawerTabHeader.vue'
|
|
|
|
new class extends UnitTestCase {
|
|
protected test () {
|
|
it('renders tab headers', () => {
|
|
commonStore.state.uses_you_tube = false
|
|
this.render(ExtraDrawerTabHeader)
|
|
|
|
;['Lyrics', 'Artist information', 'Album information'].forEach(name => screen.getByRole('button', { name }))
|
|
expect(screen.queryByRole('button', { name: 'Related YouTube videos' })).toBeNull()
|
|
})
|
|
|
|
it('has a YouTube tab header if using YouTube', () => {
|
|
commonStore.state.uses_you_tube = true
|
|
this.render(ExtraDrawerTabHeader)
|
|
|
|
screen.getByRole('button', { name: 'Related YouTube videos' })
|
|
})
|
|
|
|
it('emits the selected tab value', async () => {
|
|
const { emitted } = this.render(ExtraDrawerTabHeader)
|
|
|
|
await this.user.click(screen.getByRole('button', { name: 'Lyrics' }))
|
|
|
|
expect(emitted()['update:modelValue']).toEqual([['Lyrics']])
|
|
})
|
|
}
|
|
}
|