mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
test(backtop): Add backtop component test (#1188)
* test(backtop): Add backtop component test * test(backtop): Update backtop component test
This commit is contained in:
parent
ee0265a275
commit
a8633abb9b
@ -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')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user