mirror of
https://github.com/koel/koel
synced 2024-12-04 09:49:23 +00:00
40 lines
1,017 B
TypeScript
40 lines
1,017 B
TypeScript
import { beforeEach, expect, it } from 'vitest'
|
|
import { render } from '@/__tests__/__helpers__'
|
|
import { cleanup, fireEvent } from '@testing-library/vue'
|
|
import factory from '@/__tests__/factory'
|
|
import AlbumInfo from './AlbumInfo.vue'
|
|
import AlbumThumbnail from '@/components/ui/AlbumArtistThumbnail.vue'
|
|
|
|
beforeEach(() => cleanup())
|
|
|
|
it.each([['sidebar'], ['full']])('renders in %s mode', async (mode: string) => {
|
|
const { getByTestId } = render(AlbumInfo, {
|
|
props: {
|
|
album: factory<Album>('album'),
|
|
mode
|
|
},
|
|
global: {
|
|
stubs: {
|
|
AlbumThumbnail
|
|
}
|
|
}
|
|
})
|
|
|
|
getByTestId('album-artist-thumbnail')
|
|
|
|
const element = getByTestId<HTMLElement>('album-info')
|
|
expect(element.classList.contains(mode)).toBe(true)
|
|
})
|
|
|
|
it('triggers showing full wiki', async () => {
|
|
const album = factory<Album>('album')
|
|
|
|
const { getByText } = render(AlbumInfo, {
|
|
props: {
|
|
album
|
|
}
|
|
})
|
|
|
|
await fireEvent.click(getByText('Full Wiki'))
|
|
getByText(album.info!.wiki!.full)
|
|
})
|