fix(components): [backtop] change default visible (#13069)

* fix(components): [backtop] change default visible

* fix(components): [backtop] handleScroll onMounted & add unit test
This commit is contained in:
init-qy
2023-06-03 06:58:56 +08:00
committed by GitHub
parent 606eade53d
commit 1cde8d43d3
2 changed files with 10 additions and 0 deletions

View File

@@ -37,4 +37,12 @@ describe('Backtop.vue', () => {
await wrapper.trigger('click')
expect(wrapper.emitted()).toBeDefined()
})
test('render when visibilityHeight is zero', async () => {
const wrapper = _mount(() => (
<Backtop visibilityHeight={0} right={100} bottom={200} />
))
await nextTick()
expect(wrapper.find('.el-backtop').exists()).toBe(true)
})
})

View File

@@ -36,6 +36,8 @@ export const useBackTop = (
}
container.value = el.value
}
// Give visible an initial value, fix #13066
handleScroll()
})
return {