ScrollTop tests added

pull/2342/head
Tuğçe Küçükoğlu 2022-03-22 14:29:12 +03:00
parent 0c25cc795c
commit 32c8a680a4
2 changed files with 17 additions and 1 deletions

View File

@ -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);
});
});

View File

@ -56,7 +56,7 @@ export default {
methods: { methods: {
onClick() { onClick() {
let scrollElement = this.target === 'window' ? window : this.$el.parentElement; let scrollElement = this.target === 'window' ? window : this.$el.parentElement;
scrollElement.scroll({ scrollElement.scroll({
top: 0, top: 0,
behavior: this.behavior behavior: this.behavior
}); });