diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 18:09:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 18:09:27 +0300 |
commit | 5169b4a63b1e592e159b5451f81bc3c11602275f (patch) | |
tree | 2cfb5e8f0a4c2343579a2f56c8a60233bb6059b1 /spec/frontend | |
parent | 0594381ba711725d7d676db202902dfcbe9ec4a0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
3 files changed, 34 insertions, 4 deletions
diff --git a/spec/frontend/blob/components/__snapshots__/blob_header_spec.js.snap b/spec/frontend/blob/components/__snapshots__/blob_header_spec.js.snap index 31fb6addcac..db9684239a1 100644 --- a/spec/frontend/blob/components/__snapshots__/blob_header_spec.js.snap +++ b/spec/frontend/blob/components/__snapshots__/blob_header_spec.js.snap @@ -4,9 +4,17 @@ exports[`Blob Header Default Actions rendering matches the snapshot 1`] = ` <div class="js-file-title file-title-flex-parent" > - <blob-filepath-stub - blob="[object Object]" - /> + <div + class="gl-display-flex" + > + <table-of-contents-stub + class="gl-pr-2" + /> + + <blob-filepath-stub + blob="[object Object]" + /> + </div> <div class="gl-display-none gl-sm-display-flex" diff --git a/spec/frontend/blob/components/blob_header_spec.js b/spec/frontend/blob/components/blob_header_spec.js index f841785be42..bd81b1594bf 100644 --- a/spec/frontend/blob/components/blob_header_spec.js +++ b/spec/frontend/blob/components/blob_header_spec.js @@ -3,6 +3,7 @@ import BlobHeader from '~/blob/components/blob_header.vue'; import DefaultActions from '~/blob/components/blob_header_default_actions.vue'; import BlobFilepath from '~/blob/components/blob_header_filepath.vue'; import ViewerSwitcher from '~/blob/components/blob_header_viewer_switcher.vue'; +import TableContents from '~/blob/components/table_contents.vue'; import { Blob } from './mock_data'; @@ -43,6 +44,7 @@ describe('Blob Header Default Actions', () => { it('renders all components', () => { createComponent(); + expect(wrapper.find(TableContents).exists()).toBe(true); expect(wrapper.find(ViewerSwitcher).exists()).toBe(true); expect(findDefaultActions().exists()).toBe(true); expect(wrapper.find(BlobFilepath).exists()).toBe(true); diff --git a/spec/frontend/blob/components/table_contents_spec.js b/spec/frontend/blob/components/table_contents_spec.js index 09633dc5d5d..ade35d39b4f 100644 --- a/spec/frontend/blob/components/table_contents_spec.js +++ b/spec/frontend/blob/components/table_contents_spec.js @@ -32,10 +32,30 @@ describe('Markdown table of contents component', () => { }); describe('not loaded', () => { + const findDropdownItem = () => wrapper.findComponent(GlDropdownItem); + it('does not populate dropdown', () => { createComponent(); - expect(wrapper.findComponent(GlDropdownItem).exists()).toBe(false); + expect(findDropdownItem().exists()).toBe(false); + }); + + it('does not show dropdown when loading blob content', async () => { + createComponent(); + + await setLoaded(false); + + expect(findDropdownItem().exists()).toBe(false); + }); + + it('does not show dropdown when viewing non-rich content', async () => { + createComponent(); + + document.querySelector('.blob-viewer').setAttribute('data-type', 'simple'); + + await setLoaded(true); + + expect(findDropdownItem().exists()).toBe(false); }); }); |