debian-mirror-gitlab/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js

31 lines
741 B
JavaScript
Raw Normal View History

2019-07-07 11:18:12 +05:30
import { shallowMount } from '@vue/test-utils';
2020-01-01 13:55:28 +05:30
import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue';
2019-07-07 11:18:12 +05:30
describe('JumpToNextDiscussionButton', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(JumpToNextDiscussionButton, {
sync: false,
2020-01-01 13:55:28 +05:30
attachToDocument: true,
2019-07-07 11:18:12 +05:30
});
});
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');
2019-10-12 21:52:04 +05:30
expect(wrapper.emitted().onClick).toBeTruthy();
expect(wrapper.emitted().onClick.length).toBe(1);
2019-07-07 11:18:12 +05:30
});
});