Commit 22993786 authored by Samantha Ming's avatar Samantha Ming

Hide copy and raw buttons in blob header

Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/335776
parent 858320c2
...@@ -116,6 +116,9 @@ export default { ...@@ -116,6 +116,9 @@ export default {
isLoading() { isLoading() {
return this.$apollo.queries.project.loading || this.isLoadingLegacyViewer; return this.$apollo.queries.project.loading || this.isLoadingLegacyViewer;
}, },
isBinaryFileType() {
return this.isBinary || this.viewer.fileType === 'download';
},
blobInfo() { blobInfo() {
const nodes = this.project?.repository?.blobs?.nodes; const nodes = this.project?.repository?.blobs?.nodes;
...@@ -169,7 +172,7 @@ export default { ...@@ -169,7 +172,7 @@ export default {
<blob-header <blob-header
:blob="blobInfo" :blob="blobInfo"
:hide-viewer-switcher="!hasRichViewer || isBinary" :hide-viewer-switcher="!hasRichViewer || isBinary"
:is-binary="isBinary" :is-binary="isBinaryFileType"
:active-viewer-type="viewer.type" :active-viewer-type="viewer.type"
:has-render-error="hasRenderError" :has-render-error="hasRenderError"
@viewer-changed="switchViewer" @viewer-changed="switchViewer"
......
...@@ -349,15 +349,23 @@ describe('Blob content viewer component', () => { ...@@ -349,15 +349,23 @@ describe('Blob content viewer component', () => {
}); });
}); });
it('passes the correct isBinary value to blob header when viewing a binary file', async () => { describe('blob header binary file', () => {
fullFactory({ it.each([richMockData, { simpleViewer: { fileType: 'download' } }])(
mockData: { blobInfo: richMockData, isBinary: true }, 'passes the correct isBinary value when viewing a binary file',
stubs: { BlobContent: true, BlobReplace: true }, async (blobInfo) => {
}); fullFactory({
mockData: {
blobInfo,
isBinary: true,
},
stubs: { BlobContent: true, BlobReplace: true },
});
await nextTick(); await nextTick();
expect(findBlobHeader().props('isBinary')).toBe(true); expect(findBlobHeader().props('isBinary')).toBe(true);
},
);
}); });
describe('BlobButtonGroup', () => { describe('BlobButtonGroup', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment