From 32c8a680a484b5f6b6f42fc100b73d1aa3e5723d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 22 Mar 2022 14:29:12 +0300 Subject: [PATCH] ScrollTop tests added --- src/components/scrolltop/ScrollTop.spec.js | 16 ++++++++++++++++ src/components/scrolltop/ScrollTop.vue | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/components/scrolltop/ScrollTop.spec.js 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 });