mirror of
https://github.com/koel/koel
synced 2024-12-20 09:33:23 +00:00
22 lines
603 B
TypeScript
22 lines
603 B
TypeScript
import { expect, it } from 'vitest'
|
|
import { screen } from '@testing-library/vue'
|
|
import { $ } from '@/utils'
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
import BtnScrollToTop from './BtnScrollToTop.vue'
|
|
|
|
new class extends UnitTestCase {
|
|
protected test () {
|
|
it('renders', () => {
|
|
expect(this.render(BtnScrollToTop).html()).toMatchSnapshot()
|
|
})
|
|
|
|
it('scrolls to top', async () => {
|
|
const mock = this.mock($, 'scrollTo')
|
|
this.render(BtnScrollToTop)
|
|
|
|
await this.user.click(screen.getByTitle('Scroll to top'))
|
|
|
|
expect(mock).toHaveBeenCalled()
|
|
})
|
|
}
|
|
}
|