blob: e3965d13c19cb38c5af5de76306eab7f495ff722 (
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
39
40
|
import { shallowMount } from '@vue/test-utils';
import { GlModal } from '@gitlab/ui';
import TakeOwnershipModal from '~/ci/pipeline_schedules/components/take_ownership_modal.vue';
describe('Take ownership modal', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = shallowMount(TakeOwnershipModal, {
propsData: {
visible: true,
...props,
},
});
};
const findModal = () => wrapper.findComponent(GlModal);
beforeEach(() => {
createComponent();
});
it('shows a take ownership message', () => {
expect(findModal().text()).toBe(
'Only the owner of a pipeline schedule can make changes to it. Do you want to take ownership of this schedule?',
);
});
it('emits the takeOwnership event', async () => {
findModal().vm.$emit('primary');
expect(wrapper.emitted()).toEqual({ takeOwnership: [[]] });
});
it('emits the hideModal event', async () => {
findModal().vm.$emit('hide');
expect(wrapper.emitted()).toEqual({ hideModal: [[]] });
});
});
|