2024-04-22 21:56:56 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2024-04-29 19:50:03 +00:00
|
|
|
import ArtistAlbumCard from './AlbumOrArtistCard.vue'
|
2024-04-22 21:56:56 +00:00
|
|
|
import factory from '@/__tests__/factory'
|
|
|
|
|
|
|
|
new class extends UnitTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('emits events on user actions', async () => {
|
|
|
|
const { emitted } = this.render(ArtistAlbumCard, {
|
|
|
|
props: {
|
2024-10-13 17:37:01 +00:00
|
|
|
entity: factory('album'),
|
|
|
|
},
|
2024-04-22 21:56:56 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
const component = screen.getByTestId('artist-album-card')
|
|
|
|
await this.trigger(component, 'dblClick')
|
|
|
|
expect(emitted().dblclick).toBeTruthy()
|
|
|
|
|
|
|
|
await this.trigger(component, 'dragStart')
|
|
|
|
expect(emitted().dragstart).toBeTruthy()
|
|
|
|
|
|
|
|
await this.trigger(component, 'contextMenu')
|
|
|
|
expect(emitted().contextmenu).toBeTruthy()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|