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
9860f64c
Commit
9860f64c
authored
Aug 04, 2021
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display correct nav block when viewing blob
Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/334790
parent
06b79431
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
app/assets/javascripts/repository/components/breadcrumbs.vue
app/assets/javascripts/repository/components/breadcrumbs.vue
+2
-1
spec/frontend/repository/components/breadcrumbs_spec.js
spec/frontend/repository/components/breadcrumbs_spec.js
+27
-2
No files found.
app/assets/javascripts/repository/components/breadcrumbs.vue
View file @
9860f64c
...
...
@@ -247,7 +247,8 @@ export default {
return
items
;
},
renderAddToTreeDropdown
()
{
return
this
.
canCollaborate
||
this
.
canCreateMrFromFork
;
const
isBlobPath
=
this
.
$route
.
name
===
'
blobPath
'
||
this
.
$route
.
name
===
'
blobPathDecoded
'
;
return
!
isBlobPath
&&
(
this
.
canCollaborate
||
this
.
canCreateMrFromFork
);
},
},
methods
:
{
...
...
spec/frontend/repository/components/breadcrumbs_spec.js
View file @
9860f64c
...
...
@@ -3,10 +3,14 @@ import { shallowMount, RouterLinkStub } from '@vue/test-utils';
import
Breadcrumbs
from
'
~/repository/components/breadcrumbs.vue
'
;
import
UploadBlobModal
from
'
~/repository/components/upload_blob_modal.vue
'
;
const
defaultMockRoute
=
{
name
:
'
blobPath
'
,
};
describe
(
'
Repository breadcrumbs component
'
,
()
=>
{
let
wrapper
;
const
factory
=
(
currentPath
,
extraProps
=
{})
=>
{
const
factory
=
(
currentPath
,
extraProps
=
{}
,
mockRoute
=
{}
)
=>
{
const
$apollo
=
{
queries
:
{
userPermissions
:
{
...
...
@@ -23,7 +27,13 @@ describe('Repository breadcrumbs component', () => {
stubs
:
{
RouterLink
:
RouterLinkStub
,
},
mocks
:
{
$apollo
},
mocks
:
{
$route
:
{
defaultMockRoute
,
...
mockRoute
,
},
$apollo
,
},
});
};
...
...
@@ -69,6 +79,21 @@ describe('Repository breadcrumbs component', () => {
expect
(
wrapper
.
find
(
GlDropdown
).
exists
()).
toBe
(
false
);
});
it
.
each
`
routeName | isRendered
${
'
blobPath
'
}
|
${
false
}
${
'
blobPathDecoded
'
}
|
${
false
}
${
'
treePath
'
}
|
${
true
}
${
'
treePathDecoded
'
}
|
${
true
}
${
'
projectRoot
'
}
|
${
true
}
`
(
'
does render add to tree dropdown $isRendered when route is $routeName
'
,
({
routeName
,
isRendered
})
=>
{
factory
(
'
app/assets/javascripts.js
'
,
{
canCollaborate
:
true
},
{
name
:
routeName
});
expect
(
wrapper
.
find
(
GlDropdown
).
exists
()).
toBe
(
isRendered
);
},
);
it
(
'
renders add to tree dropdown when permissions are true
'
,
async
()
=>
{
factory
(
'
/
'
,
{
canCollaborate
:
true
});
...
...
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