diff options
Diffstat (limited to 'spec/frontend/notes/components/note_actions/timeline_event_button_spec.js')
-rw-r--r-- | spec/frontend/notes/components/note_actions/timeline_event_button_spec.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js b/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js new file mode 100644 index 00000000000..658e844a9b1 --- /dev/null +++ b/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js @@ -0,0 +1,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); + }); +}); |