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
0c1cf679
Commit
0c1cf679
authored
Aug 09, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Adds tests for issue app
parent
23334ac0
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
275 additions
and
195 deletions
+275
-195
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+2
-3
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+4
-4
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+3
-3
spec/javascripts/notes/components/issue_note_app_spec.js
spec/javascripts/notes/components/issue_note_app_spec.js
+131
-91
spec/javascripts/notes/mock_data.js
spec/javascripts/notes/mock_data.js
+135
-94
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
0c1cf679
...
...
@@ -175,7 +175,6 @@
this
.
noteType
=
type
;
},
editCurrentUserLastNote
()
{
console
.
log
(
'
editCurrentUserLastNote
'
)
if
(
this
.
note
===
''
)
{
const
lastNote
=
this
.
getCurrentUserLastNote
(
window
.
gon
.
current_user_id
);
...
...
@@ -254,7 +253,7 @@
:disabled=
"isSubmitButtonDisabled"
name=
"button"
type=
"button"
class=
"btn
btn-nr
comment-btn note-type-toggle js-note-new-discussion dropdown-toggle"
class=
"btn comment-btn note-type-toggle js-note-new-discussion dropdown-toggle"
data-toggle=
"dropdown"
aria-label=
"Open comment type dropdown"
>
<i
...
...
@@ -305,7 +304,7 @@
type=
"submit"
v-if=
"canUpdateIssue"
:class=
"actionButtonClassNames"
class=
"btn btn-
nr btn-
comment btn-comment-and-close"
>
class=
"btn btn-comment btn-comment-and-close"
>
{{
issueActionButtonTitle
}}
</button>
<button
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
0c1cf679
...
...
@@ -56,7 +56,7 @@
return
this
.
getNotesDataByProp
(
'
markdownDocs
'
);
},
quickActionsDocsUrl
()
{
return
this
.
getNotesDataByProp
(
'
quickActionsDocs
'
)
;
return
!
this
.
isEditing
?
this
.
getNotesDataByProp
(
'
quickActionsDocs
'
)
:
undefined
;
},
currentUserId
()
{
return
this
.
getUserDataByProp
(
'
id
'
);
...
...
@@ -134,15 +134,15 @@
ref=
"textarea"
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
@
keydown.meta.enter=
"handleUpdate"
@
keydown.up=
"editMyLastNote"
@
keydown.meta.enter=
"handleUpdate
()
"
@
keydown.up=
"editMyLastNote
()
"
@
keydown.esc=
"cancelHandler(true)"
>
</textarea>
</markdown-field>
<div
class=
"note-form-actions clearfix"
>
<button
type=
"submit"
@
click=
"handleUpdate"
@
click=
"handleUpdate
()
"
:disabled=
"isDisabled"
class=
"js-vue-issue-save btn btn-save"
>
{{
saveButtonTitle
}}
...
...
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
0c1cf679
...
...
@@ -97,11 +97,11 @@
},
checkLocationHash
()
{
const
hash
=
gl
.
utils
.
getLocationHash
();
const
$el
=
$
(
`#
${
hash
}
`
);
const
element
=
document
.
getElementById
(
hash
);
if
(
hash
&&
$el
)
{
if
(
hash
&&
element
)
{
this
.
setTargetNoteHash
(
hash
);
this
.
scrollToNoteIfNeeded
(
$
el
);
this
.
scrollToNoteIfNeeded
(
$
(
element
)
);
}
},
},
...
...
spec/javascripts/notes/components/issue_note_app_spec.js
View file @
0c1cf679
This diff is collapsed.
Click to expand it.
spec/javascripts/notes/mock_data.js
View file @
0c1cf679
/* eslint disable */
/* eslint-disable */
export
const
notesDataMock
=
{
discussionsPath
:
'
/gitlab-org/gitlab-ce/issues/26/discussions.json
'
,
lastFetchedAt
:
'
1501862675
'
,
...
...
@@ -222,96 +221,138 @@ export const discussionMock = {
individual_note
:
false
,
};
export
const
discussion
Response
=
[{
"
id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
reply_id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
expanded
"
:
true
,
"
notes
"
:
[{
"
id
"
:
1390
,
"
attachment
"
:
{
"
url
"
:
null
,
"
filename
"
:
null
,
"
image
"
:
false
},
"
author
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
,
"
state
"
:
"
active
"
,
"
avatar_url
"
:
null
,
"
path
"
:
"
/root
"
},
"
created_at
"
:
"
2017-08-01T17:09:33.762Z
"
,
"
updated_at
"
:
"
2017-08-01T17:09:33.762Z
"
,
"
system
"
:
false
,
"
noteable_id
"
:
98
,
"
noteable_type
"
:
"
Issue
"
,
"
type
"
:
null
,
"
human_access
"
:
"
Owner
"
,
"
note
"
:
"
sdfdsaf
"
,
"
note_html
"
:
"
\
u003cp dir=
\"
auto
\"\
u003esdfdsaf
\
u003c/p
\
u003e
"
,
"
current_user
"
:
{
"
can_edit
"
:
true
},
"
discussion_id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
emoji_awardable
"
:
true
,
"
award_emoji
"
:
[{
"
name
"
:
"
baseball
"
,
"
user
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
}
},
{
"
name
"
:
"
art
"
,
"
user
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
}
}],
"
toggle_award_path
"
:
"
/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji
"
,
"
report_abuse_path
"
:
"
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390
\
u0026user_id=1
"
,
"
path
"
:
"
/gitlab-org/gitlab-ce/notes/1390
"
}],
"
individual_note
"
:
true
},
{
"
id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
reply_id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
expanded
"
:
true
,
"
notes
"
:
[{
"
id
"
:
1391
,
"
attachment
"
:
{
"
url
"
:
null
,
"
filename
"
:
null
,
"
image
"
:
false
},
"
author
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
,
"
state
"
:
"
active
"
,
"
avatar_url
"
:
null
,
"
path
"
:
"
/root
"
},
"
created_at
"
:
"
2017-08-02T10:51:38.685Z
"
,
"
updated_at
"
:
"
2017-08-02T10:51:38.685Z
"
,
"
system
"
:
false
,
"
noteable_id
"
:
98
,
"
noteable_type
"
:
"
Issue
"
,
"
type
"
:
null
,
"
human_access
"
:
"
Owner
"
,
"
note
"
:
"
New note!
"
,
"
note_html
"
:
"
\
u003cp dir=
\"
auto
\"\
u003eNew note!
\
u003c/p
\
u003e
"
,
"
current_user
"
:
{
"
can_edit
"
:
true
},
"
discussion_id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
emoji_awardable
"
:
true
,
"
award_emoji
"
:
[],
"
toggle_award_path
"
:
"
/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji
"
,
"
report_abuse_path
"
:
"
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391
\
u0026user_id=1
"
,
"
path
"
:
"
/gitlab-org/gitlab-ce/notes/1391
"
}],
"
individual_note
"
:
true
export
const
individualNoteServer
Response
=
[{
"
id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
reply_id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
expanded
"
:
true
,
"
notes
"
:
[{
"
id
"
:
1390
,
"
attachment
"
:
{
"
url
"
:
null
,
"
filename
"
:
null
,
"
image
"
:
false
},
"
author
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
,
"
state
"
:
"
active
"
,
"
avatar_url
"
:
null
,
"
path
"
:
"
/root
"
},
"
created_at
"
:
"
2017-08-01T17:09:33.762Z
"
,
"
updated_at
"
:
"
2017-08-01T17:09:33.762Z
"
,
"
system
"
:
false
,
"
noteable_id
"
:
98
,
"
noteable_type
"
:
"
Issue
"
,
"
type
"
:
null
,
"
human_access
"
:
"
Owner
"
,
"
note
"
:
"
sdfdsaf
"
,
"
note_html
"
:
"
\
u003cp dir=
\"
auto
\"\
u003esdfdsaf
\
u003c/p
\
u003e
"
,
"
current_user
"
:
{
"
can_edit
"
:
true
},
"
discussion_id
"
:
"
0fb4e0e3f9276e55ff32eb4195add694aece4edd
"
,
"
emoji_awardable
"
:
true
,
"
award_emoji
"
:
[{
"
name
"
:
"
baseball
"
,
"
user
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
}
},
{
"
name
"
:
"
art
"
,
"
user
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
}
}],
"
toggle_award_path
"
:
"
/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji
"
,
"
report_abuse_path
"
:
"
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390
\
u0026user_id=1
"
,
"
path
"
:
"
/gitlab-org/gitlab-ce/notes/1390
"
}],
"
individual_note
"
:
true
},
{
"
id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
reply_id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
expanded
"
:
true
,
"
notes
"
:
[{
"
id
"
:
1391
,
"
attachment
"
:
{
"
url
"
:
null
,
"
filename
"
:
null
,
"
image
"
:
false
},
"
author
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
,
"
state
"
:
"
active
"
,
"
avatar_url
"
:
null
,
"
path
"
:
"
/root
"
},
"
created_at
"
:
"
2017-08-02T10:51:38.685Z
"
,
"
updated_at
"
:
"
2017-08-02T10:51:38.685Z
"
,
"
system
"
:
false
,
"
noteable_id
"
:
98
,
"
noteable_type
"
:
"
Issue
"
,
"
type
"
:
null
,
"
human_access
"
:
"
Owner
"
,
"
note
"
:
"
New note!
"
,
"
note_html
"
:
"
\
u003cp dir=
\"
auto
\"\
u003eNew note!
\
u003c/p
\
u003e
"
,
"
current_user
"
:
{
"
can_edit
"
:
true
},
"
discussion_id
"
:
"
70d5c92a4039a36c70100c6691c18c27e4b0a790
"
,
"
emoji_awardable
"
:
true
,
"
award_emoji
"
:
[],
"
toggle_award_path
"
:
"
/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji
"
,
"
report_abuse_path
"
:
"
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391
\
u0026user_id=1
"
,
"
path
"
:
"
/gitlab-org/gitlab-ce/notes/1391
"
}],
"
individual_note
"
:
true
}];
export
const
discussionNoteServerResponse
=
[{
"
id
"
:
"
a3ed36e29b1957efb3b68c53e2d7a2b24b1df052
"
,
"
reply_id
"
:
"
a3ed36e29b1957efb3b68c53e2d7a2b24b1df052
"
,
"
expanded
"
:
true
,
"
notes
"
:
[{
"
id
"
:
1471
,
"
attachment
"
:
{
"
url
"
:
null
,
"
filename
"
:
null
,
"
image
"
:
false
},
"
author
"
:
{
"
id
"
:
1
,
"
name
"
:
"
Root
"
,
"
username
"
:
"
root
"
,
"
state
"
:
"
active
"
,
"
avatar_url
"
:
null
,
"
path
"
:
"
/root
"
},
"
created_at
"
:
"
2017-08-08T16:53:00.666Z
"
,
"
updated_at
"
:
"
2017-08-08T16:53:00.666Z
"
,
"
system
"
:
false
,
"
noteable_id
"
:
124
,
"
noteable_type
"
:
"
Issue
"
,
"
noteable_iid
"
:
29
,
"
type
"
:
"
DiscussionNote
"
,
"
human_access
"
:
"
Owner
"
,
"
note
"
:
"
Adding a comment
"
,
"
note_html
"
:
"
\
u003cp dir=
\"
auto
\"\
u003eAdding a comment
\
u003c/p
\
u003e
"
,
"
current_user
"
:
{
"
can_edit
"
:
true
},
"
discussion_id
"
:
"
a3ed36e29b1957efb3b68c53e2d7a2b24b1df052
"
,
"
emoji_awardable
"
:
true
,
"
award_emoji
"
:
[],
"
toggle_award_path
"
:
"
/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji
"
,
"
report_abuse_path
"
:
"
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471
\
u0026user_id=1
"
,
"
path
"
:
"
/gitlab-org/gitlab-ce/notes/1471
"
}],
"
individual_note
"
:
false
}];
\ No newline at end of file
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