debian-mirror-gitlab/spec/frontend/integrations/edit/components/confirmation_modal_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { GlModal } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { shallowMount } from '@vue/test-utils';
2021-09-04 01:27:46 +05:30
2022-04-04 11:22:00 +05:30
import { nextTick } from 'vue';
2021-01-03 14:25:43 +05:30
import ConfirmationModal from '~/integrations/edit/components/confirmation_modal.vue';
2021-03-11 19:13:27 +05:30
import { createStore } from '~/integrations/edit/store';
2021-01-03 14:25:43 +05:30
describe('ConfirmationModal', () => {
let wrapper;
const createComponent = () => {
wrapper = shallowMount(ConfirmationModal, {
store: createStore(),
});
};
2021-09-04 01:27:46 +05:30
const findGlModal = () => wrapper.findComponent(GlModal);
2021-01-03 14:25:43 +05:30
describe('template', () => {
beforeEach(() => {
createComponent();
});
it('renders GlModal with correct copy', () => {
expect(findGlModal().exists()).toBe(true);
expect(findGlModal().attributes('title')).toBe('Save settings?');
expect(findGlModal().text()).toContain(
'Saving will update the default settings for all projects that are not using custom settings.',
);
expect(findGlModal().text()).toContain(
2021-01-29 00:20:46 +05:30
'Projects using custom settings will not be impacted unless the project owner chooses to use parent level defaults.',
2021-01-03 14:25:43 +05:30
);
});
it('emits `submit` event when `primary` event is emitted on GlModal', async () => {
expect(wrapper.emitted().submit).toBeUndefined();
findGlModal().vm.$emit('primary');
2022-04-04 11:22:00 +05:30
await nextTick();
2021-01-03 14:25:43 +05:30
expect(wrapper.emitted().submit).toHaveLength(1);
});
});
});