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
eb719b9f
Commit
eb719b9f
authored
Jun 11, 2019
by
Sam Bigelow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow command and control click to work on MR tabs
parent
9bf141cf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
23 deletions
+38
-23
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+5
-5
changelogs/unreleased/57813-merge-request-tabs-do-not-handle-ctrl-click-correctly.yml
...merge-request-tabs-do-not-handle-ctrl-click-correctly.yml
+5
-0
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+28
-18
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
eb719b9f
...
@@ -147,14 +147,14 @@ export default class MergeRequestTabs {
...
@@ -147,14 +147,14 @@ export default class MergeRequestTabs {
e
.
stopImmediatePropagation
();
e
.
stopImmediatePropagation
();
e
.
preventDefault
();
e
.
preventDefault
();
const
{
action
}
=
e
.
currentTarget
.
dataset
;
const
{
action
}
=
e
.
currentTarget
.
dataset
||
{}
;
if
(
action
)
{
if
(
isMetaClick
(
e
))
{
const
href
=
e
.
currentTarget
.
getAttribute
(
'
href
'
);
this
.
tabShown
(
action
,
href
);
}
else
if
(
isMetaClick
(
e
))
{
const
targetLink
=
e
.
currentTarget
.
getAttribute
(
'
href
'
);
const
targetLink
=
e
.
currentTarget
.
getAttribute
(
'
href
'
);
window
.
open
(
targetLink
,
'
_blank
'
);
window
.
open
(
targetLink
,
'
_blank
'
);
}
else
if
(
action
)
{
const
href
=
e
.
currentTarget
.
getAttribute
(
'
href
'
);
this
.
tabShown
(
action
,
href
);
}
}
}
}
}
}
...
...
changelogs/unreleased/57813-merge-request-tabs-do-not-handle-ctrl-click-correctly.yml
0 → 100644
View file @
eb719b9f
---
title
:
Allow command/control click to open link in new tab on Merge Request tabs
merge_request
:
29506
author
:
type
:
fixed
spec/javascripts/merge_request_tabs_spec.js
View file @
eb719b9f
...
@@ -46,15 +46,30 @@ describe('MergeRequestTabs', function() {
...
@@ -46,15 +46,30 @@ describe('MergeRequestTabs', function() {
describe
(
'
opensInNewTab
'
,
function
()
{
describe
(
'
opensInNewTab
'
,
function
()
{
var
tabUrl
;
var
tabUrl
;
var
windowTarget
=
'
_blank
'
;
var
windowTarget
=
'
_blank
'
;
let
clickTabParams
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html
'
);
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html
'
);
tabUrl
=
$
(
'
.commits-tab a
'
).
attr
(
'
href
'
);
tabUrl
=
$
(
'
.commits-tab a
'
).
attr
(
'
href
'
);
clickTabParams
=
{
metaKey
:
false
,
ctrlKey
:
false
,
which
:
1
,
stopImmediatePropagation
:
function
()
{},
preventDefault
:
function
()
{},
currentTarget
:
{
getAttribute
:
function
(
attr
)
{
return
attr
===
'
href
'
?
tabUrl
:
null
;
},
},
};
});
});
describe
(
'
meta click
'
,
()
=>
{
describe
(
'
meta click
'
,
()
=>
{
let
metakeyEvent
;
let
metakeyEvent
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
});
});
...
@@ -67,6 +82,8 @@ describe('MergeRequestTabs', function() {
...
@@ -67,6 +82,8 @@ describe('MergeRequestTabs', function() {
this
.
class
.
bindEvents
();
this
.
class
.
bindEvents
();
$
(
'
.merge-request-tabs .commits-tab a
'
).
trigger
(
metakeyEvent
);
$
(
'
.merge-request-tabs .commits-tab a
'
).
trigger
(
metakeyEvent
);
expect
(
window
.
open
).
toHaveBeenCalled
();
});
});
it
(
'
opens page when commits badge is clicked
'
,
function
()
{
it
(
'
opens page when commits badge is clicked
'
,
function
()
{
...
@@ -77,6 +94,8 @@ describe('MergeRequestTabs', function() {
...
@@ -77,6 +94,8 @@ describe('MergeRequestTabs', function() {
this
.
class
.
bindEvents
();
this
.
class
.
bindEvents
();
$
(
'
.merge-request-tabs .commits-tab a .badge
'
).
trigger
(
metakeyEvent
);
$
(
'
.merge-request-tabs .commits-tab a .badge
'
).
trigger
(
metakeyEvent
);
expect
(
window
.
open
).
toHaveBeenCalled
();
});
});
});
});
...
@@ -86,12 +105,9 @@ describe('MergeRequestTabs', function() {
...
@@ -86,12 +105,9 @@ describe('MergeRequestTabs', function() {
expect
(
name
).
toEqual
(
windowTarget
);
expect
(
name
).
toEqual
(
windowTarget
);
});
});
this
.
class
.
clickTab
({
this
.
class
.
clickTab
({
...
clickTabParams
,
metaKey
:
true
});
metaKey
:
false
,
ctrlKey
:
true
,
expect
(
window
.
open
).
toHaveBeenCalled
();
which
:
1
,
stopImmediatePropagation
:
function
()
{},
});
});
});
it
(
'
opens page tab in a new browser tab with Cmd+Click - Mac
'
,
function
()
{
it
(
'
opens page tab in a new browser tab with Cmd+Click - Mac
'
,
function
()
{
...
@@ -100,12 +116,9 @@ describe('MergeRequestTabs', function() {
...
@@ -100,12 +116,9 @@ describe('MergeRequestTabs', function() {
expect
(
name
).
toEqual
(
windowTarget
);
expect
(
name
).
toEqual
(
windowTarget
);
});
});
this
.
class
.
clickTab
({
this
.
class
.
clickTab
({
...
clickTabParams
,
ctrlKey
:
true
});
metaKey
:
true
,
ctrlKey
:
false
,
expect
(
window
.
open
).
toHaveBeenCalled
();
which
:
1
,
stopImmediatePropagation
:
function
()
{},
});
});
});
it
(
'
opens page tab in a new browser tab with Middle-click - Mac/PC
'
,
function
()
{
it
(
'
opens page tab in a new browser tab with Middle-click - Mac/PC
'
,
function
()
{
...
@@ -114,12 +127,9 @@ describe('MergeRequestTabs', function() {
...
@@ -114,12 +127,9 @@ describe('MergeRequestTabs', function() {
expect
(
name
).
toEqual
(
windowTarget
);
expect
(
name
).
toEqual
(
windowTarget
);
});
});
this
.
class
.
clickTab
({
this
.
class
.
clickTab
({
...
clickTabParams
,
which
:
2
});
metaKey
:
false
,
ctrlKey
:
false
,
expect
(
window
.
open
).
toHaveBeenCalled
();
which
:
2
,
stopImmediatePropagation
:
function
()
{},
});
});
});
});
});
...
...
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