diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 12:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 12:10:03 +0300 |
commit | 7717a594e88951ba2b92358aa9a10a0030799678 (patch) | |
tree | 6206e93f20ee0ab44cbf31ae6dcb9d918d77fefe /spec/frontend | |
parent | a20bd972bcc5e653641e6291a80957ce85958988 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/repository/components/blob_content_viewer_spec.js | 27 | ||||
-rw-r--r-- | spec/frontend/repository/mock_data.js | 1 |
2 files changed, 21 insertions, 7 deletions
diff --git a/spec/frontend/repository/components/blob_content_viewer_spec.js b/spec/frontend/repository/components/blob_content_viewer_spec.js index 2cb8b0b679e..d40e97bf5a3 100644 --- a/spec/frontend/repository/components/blob_content_viewer_spec.js +++ b/spec/frontend/repository/components/blob_content_viewer_spec.js @@ -19,6 +19,7 @@ import TextViewer from '~/repository/components/blob_viewers/text_viewer.vue'; import blobInfoQuery from '~/repository/queries/blob_info.query.graphql'; import { redirectTo } from '~/lib/utils/url_utility'; import { isLoggedIn } from '~/lib/utils/common_utils'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { simpleViewerMock, richViewerMock, @@ -72,13 +73,15 @@ const createComponent = async (mockData = {}, mountFn = shallowMount) => { const fakeApollo = createMockApollo([[blobInfoQuery, mockResolver]]); - wrapper = mountFn(BlobContentViewer, { - localVue, - apolloProvider: fakeApollo, - propsData: propsMock, - mixins: [{ data: () => ({ ref: refMock }) }], - provide: { ...inject }, - }); + wrapper = extendedWrapper( + mountFn(BlobContentViewer, { + localVue, + apolloProvider: fakeApollo, + propsData: propsMock, + mixins: [{ data: () => ({ ref: refMock }) }], + provide: { ...inject }, + }), + ); wrapper.setData({ project, isBinary }); @@ -89,6 +92,7 @@ describe('Blob content viewer component', () => { const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findBlobHeader = () => wrapper.findComponent(BlobHeader); const findBlobEdit = () => wrapper.findComponent(BlobEdit); + const findPipelineEditor = () => wrapper.findByTestId('pipeline-editor'); const findBlobContent = () => wrapper.findComponent(BlobContent); const findBlobButtonGroup = () => wrapper.findComponent(BlobButtonGroup); const findForkSuggestion = () => wrapper.findComponent(ForkSuggestion); @@ -270,6 +274,15 @@ describe('Blob content viewer component', () => { }); }); + it('renders Pipeline Editor button for .gitlab-ci files', async () => { + const pipelineEditorPath = 'some/path/.gitlab-ce'; + const blob = { ...simpleViewerMock, pipelineEditorPath }; + await createComponent({ blob, inject: { BlobContent: true, BlobReplace: true } }, mount); + + expect(findPipelineEditor().exists()).toBe(true); + expect(findPipelineEditor().attributes('href')).toBe(pipelineEditorPath); + }); + describe('blob header binary file', () => { it('passes the correct isBinary value when viewing a binary file', async () => { await createComponent({ blob: richViewerMock, isBinary: true }); diff --git a/spec/frontend/repository/mock_data.js b/spec/frontend/repository/mock_data.js index a3c60032c8c..adf5991ac3c 100644 --- a/spec/frontend/repository/mock_data.js +++ b/spec/frontend/repository/mock_data.js @@ -14,6 +14,7 @@ export const simpleViewerMock = { storedExternally: false, rawPath: 'some_file.js', replacePath: 'some_file.js/replace', + pipelineEditorPath: '', simpleViewer: { fileType: 'text', tooLarge: false, |