Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
eeb957ec
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,发现更多精彩内容 >>
提交
eeb957ec
编写于
3月 08, 2018
作者:
K
Kushal Pandya
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add `isProject` and computed props to for contextual info for dropdown
上级
a831267c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
0 deletion
+50
-0
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
...ipts/vue_shared/components/sidebar/labels_select/base.vue
+24
-0
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
.../vue_shared/components/sidebar/labels_select/base_spec.js
+26
-0
未找到文件。
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
浏览文件 @
eeb957ec
<
script
>
import
{
__
}
from
'
~/locale
'
;
import
LabelsSelect
from
'
~/labels_select
'
;
import
LoadingIcon
from
'
../../loading_icon.vue
'
;
...
...
@@ -31,6 +32,11 @@ export default {
required
:
false
,
default
:
false
,
},
isProject
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
abilityName
:
{
type
:
String
,
required
:
true
,
...
...
@@ -73,6 +79,20 @@ export default {
hiddenInputName
()
{
return
this
.
showCreate
?
`
${
this
.
abilityName
}
[label_names][]`
:
'
label_id[]
'
;
},
createLabelTitle
()
{
if
(
this
.
isProject
)
{
return
__
(
'
Create project label
'
);
}
return
__
(
'
Create group label
'
);
},
manageLabelsTitle
()
{
if
(
this
.
isProject
)
{
return
__
(
'
Manage project labels
'
);
}
return
__
(
'
Manage group labels
'
);
},
},
mounted
()
{
this
.
labelsDropdown
=
new
LabelsSelect
(
this
.
$refs
.
dropdownButton
,
{
...
...
@@ -137,10 +157,14 @@ dropdown-menu-labels dropdown-menu-selectable"
<dropdown-footer
v-if=
"showCreate"
:labels-web-url=
"labelsWebUrl"
:create-label-title=
"createLabelTitle"
:manage-labels-title=
"manageLabelsTitle"
/>
</div>
<dropdown-create-label
v-if=
"showCreate"
:is-project=
"isProject"
:header-title=
"createLabelTitle"
/>
</div>
</div>
...
...
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
浏览文件 @
eeb957ec
...
...
@@ -37,6 +37,32 @@ describe('BaseComponent', () => {
vmNonEditable
.
$destroy
();
});
});
describe
(
'
createLabelTitle
'
,
()
=>
{
it
(
'
returns `Create project label` when `isProject` prop is true
'
,
()
=>
{
expect
(
vm
.
createLabelTitle
).
toBe
(
'
Create project label
'
);
});
it
(
'
return `Create group label` when `isProject` prop is false
'
,
()
=>
{
const
mockConfigGroup
=
Object
.
assign
({},
mockConfig
,
{
isProject
:
false
});
const
vmGroup
=
createComponent
(
mockConfigGroup
);
expect
(
vmGroup
.
createLabelTitle
).
toBe
(
'
Create group label
'
);
vmGroup
.
$destroy
();
});
});
describe
(
'
manageLabelsTitle
'
,
()
=>
{
it
(
'
returns `Manage project labels` when `isProject` prop is true
'
,
()
=>
{
expect
(
vm
.
manageLabelsTitle
).
toBe
(
'
Manage project labels
'
);
});
it
(
'
return `Manage group labels` when `isProject` prop is false
'
,
()
=>
{
const
mockConfigGroup
=
Object
.
assign
({},
mockConfig
,
{
isProject
:
false
});
const
vmGroup
=
createComponent
(
mockConfigGroup
);
expect
(
vmGroup
.
manageLabelsTitle
).
toBe
(
'
Manage group labels
'
);
vmGroup
.
$destroy
();
});
});
});
describe
(
'
methods
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录