Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
359718e3
Commit
359718e3
authored
Sep 01, 2021
by
jerasmus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display correct header buttons when viewing binary
Displays correct header buttons when viewing binary
parent
96f06f05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
app/assets/javascripts/repository/components/blob_content_viewer.vue
...javascripts/repository/components/blob_content_viewer.vue
+3
-3
spec/frontend/repository/components/blob_content_viewer_spec.js
...rontend/repository/components/blob_content_viewer_spec.js
+24
-0
No files found.
app/assets/javascripts/repository/components/blob_content_viewer.vue
View file @
359718e3
...
...
@@ -118,7 +118,7 @@ export default {
return
this
.
$apollo
.
queries
.
project
.
loading
||
this
.
isLoadingLegacyViewer
;
},
isBinaryFileType
()
{
return
this
.
isBinary
||
this
.
viewer
.
fileType
===
'
download
'
;
return
this
.
isBinary
||
this
.
blobInfo
.
simpleViewer
?.
fileType
!==
'
text
'
;
},
blobInfo
()
{
const
nodes
=
this
.
project
?.
repository
?.
blobs
?.
nodes
||
[];
...
...
@@ -180,7 +180,7 @@ export default {
<div
v-if=
"blobInfo && !isLoading"
class=
"file-holder"
>
<blob-header
:blob=
"blobInfo"
:hide-viewer-switcher=
"!hasRichViewer || isBinary"
:hide-viewer-switcher=
"!hasRichViewer || isBinary
FileType
"
:is-binary=
"isBinaryFileType"
:active-viewer-type=
"viewer.type"
:has-render-error=
"hasRenderError"
...
...
@@ -188,7 +188,7 @@ export default {
>
<template
#actions
>
<blob-edit
:show-edit-button=
"!isBinary"
:show-edit-button=
"!isBinary
FileType
"
:edit-path=
"blobInfo.editBlobPath"
:web-ide-path=
"blobInfo.ideEditPath"
/>
...
...
spec/frontend/repository/components/blob_content_viewer_spec.js
View file @
359718e3
...
...
@@ -375,6 +375,30 @@ describe('Blob content viewer component', () => {
expect
(
findBlobHeader
().
props
(
'
isBinary
'
)).
toBe
(
true
);
},
);
it
(
'
passes the correct header props when viewing a non-text file
'
,
async
()
=>
{
fullFactory
({
mockData
:
{
blobInfo
:
{
...
simpleMockData
,
simpleViewer
:
{
...
simpleMockData
.
simpleViewer
,
fileType
:
'
image
'
,
},
},
},
stubs
:
{
BlobContent
:
true
,
BlobReplace
:
true
,
},
});
await
nextTick
();
expect
(
findBlobHeader
().
props
(
'
hideViewerSwitcher
'
)).
toBe
(
true
);
expect
(
findBlobHeader
().
props
(
'
isBinary
'
)).
toBe
(
true
);
expect
(
findBlobEdit
().
props
(
'
showEditButton
'
)).
toBe
(
false
);
});
});
describe
(
'
BlobButtonGroup
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment