gitlab-org--gitlab-foss/spec/frontend/sidebar/confidential_edit_buttons_spec.js

36 lines
853 B
JavaScript
Raw Normal View History

2017-08-07 19:56:16 -04:00
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);
2018-10-17 03:13:26 -04:00
const toggleForm = () => {};
const updateConfidentialAttribute = () => {};
2017-08-07 19:56:16 -04:00
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', () => {
2018-10-17 03:13:26 -04:00
expect(vm1.$el.innerHTML.includes('Turn Off')).toBe(true);
2017-08-07 19:56:16 -04:00
2018-10-17 03:13:26 -04:00
expect(vm2.$el.innerHTML.includes('Turn On')).toBe(true);
2017-08-07 19:56:16 -04:00
});
});