diff options
Diffstat (limited to 'spec/frontend/confidential_merge_request/components')
2 files changed, 34 insertions, 34 deletions
diff --git a/spec/frontend/confidential_merge_request/components/__snapshots__/project_form_group_spec.js.snap b/spec/frontend/confidential_merge_request/components/__snapshots__/project_form_group_spec.js.snap index 271c6356f7e..c2fa6556847 100644 --- a/spec/frontend/confidential_merge_request/components/__snapshots__/project_form_group_spec.js.snap +++ b/spec/frontend/confidential_merge_request/components/__snapshots__/project_form_group_spec.js.snap @@ -17,11 +17,15 @@ exports[`Confidential merge request project form group component renders empty s No forks are available to you. <br /> - - <gl-sprintf-stub - message="To protect this issue's confidentiality, %{forkLink} and set the fork's visibility to private." - /> - + To protect this issue's confidentiality, + <a + class="help-link" + href="https://test.com" + target="_blank" + > + fork this project + </a> + and set the fork's visibility to private. <gl-link-stub class="w-auto p-0 d-inline-block text-primary bg-transparent" href="/help" @@ -52,18 +56,16 @@ exports[`Confidential merge request project form group component renders fork dr </label> <div> - <!----> + <dropdown-stub + projects="[object Object],[object Object]" + selectedproject="[object Object]" + /> <p class="text-muted mt-1 mb-0" > - No forks are available to you. - <br /> - - <gl-sprintf-stub - message="To protect this issue's confidentiality, %{forkLink} and set the fork's visibility to private." - /> + To protect this issue's confidentiality, a private fork of this project was selected. <gl-link-stub class="w-auto p-0 d-inline-block text-primary bg-transparent" diff --git a/spec/frontend/confidential_merge_request/components/project_form_group_spec.js b/spec/frontend/confidential_merge_request/components/project_form_group_spec.js index 67f6d360f52..0e73d50fdb5 100644 --- a/spec/frontend/confidential_merge_request/components/project_form_group_spec.js +++ b/spec/frontend/confidential_merge_request/components/project_form_group_spec.js @@ -1,3 +1,4 @@ +import { GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; import ProjectFormGroup from '~/confidential_merge_request/components/project_form_group.vue'; @@ -21,55 +22,52 @@ const mockData = [ }, }, ]; -let vm; +let wrapper; let mock; function factory(projects = mockData) { mock = new MockAdapter(axios); mock.onGet(/api\/(.*)\/projects\/gitlab-org%2Fgitlab-ce\/forks/).reply(200, projects); - vm = shallowMount(ProjectFormGroup, { + wrapper = shallowMount(ProjectFormGroup, { propsData: { namespacePath: 'gitlab-org', projectPath: 'gitlab-org/gitlab-ce', newForkPath: 'https://test.com', helpPagePath: '/help', }, + stubs: { GlSprintf }, }); + + return axios.waitForAll(); } describe('Confidential merge request project form group component', () => { afterEach(() => { mock.restore(); - vm.destroy(); + wrapper.destroy(); }); - it('renders fork dropdown', () => { - factory(); + it('renders fork dropdown', async () => { + await factory(); - return vm.vm.$nextTick(() => { - expect(vm.element).toMatchSnapshot(); - }); + expect(wrapper.element).toMatchSnapshot(); }); - it('sets selected project as first fork', () => { - factory(); + it('sets selected project as first fork', async () => { + await factory(); - return vm.vm.$nextTick(() => { - expect(vm.vm.selectedProject).toEqual({ - id: 1, - name: 'root / gitlab-ce', - pathWithNamespace: 'root/gitlab-ce', - namespaceFullpath: 'root', - }); + expect(wrapper.vm.selectedProject).toEqual({ + id: 1, + name: 'root / gitlab-ce', + pathWithNamespace: 'root/gitlab-ce', + namespaceFullpath: 'root', }); }); - it('renders empty state when response is empty', () => { - factory([]); + it('renders empty state when response is empty', async () => { + await factory([]); - return vm.vm.$nextTick(() => { - expect(vm.element).toMatchSnapshot(); - }); + expect(wrapper.element).toMatchSnapshot(); }); }); |