From 9f46488805e86b1bc341ea1620b866016c2ce5ed Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 May 2020 14:34:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-0-stable-ee --- .../sidebar/confidential_issue_sidebar_spec.js | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'spec/frontend/sidebar/confidential_issue_sidebar_spec.js') diff --git a/spec/frontend/sidebar/confidential_issue_sidebar_spec.js b/spec/frontend/sidebar/confidential_issue_sidebar_spec.js index 4853d9795b1..e7a64ec5ed9 100644 --- a/spec/frontend/sidebar/confidential_issue_sidebar_spec.js +++ b/spec/frontend/sidebar/confidential_issue_sidebar_spec.js @@ -5,6 +5,7 @@ import EditForm from '~/sidebar/components/confidential/edit_form.vue'; import SidebarService from '~/sidebar/services/sidebar_service'; import createFlash from '~/flash'; import RecaptchaModal from '~/vue_shared/components/recaptcha_modal.vue'; +import createStore from '~/notes/stores'; jest.mock('~/flash'); jest.mock('~/sidebar/services/sidebar_service'); @@ -31,8 +32,10 @@ describe('Confidential Issue Sidebar Block', () => { }; const createComponent = propsData => { + const store = createStore(); const service = new SidebarService(); wrapper = shallowMount(ConfidentialIssueSidebar, { + store, propsData: { service, ...propsData, @@ -49,29 +52,31 @@ describe('Confidential Issue Sidebar Block', () => { }); it.each` - isConfidential | isEditable - ${false} | ${false} - ${false} | ${true} - ${true} | ${false} - ${true} | ${true} + confidential | isEditable + ${false} | ${false} + ${false} | ${true} + ${true} | ${false} + ${true} | ${true} `( - 'renders for isConfidential = $isConfidential and isEditable = $isEditable', - ({ isConfidential, isEditable }) => { + 'renders for confidential = $confidential and isEditable = $isEditable', + ({ confidential, isEditable }) => { createComponent({ - isConfidential, isEditable, }); + wrapper.vm.$store.state.noteableData.confidential = confidential; - expect(wrapper.element).toMatchSnapshot(); + return wrapper.vm.$nextTick().then(() => { + expect(wrapper.element).toMatchSnapshot(); + }); }, ); describe('if editable', () => { beforeEach(() => { createComponent({ - isConfidential: true, isEditable: true, }); + wrapper.vm.$store.state.noteableData.confidential = true; }); it('displays the edit form when editable', () => { -- cgit v1.2.1