blob: fd439ba46bd0a0cac329f1cb4bc8f35a4396b58c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue';
import { shallowMount } from '@vue/test-utils';
describe('JumpToNextDiscussionButton', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(JumpToNextDiscussionButton, {
sync: false,
});
});
afterEach(() => {
wrapper.destroy();
});
it('matches the snapshot', () => {
expect(wrapper.vm.$el).toMatchSnapshot();
});
it('emits onClick event on button click', () => {
const button = wrapper.find({ ref: 'button' });
button.trigger('click');
expect(wrapper.emitted().onClick).toBeTruthy();
expect(wrapper.emitted().onClick.length).toBe(1);
});
});
|