confidential_edit_buttons_spec.js 853 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
import Vue from 'vue';
import editFormButtons from '~/sidebar/components/confidential/edit_form_buttons.vue';

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

  beforeEach(() => {
    const Component = Vue.extend(editFormButtons);
Mike Greiling's avatar
Mike Greiling committed
10 11
    const toggleForm = () => {};
    const updateConfidentialAttribute = () => {};
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

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

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

  it('renders on or off text based on confidentiality', () => {
Mike Greiling's avatar
Mike Greiling committed
31
    expect(vm1.$el.innerHTML.includes('Turn Off')).toBe(true);
32

Mike Greiling's avatar
Mike Greiling committed
33
    expect(vm2.$el.innerHTML.includes('Turn On')).toBe(true);
34 35
  });
});