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
c5c20891
Commit
c5c20891
authored
Feb 18, 2021
by
mgandres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto-scroll to top of page upon committing in pipeline editor
parent
48d4c300
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
...ssets/javascripts/pipeline_editor/pipeline_editor_app.vue
+2
-0
changelogs/unreleased/auto-scroll-pipeline-editor-on-commit.yml
...logs/unreleased/auto-scroll-pipeline-editor-on-commit.yml
+5
-0
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
+16
-0
No files found.
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
View file @
c5c20891
...
...
@@ -186,11 +186,13 @@ export default {
this
.
showSuccessAlert
=
false
;
},
reportFailure
(
type
,
reasons
=
[])
{
window
.
scrollTo
({
top
:
0
,
behavior
:
'
smooth
'
});
this
.
showFailureAlert
=
true
;
this
.
failureType
=
type
;
this
.
failureReasons
=
reasons
;
},
reportSuccess
(
type
)
{
window
.
scrollTo
({
top
:
0
,
behavior
:
'
smooth
'
});
this
.
showSuccessAlert
=
true
;
this
.
successType
=
type
;
},
...
...
changelogs/unreleased/auto-scroll-pipeline-editor-on-commit.yml
0 → 100644
View file @
c5c20891
---
title
:
Auto-scroll to top of page upon committing in pipeline editor
merge_request
:
54657
author
:
type
:
changed
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
View file @
c5c20891
...
...
@@ -193,6 +193,7 @@ describe('Pipeline editor app component', () => {
describe
(
'
and the commit mutation succeeds
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
scrollTo
=
jest
.
fn
();
createComponent
();
findEditorHome
().
vm
.
$emit
(
'
commit
'
,
{
type
:
COMMIT_SUCCESS
});
...
...
@@ -201,11 +202,16 @@ describe('Pipeline editor app component', () => {
it
(
'
shows a confirmation message
'
,
()
=>
{
expect
(
findAlert
().
text
()).
toBe
(
wrapper
.
vm
.
$options
.
successTexts
[
COMMIT_SUCCESS
]);
});
it
(
'
scrolls to the top of the page to bring attention to the confirmation message
'
,
()
=>
{
expect
(
window
.
scrollTo
).
toHaveBeenCalledWith
({
top
:
0
,
behavior
:
'
smooth
'
});
});
});
describe
(
'
and the commit mutation fails
'
,
()
=>
{
const
commitFailedReasons
=
[
'
Commit failed
'
];
beforeEach
(()
=>
{
window
.
scrollTo
=
jest
.
fn
();
createComponent
();
findEditorHome
().
vm
.
$emit
(
'
showError
'
,
{
...
...
@@ -219,11 +225,17 @@ describe('Pipeline editor app component', () => {
`
${
updateFailureMessage
}
${
commitFailedReasons
[
0
]}
`
,
);
});
it
(
'
scrolls to the top of the page to bring attention to the error message
'
,
()
=>
{
expect
(
window
.
scrollTo
).
toHaveBeenCalledWith
({
top
:
0
,
behavior
:
'
smooth
'
});
});
});
describe
(
'
when an unknown error occurs
'
,
()
=>
{
const
unknownReasons
=
[
'
Commit failed
'
];
beforeEach
(()
=>
{
window
.
scrollTo
=
jest
.
fn
();
createComponent
();
findEditorHome
().
vm
.
$emit
(
'
showError
'
,
{
...
...
@@ -237,6 +249,10 @@ describe('Pipeline editor app component', () => {
`
${
updateFailureMessage
}
${
unknownReasons
[
0
]}
`
,
);
});
it
(
'
scrolls to the top of the page to bring attention to the error message
'
,
()
=>
{
expect
(
window
.
scrollTo
).
toHaveBeenCalledWith
({
top
:
0
,
behavior
:
'
smooth
'
});
});
});
});
});
...
...
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