Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
03bc9922
提交
03bc9922
编辑于
3 years ago
作者:
Scott Stern
提交者:
Kushal Pandya
3 years ago
浏览文件
操作
下载
补丁
差异文件
On click of board cards in filtered search, refresh page
Changed: fixed MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80238
上级
1b56d493
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
app/assets/javascripts/boards/components/board_card_inner.vue
+4
-14
4 个添加, 14 个删除
...assets/javascripts/boards/components/board_card_inner.vue
spec/frontend/boards/board_card_inner_spec.js
+6
-49
6 个添加, 49 个删除
spec/frontend/boards/board_card_inner_spec.js
有
10 个添加
和
63 个删除
app/assets/javascripts/boards/components/board_card_inner.vue
+
4
−
14
浏览文件 @
03bc9922
...
@@ -11,12 +11,10 @@ import { sortBy } from 'lodash';
...
@@ -11,12 +11,10 @@ import { sortBy } from 'lodash';
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
boardCardInner
from
'
ee_else_ce/boards/mixins/board_card_inner
'
;
import
boardCardInner
from
'
ee_else_ce/boards/mixins/board_card_inner
'
;
import
{
isScopedLabel
}
from
'
~/lib/utils/common_utils
'
;
import
{
isScopedLabel
}
from
'
~/lib/utils/common_utils
'
;
import
{
updateHistory
}
from
'
~/lib/utils/url_utility
'
;
import
{
sprintf
,
__
,
n__
}
from
'
~/locale
'
;
import
{
sprintf
,
__
,
n__
}
from
'
~/locale
'
;
import
TooltipOnTruncate
from
'
~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue
'
;
import
TooltipOnTruncate
from
'
~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue
'
;
import
UserAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
UserAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
{
ListType
}
from
'
../constants
'
;
import
{
ListType
}
from
'
../constants
'
;
import
eventHub
from
'
../eventhub
'
;
import
BoardBlockedIcon
from
'
./board_blocked_icon.vue
'
;
import
BoardBlockedIcon
from
'
./board_blocked_icon.vue
'
;
import
IssueDueDate
from
'
./issue_due_date.vue
'
;
import
IssueDueDate
from
'
./issue_due_date.vue
'
;
import
IssueTimeEstimate
from
'
./issue_time_estimate.vue
'
;
import
IssueTimeEstimate
from
'
./issue_time_estimate.vue
'
;
...
@@ -176,18 +174,10 @@ export default {
...
@@ -176,18 +174,10 @@ export default {
)
)
);
);
},
},
filterByLabel
(
label
)
{
labelTarget
(
label
)
{
if
(
!
this
.
updateFilters
)
return
;
const
filterPath
=
window
.
location
.
search
?
`
${
window
.
location
.
search
}
&`
:
'
?
'
;
const
filterPath
=
window
.
location
.
search
?
`
${
window
.
location
.
search
}
&`
:
'
?
'
;
const
filter
=
`label_name[]=
${
encodeURIComponent
(
label
.
title
)}
`
;
const
value
=
encodeURIComponent
(
label
.
title
);
return
`
${
filterPath
}
label_name[]=
${
value
}
`
;
if
(
!
filterPath
.
includes
(
filter
))
{
updateHistory
({
url
:
`
${
filterPath
}${
filter
}
`
,
});
this
.
performSearch
();
eventHub
.
$emit
(
'
updateTokens
'
);
}
},
},
showScopedLabel
(
label
)
{
showScopedLabel
(
label
)
{
return
this
.
scopedLabelsAvailable
&&
isScopedLabel
(
label
);
return
this
.
scopedLabelsAvailable
&&
isScopedLabel
(
label
);
...
@@ -242,7 +232,7 @@ export default {
...
@@ -242,7 +232,7 @@ export default {
:description=
"label.description"
:description=
"label.description"
size=
"sm"
size=
"sm"
:scoped=
"showScopedLabel(label)"
:scoped=
"showScopedLabel(label)"
@
click=
"filterByLabel
(label)"
:target=
"labelTarget
(label)"
/>
/>
</
template
>
</
template
>
</div>
</div>
...
...
此差异已折叠。
点击以展开。
spec/frontend/boards/board_card_inner_spec.js
+
6
−
49
浏览文件 @
03bc9922
...
@@ -2,15 +2,12 @@ import { GlLabel, GlLoadingIcon, GlTooltip } from '@gitlab/ui';
...
@@ -2,15 +2,12 @@ import { GlLabel, GlLoadingIcon, GlTooltip } from '@gitlab/ui';
import
{
range
}
from
'
lodash
'
;
import
{
range
}
from
'
lodash
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
nextTick
}
from
'
vue
'
;
import
setWindowLocation
from
'
helpers/set_window_location_helper
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
BoardBlockedIcon
from
'
~/boards/components/board_blocked_icon.vue
'
;
import
BoardBlockedIcon
from
'
~/boards/components/board_blocked_icon.vue
'
;
import
BoardCardInner
from
'
~/boards/components/board_card_inner.vue
'
;
import
BoardCardInner
from
'
~/boards/components/board_card_inner.vue
'
;
import
{
issuableTypes
}
from
'
~/boards/constants
'
;
import
{
issuableTypes
}
from
'
~/boards/constants
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
defaultStore
from
'
~/boards/stores
'
;
import
defaultStore
from
'
~/boards/stores
'
;
import
{
updateHistory
}
from
'
~/lib/utils/url_utility
'
;
import
{
mockLabelList
,
mockIssue
,
mockIssueFullPath
}
from
'
./mock_data
'
;
import
{
mockLabelList
,
mockIssue
,
mockIssueFullPath
}
from
'
./mock_data
'
;
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
...
@@ -54,6 +51,7 @@ describe('Board card component', () => {
...
@@ -54,6 +51,7 @@ describe('Board card component', () => {
state
:
{
state
:
{
...
defaultStore
.
state
,
...
defaultStore
.
state
,
issuableType
:
issuableTypes
.
issue
,
issuableType
:
issuableTypes
.
issue
,
isShowingLabels
:
true
,
},
},
getters
:
{
getters
:
{
isGroupBoard
:
()
=>
true
,
isGroupBoard
:
()
=>
true
,
...
@@ -405,53 +403,12 @@ describe('Board card component', () => {
...
@@ -405,53 +403,12 @@ describe('Board card component', () => {
expect
(
wrapper
.
findAll
(
GlLabel
).
length
).
toBe
(
1
);
expect
(
wrapper
.
findAll
(
GlLabel
).
length
).
toBe
(
1
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
'
closed
'
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
'
closed
'
);
});
});
});
describe
(
'
filterByLabel method
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
.
setProps
({
updateFilters
:
true
,
});
});
describe
(
'
when selected label is not in the filter
'
,
()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
performSearch
'
).
mockImplementation
(()
=>
{});
setWindowLocation
(
'
?
'
);
wrapper
.
vm
.
filterByLabel
(
label1
);
});
it
(
'
calls updateHistory
'
,
()
=>
{
expect
(
updateHistory
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
dispatches performSearch vuex action
'
,
()
=>
{
expect
(
wrapper
.
vm
.
performSearch
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
emits updateTokens event
'
,
()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledTimes
(
1
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
updateTokens
'
);
});
});
describe
(
'
when selected label is already in the filter
'
,
()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
performSearch
'
).
mockImplementation
(()
=>
{});
setWindowLocation
(
'
?label_name[]=testing%20123
'
);
wrapper
.
vm
.
filterByLabel
(
label1
);
});
it
(
'
does not call updateHistory
'
,
()
=>
{
expect
(
updateHistory
).
not
.
toHaveBeenCalled
();
});
it
(
'
does not dispatch performSearch vuex action
'
,
()
=>
{
describe
(
'
when label params arent set
'
,
()
=>
{
expect
(
wrapper
.
vm
.
performSearch
).
not
.
toHaveBeenCalled
();
it
(
'
passes the right target to GlLabel
'
,
()
=>
{
});
expect
(
wrapper
.
findAll
(
GlLabel
).
at
(
0
).
props
(
'
target
'
)).
toEqual
(
'
?label_name[]=testing%20123
'
,
it
(
'
does not emit updateTokens event
'
,
()
=>
{
);
expect
(
eventHub
.
$emit
).
not
.
toHaveBeenCalled
();
});
});
});
});
});
});
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录