diff --git a/src/components/scrolltop/ScrollTop.spec.js b/src/components/scrolltop/ScrollTop.spec.js new file mode 100644 index 000000000..edd5bc9d0 --- /dev/null +++ b/src/components/scrolltop/ScrollTop.spec.js @@ -0,0 +1,16 @@ +import { mount } from '@vue/test-utils'; +import ScrollTop from './ScrollTop.vue'; + +describe('ScrollTop.vue', () => { + let wrapper; + + beforeEach(() => { + wrapper = mount(ScrollTop); + }); + + it('should exist', async() => { + await wrapper.setData({ visible: true }); + + expect(wrapper.find('.p-scrolltop.p-component').exists()).toBe(true); + }); +}); \ No newline at end of file diff --git a/src/components/scrolltop/ScrollTop.vue b/src/components/scrolltop/ScrollTop.vue index b78e583a7..ab9d8aa05 100644 --- a/src/components/scrolltop/ScrollTop.vue +++ b/src/components/scrolltop/ScrollTop.vue @@ -56,7 +56,7 @@ export default { methods: { onClick() { let scrollElement = this.target === 'window' ? window : this.$el.parentElement; - scrollElement.scroll({ + scrollElement.scroll({ top: 0, behavior: this.behavior });