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
6a6bd2e8
Commit
6a6bd2e8
authored
May 12, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed redirection when deleting a project snippet
parent
911c4841
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
app/assets/javascripts/snippets/components/snippet_header.vue
...assets/javascripts/snippets/components/snippet_header.vue
+1
-1
changelogs/unreleased/213341-project-snippet-delete-redirect.yml
...ogs/unreleased/213341-project-snippet-delete-redirect.yml
+5
-0
spec/frontend/snippets/components/snippet_header_spec.js
spec/frontend/snippets/components/snippet_header_spec.js
+27
-7
No files found.
app/assets/javascripts/snippets/components/snippet_header.vue
View file @
6a6bd2e8
...
...
@@ -127,7 +127,7 @@ export default {
},
methods
:
{
redirectToSnippets
()
{
window
.
location
.
pathname
=
'
dashboard/snippets
'
;
window
.
location
.
pathname
=
this
.
snippet
.
project
?.
fullPath
||
'
dashboard/snippets
'
;
},
closeDeleteModal
()
{
this
.
$refs
.
deleteModal
.
hide
();
...
...
changelogs/unreleased/213341-project-snippet-delete-redirect.yml
0 → 100644
View file @
6a6bd2e8
---
title
:
Fixed redirection when deleting a project snippet
merge_request
:
31709
author
:
type
:
fixed
spec/frontend/snippets/components/snippet_header_spec.js
View file @
6a6bd2e8
...
...
@@ -172,14 +172,34 @@ describe('Snippet header component', () => {
});
});
it
(
'
closes modal and redirects to snippets listing in case of successful mutation
'
,
()
=>
{
createComponent
();
wrapper
.
vm
.
closeDeleteModal
=
jest
.
fn
();
describe
(
'
in case of successful mutation, closes modal and redirects to correct listing
'
,
()
=>
{
const
createDeleteSnippet
=
(
snippetProps
=
{})
=>
{
createComponent
({
snippetProps
,
});
wrapper
.
vm
.
closeDeleteModal
=
jest
.
fn
();
wrapper
.
vm
.
deleteSnippet
();
return
wrapper
.
vm
.
$nextTick
();
};
wrapper
.
vm
.
deleteSnippet
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
vm
.
closeDeleteModal
).
toHaveBeenCalled
();
expect
(
window
.
location
.
pathname
).
toEqual
(
'
dashboard/snippets
'
);
it
(
'
redirects to dashboard/snippets for personal snippet
'
,
()
=>
{
return
createDeleteSnippet
().
then
(()
=>
{
expect
(
wrapper
.
vm
.
closeDeleteModal
).
toHaveBeenCalled
();
expect
(
window
.
location
.
pathname
).
toBe
(
'
dashboard/snippets
'
);
});
});
it
(
'
redirects to project snippets for project snippet
'
,
()
=>
{
const
fullPath
=
'
foo/bar
'
;
return
createDeleteSnippet
({
project
:
{
fullPath
,
},
}).
then
(()
=>
{
expect
(
wrapper
.
vm
.
closeDeleteModal
).
toHaveBeenCalled
();
expect
(
window
.
location
.
pathname
).
toBe
(
fullPath
);
});
});
});
});
...
...
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