mirror of
https://github.com/koel/koel
synced 2024-12-29 22:13:06 +00:00
32 lines
770 B
TypeScript
32 lines
770 B
TypeScript
|
import ComponentTestCase from '@/__tests__/ComponentTestCase'
|
||
|
import { expect, it } from 'vitest'
|
||
|
import { fireEvent } from '@testing-library/vue'
|
||
|
import ThemeCard from './ThemeCard.vue'
|
||
|
|
||
|
const theme: Theme = {
|
||
|
id: 'sample',
|
||
|
thumbnailColor: '#f00'
|
||
|
}
|
||
|
|
||
|
new class extends ComponentTestCase {
|
||
|
private renderComponent () {
|
||
|
return this.render(ThemeCard, {
|
||
|
props: {
|
||
|
theme
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
protected test () {
|
||
|
it('renders', () => {
|
||
|
expect(this.renderComponent().html()).toMatchSnapshot()
|
||
|
})
|
||
|
|
||
|
it('emits an event when selected', async () => {
|
||
|
const { emitted, getByTestId } = this.renderComponent()
|
||
|
await fireEvent.click(getByTestId('theme-card-sample'))
|
||
|
expect(emitted().selected[0]).toEqual([theme])
|
||
|
})
|
||
|
}
|
||
|
}
|