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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
cf77cdba
Commit
cf77cdba
authored
Aug 11, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds unit tests for discussion component
parent
3e92f44f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+1
-1
spec/javascripts/notes/components/issue_discussion_spec.js
spec/javascripts/notes/components/issue_discussion_spec.js
+34
-27
No files found.
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
cf77cdba
...
@@ -179,7 +179,7 @@
...
@@ -179,7 +179,7 @@
v-if=
"canReply && !isReplying"
v-if=
"canReply && !isReplying"
@
click=
"showReplyForm"
@
click=
"showReplyForm"
type=
"button"
type=
"button"
class=
"btn btn-text-field"
class=
"
js-vue-discussion-reply
btn btn-text-field"
title=
"Add a reply"
>
Reply...
</button>
title=
"Add a reply"
>
Reply...
</button>
<issue-note-form
<issue-note-form
v-if=
"isReplying"
v-if=
"isReplying"
...
...
spec/javascripts/notes/components/issue_discussion_spec.js
View file @
cf77cdba
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
issueDiscussion
from
'
~/notes/components/issue_discussion.vue
'
;
import
{
issueDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
describe
(
'
issue_discussion component
'
,
()
=>
{
describe
(
'
issue_discussion component
'
,
()
=>
{
it
(
'
should render user avatar
'
,
()
=>
{
let
vm
;
});
it
(
'
should render discussion header
'
,
()
=>
{
});
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
issueDiscussion
);
describe
(
'
updated note
'
,
()
=>
{
store
.
dispatch
(
'
setIssueData
'
,
issueDataMock
);
it
(
'
should show information about update
'
,
()
=>
{
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
});
vm
=
new
Component
({
store
,
propsData
:
{
note
:
discussionMock
,
},
}).
$mount
();
});
});
describe
(
'
with open discussion
'
,
()
=>
{
afterEach
(()
=>
{
it
(
'
should render system note
'
,
()
=>
{
vm
.
$destroy
();
});
});
it
(
'
should render placeholder note
'
,
()
=>
{
it
(
'
should render user avatar
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.user-avatar-link
'
)).
toBeDefined
();
});
});
it
(
'
should render regular note
'
,
()
=>
{
it
(
'
should render discussion header
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.discussion-header
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
.notes li
'
).
length
).
toEqual
(
discussionMock
.
notes
.
length
);
});
});
describe
(
'
actions
'
,
()
=>
{
describe
(
'
actions
'
,
()
=>
{
it
(
'
should render reply button
'
,
()
=>
{
it
(
'
should render reply button
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-vue-discussion-reply
'
).
textContent
.
trim
()).
toEqual
(
'
Reply...
'
);
});
});
it
(
'
should toggle reply form
'
,
(
)
=>
{
it
(
'
should toggle reply form
'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'
.js-vue-discussion-reply
'
).
click
();
});
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$refs
.
noteForm
).
toBeDefined
();
it
(
'
should render signout widget when user is logged out
'
,
()
=>
{
expect
(
vm
.
isReplying
).
toEqual
(
true
);
done
();
});
});
});
});
});
});
...
...
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