blob: 658e844a9b1f4de369cf24cee78646d0b029cf4b (
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
30
31
32
33
34
35
|
import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import TimelineEventButton from '~/notes/components/note_actions/timeline_event_button.vue';
const emitData = {
noteId: '1',
addError: 'Error promoting the note to timeline event: %{error}',
addGenericError: 'Something went wrong while promoting the note to timeline event.',
};
describe('NoteTimelineEventButton', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(TimelineEventButton, {
propsData: {
noteId: '1',
isPromotionInProgress: true,
},
});
});
afterEach(() => {
wrapper.destroy();
});
const findTimelineButton = () => wrapper.findComponent(GlButton);
it('emits click-promote-comment-to-event', async () => {
findTimelineButton().vm.$emit('click');
expect(wrapper.emitted('click-promote-comment-to-event')).toEqual([[emitData]]);
expect(findTimelineButton().props('disabled')).toEqual(true);
});
});
|