summaryrefslogtreecommitdiff
path: root/spec/javascripts/sidebar/confidential_edit_form_buttons_spec.js
blob: 369088cb2584b33cf049fd6f2fc0231e989eb733 (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
import Vue from 'vue';
import editForm from '~/sidebar/components/confidential/edit_form.vue';

describe('Edit Form Dropdown', () => {
  let vm1;
  let vm2;

  beforeEach(() => {
    const Component = Vue.extend(editForm);
    const toggleForm = () => {};
    const updateConfidentialAttribute = () => {};

    vm1 = new Component({
      propsData: {
        isConfidential: true,
        toggleForm,
        updateConfidentialAttribute,
      },
    }).$mount();

    vm2 = new Component({
      propsData: {
        isConfidential: false,
        toggleForm,
        updateConfidentialAttribute,
      },
    }).$mount();
  });

  it('renders on the appropriate warning text', () => {
    expect(vm1.$el.innerHTML.includes('You are going to turn off the confidentiality.')).toBe(true);

    expect(vm2.$el.innerHTML.includes('You are going to turn on the confidentiality.')).toBe(true);
  });
});