ScrollTop tests added
parent
0c25cc795c
commit
32c8a680a4
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue