diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/frontend/snippets/components/snippet_header_spec.js | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/frontend/snippets/components/snippet_header_spec.js')
-rw-r--r-- | spec/frontend/snippets/components/snippet_header_spec.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/frontend/snippets/components/snippet_header_spec.js b/spec/frontend/snippets/components/snippet_header_spec.js index 5230910b6f5..0825da92118 100644 --- a/spec/frontend/snippets/components/snippet_header_spec.js +++ b/spec/frontend/snippets/components/snippet_header_spec.js @@ -3,6 +3,7 @@ import DeleteSnippetMutation from '~/snippets/mutations/deleteSnippet.mutation.g import { ApolloMutation } from 'vue-apollo'; import { GlButton, GlModal } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { Blob, BinaryBlob } from 'jest/blob/components/mock_data'; describe('Snippet header component', () => { let wrapper; @@ -20,9 +21,7 @@ describe('Snippet header component', () => { author: { name: 'Thor Odinson', }, - blob: { - binary: false, - }, + blobs: [Blob], }; const mutationVariables = { mutation: DeleteSnippetMutation, @@ -49,7 +48,6 @@ describe('Snippet header component', () => { mutationRes = mutationTypes.RESOLVE, snippetProps = {}, } = {}) { - // const defaultProps = Object.assign({}, snippet, snippetProps); const defaultProps = Object.assign(snippet, snippetProps); if (permissions) { Object.assign(defaultProps.userPermissions, { @@ -131,15 +129,18 @@ describe('Snippet header component', () => { expect(wrapper.find(GlModal).exists()).toBe(true); }); - it('renders Edit button as disabled for binary snippets', () => { + it.each` + blobs | isDisabled | condition + ${[Blob]} | ${false} | ${'no binary'} + ${[Blob, BinaryBlob]} | ${true} | ${'several blobs. incl. a binary'} + ${[BinaryBlob]} | ${true} | ${'binary'} + `('renders Edit button when snippet contains $condition file', ({ blobs, isDisabled }) => { createComponent({ snippetProps: { - blob: { - binary: true, - }, + blobs, }, }); - expect(wrapper.find('[href*="edit"]').props('disabled')).toBe(true); + expect(wrapper.find('[href*="edit"]').props('disabled')).toBe(isDisabled); }); describe('Delete mutation', () => { |