blob: acdfb5139bfec21b53f495a399ff9100b1cbb2a0 (
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
|
import { shallowMount } from '@vue/test-utils';
import EditFormButtons from '~/sidebar/components/confidential/edit_form_buttons.vue';
describe('Edit Form Buttons', () => {
let wrapper;
const findConfidentialToggle = () => wrapper.find('[data-testid="confidential-toggle"]');
const createComponent = props => {
wrapper = shallowMount(EditFormButtons, {
propsData: {
updateConfidentialAttribute: () => {},
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('when not confidential', () => {
it('renders Turn On in the ', () => {
createComponent({
isConfidential: false,
});
expect(findConfidentialToggle().text()).toBe('Turn On');
});
});
describe('when confidential', () => {
it('renders on or off text based on confidentiality', () => {
createComponent({
isConfidential: true,
});
expect(findConfidentialToggle().text()).toBe('Turn Off');
});
});
});
|