debian-mirror-gitlab/spec/frontend/sidebar/confidential/edit_form_spec.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-05-24 23:13:21 +05:30
import { shallowMount } from '@vue/test-utils';
import EditForm from '~/sidebar/components/confidential/edit_form.vue';
describe('Edit Form Dropdown', () => {
let wrapper;
const toggleForm = () => {};
const updateConfidentialAttribute = () => {};
2021-03-08 18:12:59 +05:30
const createComponent = (props) => {
2020-05-24 23:13:21 +05:30
wrapper = shallowMount(EditForm, {
propsData: {
...props,
2020-07-28 23:09:34 +05:30
isLoading: false,
fullPath: '',
2020-10-24 23:57:45 +05:30
issuableType: 'issue',
2020-05-24 23:13:21 +05:30
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('when not confidential', () => {
2020-10-24 23:57:45 +05:30
it('renders "You are going to turn on the confidentiality." in the ', () => {
2020-05-24 23:13:21 +05:30
createComponent({
2020-10-24 23:57:45 +05:30
confidential: false,
2020-05-24 23:13:21 +05:30
toggleForm,
updateConfidentialAttribute,
});
2020-10-24 23:57:45 +05:30
expect(wrapper.element).toMatchSnapshot();
2020-05-24 23:13:21 +05:30
});
});
describe('when confidential', () => {
it('renders on or off text based on confidentiality', () => {
createComponent({
2020-10-24 23:57:45 +05:30
confidential: true,
2020-05-24 23:13:21 +05:30
toggleForm,
updateConfidentialAttribute,
});
2020-10-24 23:57:45 +05:30
expect(wrapper.element).toMatchSnapshot();
2020-05-24 23:13:21 +05:30
});
});
});