Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a26cd123
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,发现更多精彩内容 >>
提交
a26cd123
编写于
2月 25, 2019
作者:
W
Winnie Hellmann
提交者:
Filipa Lacerda
2月 25, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract ResolveWithIssueButton from NoteableDiscussion component
上级
15528c75
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
118 addition
and
10 deletion
+118
-10
app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue
...notes/components/discussion_resolve_with_issue_button.vue
+34
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+9
-10
changelogs/unreleased/refactor-56367-extract-resolve-with-issue-button-component.yml
...tor-56367-extract-resolve-with-issue-button-component.yml
+5
-0
spec/javascripts/notes/components/discussion_resolve_with_issue_button_spec.js
...s/components/discussion_resolve_with_issue_button_spec.js
+31
-0
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+39
-0
未找到文件。
app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue
0 → 100644
浏览文件 @
a26cd123
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
GlTooltipDirective
,
GlButton
}
from
'
@gitlab/ui
'
;
export
default
{
name
:
'
ResolveWithIssueButton
'
,
components
:
{
Icon
,
GlButton
,
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
props
:
{
url
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<div
class=
"btn-group"
role=
"group"
>
<gl-button
v-gl-tooltip
:href=
"url"
:title=
"s__('MergeRequests|Resolve this discussion in a new issue')"
class=
"new-issue-for-discussion discussion-create-issue-btn"
>
<icon
name=
"issue-new"
/>
</gl-button>
</div>
</
template
>
app/assets/javascripts/notes/components/noteable_discussion.vue
浏览文件 @
a26cd123
...
...
@@ -25,6 +25,7 @@ import noteable from '../mixins/noteable';
import
resolvable
from
'
../mixins/resolvable
'
;
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
ResolveWithIssueButton
from
'
./discussion_resolve_with_issue_button.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
import
eventHub
from
'
../event_hub
'
;
...
...
@@ -44,6 +45,7 @@ export default {
ReplyPlaceholder
,
placeholderNote
,
placeholderSystemNote
,
ResolveWithIssueButton
,
systemNote
,
TimelineEntryItem
,
},
...
...
@@ -234,6 +236,9 @@ export default {
url
:
this
.
discussion
.
discussion_path
,
};
},
resolveWithIssuePath
()
{
return
!
this
.
discussionResolved
&&
this
.
discussion
.
resolve_with_issue_path
;
},
},
watch
:
{
isReplying
()
{
...
...
@@ -487,16 +492,10 @@ Please check your network connection and try again.`;
class=
"btn-group discussion-actions ml-sm-2"
role=
"group"
>
<div
v-if=
"!discussionResolved"
class=
"btn-group"
role=
"group"
>
<a
v-gl-tooltip
:href=
"discussion.resolve_with_issue_path"
:title=
"s__('MergeRequests|Resolve this discussion in a new issue')"
class=
"new-issue-for-discussion btn btn-default discussion-create-issue-btn"
>
<icon
name=
"issue-new"
/>
</a>
</div>
<resolve-with-issue-button
v-if=
"resolveWithIssuePath"
:url=
"resolveWithIssuePath"
/>
<jump-to-next-discussion-button
v-if=
"shouldShowJumpToNextDiscussion"
@
onClick=
"jumpToNextDiscussion"
...
...
changelogs/unreleased/refactor-56367-extract-resolve-with-issue-button-component.yml
0 → 100644
浏览文件 @
a26cd123
---
title
:
Extracted ResolveWithIssueButton to its own component
merge_request
:
25093
author
:
Martin Hobert
type
:
other
spec/javascripts/notes/components/discussion_resolve_with_issue_button_spec.js
0 → 100644
浏览文件 @
a26cd123
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
ResolveWithIssueButton
from
'
~/notes/components/discussion_resolve_with_issue_button.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ResolveWithIssueButton
'
,
()
=>
{
let
wrapper
;
const
url
=
`
${
TEST_HOST
}
/hello-world/`
;
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
ResolveWithIssueButton
,
{
localVue
,
sync
:
false
,
propsData
:
{
url
,
},
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
it should have a link with the provided link property as href
'
,
()
=>
{
const
button
=
wrapper
.
find
(
GlButton
);
expect
(
button
.
attributes
().
href
).
toBe
(
url
);
});
});
spec/javascripts/notes/components/noteable_discussion_spec.js
浏览文件 @
a26cd123
...
...
@@ -2,6 +2,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import
createStore
from
'
~/notes/stores
'
;
import
noteableDiscussion
from
'
~/notes/components/noteable_discussion.vue
'
;
import
ReplyPlaceholder
from
'
~/notes/components/discussion_reply_placeholder.vue
'
;
import
ResolveWithIssueButton
from
'
~/notes/components/discussion_resolve_with_issue_button.vue
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
...
...
@@ -238,4 +239,42 @@ describe('noteable_discussion component', () => {
});
});
});
describe
(
'
for resolved discussion
'
,
()
=>
{
beforeEach
(()
=>
{
const
discussion
=
getJSONFixture
(
discussionWithTwoUnresolvedNotes
)[
0
];
wrapper
.
setProps
({
discussion
});
});
it
(
'
does not display a button to resolve with issue
'
,
()
=>
{
const
button
=
wrapper
.
find
(
ResolveWithIssueButton
);
expect
(
button
.
exists
()).
toBe
(
false
);
});
});
describe
(
'
for unresolved discussion
'
,
()
=>
{
beforeEach
(
done
=>
{
const
discussion
=
{
...
getJSONFixture
(
discussionWithTwoUnresolvedNotes
)[
0
],
expanded
:
true
,
};
discussion
.
notes
=
discussion
.
notes
.
map
(
note
=>
({
...
note
,
resolved
:
false
,
}));
wrapper
.
setProps
({
discussion
});
wrapper
.
vm
.
$nextTick
()
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
displays a button to resolve with issue
'
,
()
=>
{
const
button
=
wrapper
.
find
(
ResolveWithIssueButton
);
expect
(
button
.
exists
()).
toBe
(
true
);
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录