test(backtop): Add backtop component test (#1188)

* test(backtop): Add backtop component test

* test(backtop): Update backtop component test
This commit is contained in:
songjianet 2021-09-17 09:02:58 +08:00 committed by GitHub
parent ee0265a275
commit a8633abb9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,4 +5,21 @@ describe('n-back-top', () => {
it('should work with import on demand', () => {
mount(NBackTop)
})
it('should work with `show` prop', async () => {
document.body.innerHTML = `
<div id="test" style="height: 3000px; width: 100%;"></div>
`
const wrapper = mount(NBackTop, {
attachTo: document.getElementById('test'),
props: {
show: true
}
})
wrapper.element.scrollTop = 1000
await wrapper.trigger('scroll')
expect(wrapper.html()).toContain('teleport start')
})
})