summaryrefslogtreecommitdiff
path: root/spec/frontend/sidebar/confidential/edit_form_spec.js
blob: 6b571df10ae152bf035d49b142ac02914ab116cd (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
41
42
43
44
45
46
47
48
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 = () => {};

  const createComponent = (props) => {
    wrapper = shallowMount(EditForm, {
      propsData: {
        ...props,
        isLoading: false,
        fullPath: '',
        issuableType: 'issue',
      },
    });
  };

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

  describe('when not confidential', () => {
    it('renders "You are going to turn on the confidentiality." in the ', () => {
      createComponent({
        confidential: false,
        toggleForm,
        updateConfidentialAttribute,
      });

      expect(wrapper.element).toMatchSnapshot();
    });
  });

  describe('when confidential', () => {
    it('renders on or off text based on confidentiality', () => {
      createComponent({
        confidential: true,
        toggleForm,
        updateConfidentialAttribute,
      });

      expect(wrapper.element).toMatchSnapshot();
    });
  });
});