BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
437ba3fb
Commit
437ba3fb
authored
Feb 22, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent propagation of click even in job name inside dropdown.
parent
238ca048
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
stage.js.es6
app/assets/javascripts/vue_pipelines_index/stage.js.es6
+20
-12
pipelines_spec.rb
spec/features/projects/pipelines/pipelines_spec.rb
+12
-0
No files found.
app/assets/javascripts/vue_pipelines_index/stage.js.es6
View file @
437ba3fb
...
@@ -23,19 +23,13 @@
...
@@ -23,19 +23,13 @@
required: true,
required: true,
},
},
},
},
mounted() {
/**
updated() {
* When the user right clicks or cmd/ctrl + click in the job name or action icon,
if (this.builds) {
* the dropdown should not be closed and the link should open in another tab.
this.stopDropdownClickPropagation();
* If the target is a svg we stop propagation in order to prevent
}
* the default behavior of the dropdown.
*/
console.log('I am called');
$('.js-builds-dropdown-list').on('click', (e) => {
console.log('i am in event');
e.stopPropagation();
});
},
},
methods: {
methods: {
fetchBuilds(e) {
fetchBuilds(e) {
const areaExpanded = e.currentTarget.attributes['aria-expanded'];
const areaExpanded = e.currentTarget.attributes['aria-expanded'];
...
@@ -50,6 +44,20 @@
...
@@ -50,6 +44,20 @@
return flash;
return flash;
});
});
},
},
/**
* When the user right clicks or cmd/ctrl + click in the job name
* the dropdown should not be closed and the link should open in another tab,
* so we stop propagation of the click event inside the dropdown.
*
* Since this component is rendered multiple times per page we need to guarantee we only
* target the click event of this component.
*/
stopDropdownClickPropagation() {
$(this.$el.querySelectorAll('.js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item')).on('click', (e) => {
e.stopPropagation();
});
},
},
},
computed: {
computed: {
buildsOrSpinner() {
buildsOrSpinner() {
...
...
spec/features/projects/pipelines/pipelines_spec.rb
View file @
437ba3fb
...
@@ -284,6 +284,18 @@ describe 'Pipelines', :feature, :js do
...
@@ -284,6 +284,18 @@ describe 'Pipelines', :feature, :js do
expect
(
build
.
reload
).
to
be_canceled
expect
(
build
.
reload
).
to
be_canceled
end
end
end
end
context
'dropdown jobs list'
do
it
'should keep the dropdown open when the user ctr/cmd + clicks in the job name'
do
find
(
'.js-builds-dropdown-button'
).
trigger
(
'click'
)
execute_script
(
'var e = $.Event("keydown", { keyCode: 64 }); $("body").trigger(e);'
)
find
(
'.mini-pipeline-graph-dropdown-item'
).
trigger
(
'click'
)
expect
(
page
).
to
have_selector
(
'.js-ci-action-icon'
)
end
end
end
end
context
'with pagination'
do
context
'with pagination'
do
...
...
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