Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
429eb466
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
429eb466
编写于
3月 09, 2017
作者:
F
Filipa Lacerda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent dropdown from closing when user clicks in a build.
上级
1df518ff
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
0 deletion
+31
-0
app/assets/javascripts/mini_pipeline_graph_dropdown.js
app/assets/javascripts/mini_pipeline_graph_dropdown.js
+16
-0
spec/javascripts/mini_pipeline_graph_dropdown_spec.js
spec/javascripts/mini_pipeline_graph_dropdown_spec.js
+15
-0
未找到文件。
app/assets/javascripts/mini_pipeline_graph_dropdown.js
浏览文件 @
429eb466
...
...
@@ -21,6 +21,8 @@
this
.
container
=
opts
.
container
||
''
;
this
.
dropdownListSelector
=
'
.js-builds-dropdown-container
'
;
this
.
getBuildsList
=
this
.
getBuildsList
.
bind
(
this
);
this
.
stopDropdownClickPropagation
();
}
/**
...
...
@@ -31,6 +33,20 @@
$
(
document
).
off
(
'
shown.bs.dropdown
'
,
this
.
container
).
on
(
'
shown.bs.dropdown
'
,
this
.
container
,
this
.
getBuildsList
);
}
/**
* 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
()
{
$
(
document
).
on
(
'
click
'
,
`
${
this
.
container
}
.js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`
,
(
e
)
=>
{
e
.
stopPropagation
();
});
}
/**
* For the clicked stage, renders the given data in the dropdown list.
*
...
...
spec/javascripts/mini_pipeline_graph_dropdown_spec.js
浏览文件 @
429eb466
...
...
@@ -46,6 +46,21 @@ require('~/mini_pipeline_graph_dropdown');
document
.
querySelector
(
'
.js-builds-dropdown-button
'
).
click
();
expect
(
ajaxSpy
.
calls
.
allArgs
()[
0
][
0
].
url
).
toEqual
(
'
foobar
'
);
});
it
(
'
should not close when user uses cmd/ctrl + click
'
,
()
=>
{
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
(
params
)
{
params
.
success
({
html
:
'
\
u003cli
\
u003e
\n\
u003ca class="mini-pipeline-graph-dropdown-item" href="#"
\
u003e
\
u003cspan class="ci-status-icon ci-status-icon-failed"
\
u003e
\
u003c/span
\
u003e
\n\
u003cspan class="ci-build-text"
\
u003ebuild
\
u003c/span
\
u003e
\n\
u003c/a
\
u003e
\
u003ca class="ci-action-icon-wrapper js-ci-action-icon" href="#"
\
u003e
\
u003c/a
\
u003e
\n\
u003c/li
\
u003e
\n
'
,
});
});
new
gl
.
MiniPipelineGraph
({
container
:
'
.js-builds-dropdown-tests
'
}).
bindEvents
();
document
.
querySelector
(
'
.js-builds-dropdown-button
'
).
click
();
document
.
querySelector
(
'
a.mini-pipeline-graph-dropdown-item
'
).
click
();
expect
(
$
(
'
.js-builds-dropdown-list
'
).
is
(
'
:visible
'
)).
toEqual
(
true
);
});
});
});
})();
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录