debian-mirror-gitlab/spec/frontend/whats_new/components/trigger_spec.js

44 lines
791 B
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import { createLocalVue, mount } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlButton } from '@gitlab/ui';
import Trigger from '~/whats_new/components/trigger.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('Trigger', () => {
let wrapper;
let store;
let actions;
let state;
beforeEach(() => {
actions = {
openDrawer: jest.fn(),
};
state = {
open: true,
};
store = new Vuex.Store({
actions,
state,
});
wrapper = mount(Trigger, {
localVue,
store,
});
});
afterEach(() => {
wrapper.destroy();
});
it('dispatches openDrawer when clicking close', () => {
wrapper.find(GlButton).vm.$emit('click');
expect(actions.openDrawer).toHaveBeenCalled();
});
});