Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
63975b4a
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 搜索 >>
提交
63975b4a
编写于
2月 05, 2019
作者:
W
Winnie Hellmann
提交者:
Phil Hughes
2月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract ReplyPlaceholder from NoteableDiscussion component
上级
74abc775
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
79 addition
and
25 deletion
+79
-25
app/assets/javascripts/notes/components/discussion_reply_placeholder.vue
...scripts/notes/components/discussion_reply_placeholder.vue
+17
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+3
-8
changelogs/unreleased/refactor-56370-extract-reply-placeholder-component.yml
...ed/refactor-56370-extract-reply-placeholder-component.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/javascripts/notes/components/discussion_reply_placeholder_spec.js
...pts/notes/components/discussion_reply_placeholder_spec.js
+34
-0
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+14
-17
未找到文件。
app/assets/javascripts/notes/components/discussion_reply_placeholder.vue
0 → 100644
浏览文件 @
63975b4a
<
script
>
export
default
{
name
:
'
ReplyPlaceholder
'
,
};
</
script
>
<
template
>
<button
ref=
"button"
type=
"button"
class=
"js-vue-discussion-reply btn btn-text-field"
:title=
"s__('MergeRequests|Add a reply')"
@
click=
"$emit('onClick')"
>
{{
s__
(
'
MergeRequests|Reply...
'
)
}}
</button>
</
template
>
app/assets/javascripts/notes/components/noteable_discussion.vue
浏览文件 @
63975b4a
...
...
@@ -24,6 +24,7 @@ import autosave from '../mixins/autosave';
import
noteable
from
'
../mixins/noteable
'
;
import
resolvable
from
'
../mixins/resolvable
'
;
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
export
default
{
...
...
@@ -39,6 +40,7 @@ export default {
resolveDiscussionButton
,
jumpToNextDiscussionButton
,
toggleRepliesWidget
,
ReplyPlaceholder
,
placeholderNote
,
placeholderSystemNote
,
systemNote
,
...
...
@@ -447,14 +449,7 @@ Please check your network connection and try again.`;
>
<
template
v-if=
"!isReplying && canReply"
>
<div
class=
"discussion-with-resolve-btn"
>
<button
type=
"button"
class=
"js-vue-discussion-reply btn btn-text-field qa-discussion-reply"
title=
"Add a reply"
@
click=
"showReplyForm"
>
Reply...
</button>
<reply-placeholder
class=
"qa-discussion-reply"
@
onClick=
"showReplyForm"
/>
<resolve-discussion-button
v-if=
"discussion.resolvable"
:is-resolving=
"isResolving"
...
...
changelogs/unreleased/refactor-56370-extract-reply-placeholder-component.yml
0 → 100644
浏览文件 @
63975b4a
---
title
:
Extracted ReplyPlaceholder to its own component
merge_request
:
24507
author
:
Martin Hobert
type
:
other
locale/gitlab.pot
浏览文件 @
63975b4a
...
...
@@ -4393,9 +4393,15 @@ msgstr ""
msgid "Merge requests are a place to propose changes you've made to a project and discuss those changes with others"
msgstr ""
msgid "MergeRequests|Add a reply"
msgstr ""
msgid "MergeRequests|Jump to next unresolved discussion"
msgstr ""
msgid "MergeRequests|Reply..."
msgstr ""
msgid "MergeRequests|Resolve this discussion in a new issue"
msgstr ""
...
...
spec/javascripts/notes/components/discussion_reply_placeholder_spec.js
0 → 100644
浏览文件 @
63975b4a
import
ReplyPlaceholder
from
'
~/notes/components/discussion_reply_placeholder.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ReplyPlaceholder
'
,
()
=>
{
let
wrapper
;
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
ReplyPlaceholder
,
{
localVue
,
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
emits onClick even on button click
'
,
()
=>
{
const
button
=
wrapper
.
find
({
ref
:
'
button
'
});
button
.
trigger
(
'
click
'
);
expect
(
wrapper
.
emitted
()).
toEqual
({
onClick
:
[[]],
});
});
it
(
'
should render reply button
'
,
()
=>
{
const
button
=
wrapper
.
find
({
ref
:
'
button
'
});
expect
(
button
.
text
()).
toEqual
(
'
Reply...
'
);
});
});
spec/javascripts/notes/components/noteable_discussion_spec.js
浏览文件 @
63975b4a
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
'
~/behaviors/markdown/render_gfm
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
...
...
@@ -57,27 +58,23 @@ describe('noteable_discussion component', () => {
});
describe
(
'
actions
'
,
()
=>
{
it
(
'
should render reply button
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-vue-discussion-reply
'
)
.
text
()
.
trim
(),
).
toEqual
(
'
Reply...
'
);
});
it
(
'
should toggle reply form
'
,
done
=>
{
wrapper
.
find
(
'
.js-vue-discussion-reply
'
).
trigger
(
'
click
'
);
const
replyPlaceholder
=
wrapper
.
find
(
ReplyPlaceholder
);
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
vm
.
isReplying
).
toEqual
(
true
);
wrapper
.
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
wrapper
.
vm
.
isReplying
).
toEqual
(
false
);
// There is a watcher for `isReplying` which will init autosave in the next tick
wrapper
.
vm
.
$nextTick
(()
=>
{
replyPlaceholder
.
vm
.
$emit
(
'
onClick
'
);
})
.
then
(()
=>
wrapper
.
vm
.
$nextTick
())
.
then
(()
=>
{
expect
(
wrapper
.
vm
.
isReplying
).
toEqual
(
true
);
expect
(
wrapper
.
vm
.
$refs
.
noteForm
).
not
.
toBeNull
();
done
();
});
}
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
does not render jump to discussion button
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录