Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
63975b4a
Commit
63975b4a
authored
Feb 05, 2019
by
Winnie Hellmann
Committed by
Phil Hughes
Feb 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract ReplyPlaceholder from NoteableDiscussion component
parent
74abc775
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
25 deletions
+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
No files found.
app/assets/javascripts/notes/components/discussion_reply_placeholder.vue
0 → 100644
View file @
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
View file @
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
View file @
63975b4a
---
title
:
Extracted ReplyPlaceholder to its own component
merge_request
:
24507
author
:
Martin Hobert
type
:
other
locale/gitlab.pot
View file @
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
View file @
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
View file @
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
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment