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 {
isLoading() {
return this.$apollo.queries.project.loading || this.isLoadingLegacyViewer;
},
isBinaryFileType() {
return this.isBinary || this.viewer.fileType === 'download';
},
blobInfo() {
const nodes = this.project?.repository?.blobs?.nodes;
......@@ -169,7 +172,7 @@ export default {
<blob-header
:blob="blobInfo"
:hide-viewer-switcher="!hasRichViewer || isBinary"
:is-binary="isBinary"
:is-binary="isBinaryFileType"
:active-viewer-type="viewer.type"
:has-render-error="hasRenderError"
@viewer-changed="switchViewer"
......
......@@ -349,15 +349,23 @@ describe('Blob content viewer component', () => {
});
});
it('passes the correct isBinary value to blob header when viewing a binary file', async () => {
fullFactory({
mockData: { blobInfo: richMockData, isBinary: true },
stubs: { BlobContent: true, BlobReplace: true },
});
describe('blob header binary file', () => {
it.each([richMockData, { simpleViewer: { fileType: 'download' } }])(
'passes the correct isBinary value when viewing a binary file',
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', () => {
......
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