Add snapshot test to discussion_jump_to_next_button_spec.js

This commit is contained in:
Winnie Hellmann 2019-02-20 21:36:27 +01:00
parent fd87496971
commit db735b66a0
2 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`JumpToNextDiscussionButton matches the snapshot 1`] = `
<div
class="btn-group"
role="group"
>
<button
class="btn btn-default discussion-next-btn"
data-original-title="Jump to next unresolved discussion"
title=""
>
<icon-stub
cssclasses=""
name="comment-next"
size="16"
/>
</button>
</div>
`;

View File

@ -1,11 +1,11 @@
import jumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue';
import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue';
import { shallowMount } from '@vue/test-utils';
describe('jumpToNextDiscussionButton', () => {
describe('JumpToNextDiscussionButton', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(jumpToNextDiscussionButton, {
wrapper = shallowMount(JumpToNextDiscussionButton, {
sync: false,
});
});
@ -14,6 +14,10 @@ describe('jumpToNextDiscussionButton', () => {
wrapper.destroy();
});
it('matches the snapshot', () => {
expect(wrapper.vm.$el).toMatchSnapshot();
});
it('emits onClick event on button click', () => {
const button = wrapper.find({ ref: 'button' });