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