diff options
Diffstat (limited to 'spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js')
-rw-r--r-- | spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js b/spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js index 8f51269f8ab..ecc1bdeb679 100644 --- a/spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js +++ b/spec/frontend/pipeline_schedules/components/table/cells/pipeline_schedule_actions_spec.js @@ -1,5 +1,5 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import PipelineScheduleActions from '~/pipeline_schedules/components/table/cells/pipeline_schedule_actions.vue'; import { mockPipelineScheduleNodes, mockPipelineScheduleAsGuestNodes } from '../../../mock_data'; @@ -11,7 +11,7 @@ describe('Pipeline schedule actions', () => { }; const createComponent = (props = defaultProps) => { - wrapper = shallowMount(PipelineScheduleActions, { + wrapper = shallowMountExtended(PipelineScheduleActions, { propsData: { ...props, }, @@ -19,6 +19,7 @@ describe('Pipeline schedule actions', () => { }; const findAllButtons = () => wrapper.findAllComponents(GlButton); + const findDeleteBtn = () => wrapper.findByTestId('delete-pipeline-schedule-btn'); afterEach(() => { wrapper.destroy(); @@ -35,4 +36,14 @@ describe('Pipeline schedule actions', () => { expect(findAllButtons()).toHaveLength(0); }); + + it('delete button emits showDeleteModal event and schedule id', () => { + createComponent(); + + findDeleteBtn().vm.$emit('click'); + + expect(wrapper.emitted()).toEqual({ + showDeleteModal: [[mockPipelineScheduleNodes[0].id]], + }); + }); }); |