Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
39a27b7c
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,发现更多精彩内容 >>
提交
39a27b7c
编写于
6月 06, 2019
作者:
K
Kushal Pandya
提交者:
Phil Hughes
6月 06, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CE Backport: Show tree within Epic containing child Epics and Issues
上级
4bb63a8c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
242 addition
and
4 deletion
+242
-4
app/assets/javascripts/vue_shared/components/droplab_dropdown_button.vue
...scripts/vue_shared/components/droplab_dropdown_button.vue
+89
-0
app/assets/javascripts/vue_shared/components/issue/issue_assignees.vue
...vascripts/vue_shared/components/issue/issue_assignees.vue
+11
-2
app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue
...vascripts/vue_shared/components/issue/issue_milestone.vue
+6
-2
spec/frontend/vue_shared/droplab_dropdown_button_spec.js
spec/frontend/vue_shared/droplab_dropdown_button_spec.js
+136
-0
未找到文件。
app/assets/javascripts/vue_shared/components/droplab_dropdown_button.vue
0 → 100644
浏览文件 @
39a27b7c
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
Icon
from
'
./icon.vue
'
;
export
default
{
components
:
{
Icon
,
GlButton
,
},
props
:
{
size
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
primaryButtonClass
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
dropdownClass
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
actions
:
{
type
:
Array
,
required
:
true
,
},
defaultAction
:
{
type
:
Number
,
required
:
true
,
},
},
data
()
{
return
{
selectedAction
:
this
.
defaultAction
,
};
},
computed
:
{
selectedActionTitle
()
{
return
this
.
actions
[
this
.
selectedAction
].
title
;
},
buttonSizeClass
()
{
return
`btn-
${
this
.
size
}
`
;
},
},
methods
:
{
handlePrimaryActionClick
()
{
this
.
$emit
(
'
onActionClick
'
,
this
.
actions
[
this
.
selectedAction
]);
},
handleActionClick
(
selectedAction
)
{
this
.
selectedAction
=
selectedAction
;
this
.
$emit
(
'
onActionSelect
'
,
selectedAction
);
},
},
};
</
script
>
<
template
>
<div
class=
"btn-group droplab-dropdown comment-type-dropdown"
>
<gl-button
:class=
"primaryButtonClass"
:size=
"size"
@
click.prevent=
"handlePrimaryActionClick"
>
{{
selectedActionTitle
}}
</gl-button>
<button
:class=
"buttonSizeClass"
type=
"button"
class=
"btn dropdown-toggle pl-2 pr-2"
data-display=
"static"
data-toggle=
"dropdown"
>
<icon
name=
"arrow-down"
aria-label=
"toggle dropdown"
/>
</button>
<ul
:class=
"dropdownClass"
class=
"dropdown-menu dropdown-open-top"
>
<template
v-for=
"(action, index) in actions"
>
<li
:key=
"index"
:class=
"
{ 'droplab-item-selected': selectedAction === index }">
<gl-button
class=
"btn-transparent"
@
click.prevent=
"handleActionClick(index)"
>
<i
aria-hidden=
"true"
class=
"fa fa-check icon"
>
</i>
<div
class=
"description"
>
<strong>
{{
action
.
title
}}
</strong>
<p>
{{
action
.
description
}}
</p>
</div>
</gl-button>
</li>
<li
v-if=
"index === 0"
:key=
"`$
{index}-separator`" class="divider droplab-item-ignore">
</li>
</
template
>
</ul>
</div>
</template>
app/assets/javascripts/vue_shared/components/issue/issue_assignees.vue
浏览文件 @
39a27b7c
...
...
@@ -62,6 +62,15 @@ export default {
assigneeName
:
assignee
.
name
,
});
},
// This method is for backward compat
// since Graph query would return camelCase
// props while Rails would return snake_case
webUrl
(
assignee
)
{
return
assignee
.
web_url
||
assignee
.
webUrl
;
},
avatarUrl
(
assignee
)
{
return
assignee
.
avatar_url
||
assignee
.
avatarUrl
;
},
},
};
</
script
>
...
...
@@ -70,9 +79,9 @@ export default {
<user-avatar-link
v-for=
"assignee in assigneesToShow"
:key=
"assignee.id"
:link-href=
"
assignee.web_url
"
:link-href=
"
webUrl(assignee)
"
:img-alt=
"avatarUrlTitle(assignee)"
:img-src=
"a
ssignee.avatar_url
"
:img-src=
"a
vatarUrl(assignee)
"
:img-size=
"24"
class=
"js-no-trigger"
tooltip-placement=
"bottom"
...
...
app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue
浏览文件 @
39a27b7c
...
...
@@ -19,10 +19,14 @@ export default {
},
computed
:
{
milestoneDue
()
{
return
this
.
milestone
.
due_date
?
parsePikadayDate
(
this
.
milestone
.
due_date
)
:
null
;
const
dueDate
=
this
.
milestone
.
due_date
||
this
.
milestone
.
dueDate
;
return
dueDate
?
parsePikadayDate
(
dueDate
)
:
null
;
},
milestoneStart
()
{
return
this
.
milestone
.
start_date
?
parsePikadayDate
(
this
.
milestone
.
start_date
)
:
null
;
const
startDate
=
this
.
milestone
.
start_date
||
this
.
milestone
.
startDate
;
return
startDate
?
parsePikadayDate
(
startDate
)
:
null
;
},
isMilestoneStarted
()
{
if
(
!
this
.
milestoneStart
)
{
...
...
spec/frontend/vue_shared/droplab_dropdown_button_spec.js
0 → 100644
浏览文件 @
39a27b7c
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
DroplabDropdownButton
from
'
~/vue_shared/components/droplab_dropdown_button.vue
'
;
const
mockActions
=
[
{
title
:
'
Foo
'
,
description
:
'
Some foo action
'
,
},
{
title
:
'
Bar
'
,
description
:
'
Some bar action
'
,
},
];
const
createComponent
=
({
size
=
''
,
dropdownClass
=
''
,
actions
=
mockActions
,
defaultAction
=
0
,
})
=>
{
const
localVue
=
createLocalVue
();
return
mount
(
DroplabDropdownButton
,
{
localVue
,
propsData
:
{
size
,
dropdownClass
,
actions
,
defaultAction
,
},
});
};
describe
(
'
DroplabDropdownButton
'
,
()
=>
{
let
wrapper
;
beforeEach
(()
=>
{
wrapper
=
createComponent
({});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
data
'
,
()
=>
{
it
(
'
contains `selectedAction` representing value of `defaultAction` prop
'
,
()
=>
{
expect
(
wrapper
.
vm
.
selectedAction
).
toBe
(
0
);
});
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
selectedActionTitle
'
,
()
=>
{
it
(
'
returns string containing title of selected action
'
,
()
=>
{
wrapper
.
setData
({
selectedAction
:
0
});
expect
(
wrapper
.
vm
.
selectedActionTitle
).
toBe
(
mockActions
[
0
].
title
);
wrapper
.
setData
({
selectedAction
:
1
});
expect
(
wrapper
.
vm
.
selectedActionTitle
).
toBe
(
mockActions
[
1
].
title
);
});
});
describe
(
'
buttonSizeClass
'
,
()
=>
{
it
(
'
returns string containing button sizing class based on `size` prop
'
,
done
=>
{
const
wrapperWithSize
=
createComponent
({
size
:
'
sm
'
,
});
wrapperWithSize
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapperWithSize
.
vm
.
buttonSizeClass
).
toBe
(
'
btn-sm
'
);
done
();
wrapperWithSize
.
destroy
();
});
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
handlePrimaryActionClick
'
,
()
=>
{
it
(
'
emits `onActionClick` event on component with selectedAction object as param
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
$emit
'
);
wrapper
.
setData
({
selectedAction
:
0
});
wrapper
.
vm
.
handlePrimaryActionClick
();
expect
(
wrapper
.
vm
.
$emit
).
toHaveBeenCalledWith
(
'
onActionClick
'
,
mockActions
[
0
]);
});
});
describe
(
'
handleActionClick
'
,
()
=>
{
it
(
'
emits `onActionSelect` event on component with selectedAction index as param
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
$emit
'
);
wrapper
.
vm
.
handleActionClick
(
1
);
expect
(
wrapper
.
vm
.
$emit
).
toHaveBeenCalledWith
(
'
onActionSelect
'
,
1
);
});
});
});
describe
(
'
template
'
,
()
=>
{
it
(
'
renders default action button
'
,
()
=>
{
const
defaultButton
=
wrapper
.
findAll
(
'
.btn
'
).
at
(
0
);
expect
(
defaultButton
.
text
()).
toBe
(
mockActions
[
0
].
title
);
});
it
(
'
renders dropdown button
'
,
()
=>
{
const
dropdownButton
=
wrapper
.
findAll
(
'
.dropdown-toggle
'
).
at
(
0
);
expect
(
dropdownButton
.
isVisible
()).
toBe
(
true
);
});
it
(
'
renders dropdown actions
'
,
()
=>
{
const
dropdownActions
=
wrapper
.
findAll
(
'
.dropdown-menu li button
'
);
Array
(
dropdownActions
.
length
)
.
fill
()
.
forEach
((
_
,
index
)
=>
{
const
actionContent
=
dropdownActions
.
at
(
index
).
find
(
'
.description
'
);
expect
(
actionContent
.
find
(
'
strong
'
).
text
()).
toBe
(
mockActions
[
index
].
title
);
expect
(
actionContent
.
find
(
'
p
'
).
text
()).
toBe
(
mockActions
[
index
].
description
);
});
});
it
(
'
renders divider between dropdown actions
'
,
()
=>
{
const
dropdownDivider
=
wrapper
.
find
(
'
.dropdown-menu .divider
'
);
expect
(
dropdownDivider
.
isVisible
()).
toBe
(
true
);
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录