debian-mirror-gitlab/spec/frontend/notes/components/note_actions/reply_button_spec.js

30 lines
673 B
JavaScript
Raw Normal View History

2019-03-02 22:35:43 +05:30
import Vuex from 'vuex';
import { createLocalVue, mount } from '@vue/test-utils';
import ReplyButton from '~/notes/components/note_actions/reply_button.vue';
2020-01-01 13:55:28 +05:30
const localVue = createLocalVue();
localVue.use(Vuex);
2019-03-02 22:35:43 +05:30
describe('ReplyButton', () => {
let wrapper;
beforeEach(() => {
2020-01-01 13:55:28 +05:30
wrapper = mount(localVue.extend(ReplyButton), {
2019-03-02 22:35:43 +05:30
localVue,
});
});
afterEach(() => {
wrapper.destroy();
});
2019-07-07 11:18:12 +05:30
it('emits startReplying on click', () => {
2019-03-02 22:35:43 +05:30
const button = wrapper.find({ ref: 'button' });
button.trigger('click');
2019-10-12 21:52:04 +05:30
expect(wrapper.emitted().startReplying).toBeTruthy();
expect(wrapper.emitted().startReplying.length).toBe(1);
2019-03-02 22:35:43 +05:30
});
});