Commit 7a4e3eef authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch '335776-hide-copy-and-raw-buttons' into 'master'

Hide copy and raw buttons when viewing download file

See merge request gitlab-org/gitlab!66983
parents b5edb1c7 22993786
......@@ -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 () => {
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: richMockData, isBinary: true },
mockData: {
blobInfo,
isBinary: true,
},
stubs: { BlobContent: true, BlobReplace: true },
});
await nextTick();
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