Welcome to mirror list, hosted at ThFree Co, Russian Federation.

delete_pipeline_schedule_modal_spec.js « components « pipeline_schedules « ci « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ba948f12b33251dbf553b8072937d66f80367f56 (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
36
37
38
import { shallowMount } from '@vue/test-utils';
import { GlModal } from '@gitlab/ui';
import DeletePipelineScheduleModal from '~/ci/pipeline_schedules/components/delete_pipeline_schedule_modal.vue';

describe('Delete pipeline schedule modal', () => {
  let wrapper;

  const createComponent = (props = {}) => {
    wrapper = shallowMount(DeletePipelineScheduleModal, {
      propsData: {
        visible: true,
        ...props,
      },
    });
  };

  const findModal = () => wrapper.findComponent(GlModal);

  beforeEach(() => {
    createComponent();
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it('emits the deleteSchedule event', async () => {
    findModal().vm.$emit('primary');

    expect(wrapper.emitted()).toEqual({ deleteSchedule: [[]] });
  });

  it('emits the hideModal event', async () => {
    findModal().vm.$emit('hide');

    expect(wrapper.emitted()).toEqual({ hideModal: [[]] });
  });
});