diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 12:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 12:09:34 +0300 |
commit | 97f0ae7454597105a27df65ffb772949d9d4f3cb (patch) | |
tree | 0bf4888e0e9082c8f168a211390a73a6ae810cef /spec/frontend/snippets | |
parent | 5ebc4d92cd5fbb46c627eb04d500384893dbe2b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/snippets')
-rw-r--r-- | spec/frontend/snippets/components/snippet_blob_view_spec.js | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/spec/frontend/snippets/components/snippet_blob_view_spec.js b/spec/frontend/snippets/components/snippet_blob_view_spec.js index c4f1dd0ca35..1f6038bc7f0 100644 --- a/spec/frontend/snippets/components/snippet_blob_view_spec.js +++ b/spec/frontend/snippets/components/snippet_blob_view_spec.js @@ -1,5 +1,4 @@ import { mount } from '@vue/test-utils'; -import { GlLoadingIcon } from '@gitlab/ui'; import SnippetBlobView from '~/snippets/components/snippet_blob_view.vue'; import BlobHeader from '~/blob/components/blob_header.vue'; import BlobEmbeddable from '~/blob/components/blob_embeddable.vue'; @@ -19,23 +18,15 @@ describe('Blob Embeddable', () => { id: 'gid://foo.bar/snippet', webUrl: 'https://foo.bar', visibilityLevel: SNIPPET_VISIBILITY_PUBLIC, + blob: BlobMock, }; const dataMock = { - blob: BlobMock, activeViewerType: SimpleViewerMock.type, }; - function createComponent( - props = {}, - data = dataMock, - blobLoading = false, - contentLoading = false, - ) { + function createComponent(props = {}, data = dataMock, contentLoading = false) { const $apollo = { queries: { - blob: { - loading: blobLoading, - }, blobContent: { loading: contentLoading, }, @@ -87,12 +78,6 @@ describe('Blob Embeddable', () => { expect(wrapper.find(BlobEmbeddable).exists()).toBe(true); }); - it('shows loading icon while blob data is in flight', () => { - createComponent({}, dataMock, true); - expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); - expect(wrapper.find('.snippet-file-content').exists()).toBe(false); - }); - it('sets simple viewer correctly', () => { createComponent(); expect(wrapper.find(SimpleViewer).exists()).toBe(true); @@ -133,14 +118,14 @@ describe('Blob Embeddable', () => { }); it('renders simple viewer by default if URL contains hash', () => { - createComponent(); + createComponent({}, {}); expect(wrapper.vm.activeViewerType).toBe(SimpleViewerMock.type); expect(wrapper.find(SimpleViewer).exists()).toBe(true); }); describe('switchViewer()', () => { - it('by default switches to the passed viewer', () => { + it('switches to the passed viewer', () => { createComponent(); wrapper.vm.switchViewer(RichViewerMock.type); @@ -157,22 +142,6 @@ describe('Blob Embeddable', () => { expect(wrapper.find(SimpleViewer).exists()).toBe(true); }); }); - - it('respects hash over richViewer in the blob when corresponding parameter is passed', () => { - createComponent( - {}, - { - blob: BlobMock, - }, - ); - expect(wrapper.vm.blob.richViewer).toEqual(expect.any(Object)); - - wrapper.vm.switchViewer(RichViewerMock.type, true); - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.vm.activeViewerType).toBe(SimpleViewerMock.type); - expect(wrapper.find(SimpleViewer).exists()).toBe(true); - }); - }); }); }); }); |