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
0
Merge Requests
0
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
Léo-Paul Géneau
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
app/assets/javascripts/vue_pipelines_index/stage.js.es6
app/assets/javascripts/vue_pipelines_index/stage.js.es6
+20
-12
spec/features/projects/pipelines/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 @@
required: true,
},
},
mounted() {
/**
* When the user right clicks or cmd/ctrl + click in the job name or action icon,
* the dropdown should not be closed and the link should open in another tab.
* 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();
});
updated() {
if (this.builds) {
this.stopDropdownClickPropagation();
}
},
methods: {
fetchBuilds(e) {
const areaExpanded = e.currentTarget.attributes['aria-expanded'];
...
...
@@ -50,6 +44,20 @@
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: {
buildsOrSpinner() {
...
...
spec/features/projects/pipelines/pipelines_spec.rb
View file @
437ba3fb
...
...
@@ -284,6 +284,18 @@ describe 'Pipelines', :feature, :js do
expect
(
build
.
reload
).
to
be_canceled
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
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