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
f8efaf1b
Commit
f8efaf1b
authored
Nov 30, 2017
by
Simon Knox
Committed by
Fatih Acet
Nov 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue note store
parent
3a8d646f
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
68 additions
and
68 deletions
+68
-68
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+11
-11
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+3
-3
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+6
-6
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+3
-3
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+2
-2
app/assets/javascripts/notes/services/notes_service.js
app/assets/javascripts/notes/services/notes_service.js
+0
-0
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+2
-2
app/assets/javascripts/notes/stores/getters.js
app/assets/javascripts/notes/stores/getters.js
+2
-2
app/assets/javascripts/notes/stores/index.js
app/assets/javascripts/notes/stores/index.js
+1
-1
app/assets/javascripts/notes/stores/mutation_types.js
app/assets/javascripts/notes/stores/mutation_types.js
+1
-1
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/mutations.js
+2
-2
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+1
-1
spec/features/issuables/discussion_lock_spec.rb
spec/features/issuables/discussion_lock_spec.rb
+1
-1
spec/javascripts/notes/components/issue_comment_form_spec.js
spec/javascripts/notes/components/issue_comment_form_spec.js
+4
-4
spec/javascripts/notes/components/issue_discussion_spec.js
spec/javascripts/notes/components/issue_discussion_spec.js
+2
-2
spec/javascripts/notes/components/issue_note_app_spec.js
spec/javascripts/notes/components/issue_note_app_spec.js
+3
-3
spec/javascripts/notes/components/issue_note_awards_list_spec.js
...vascripts/notes/components/issue_note_awards_list_spec.js
+2
-2
spec/javascripts/notes/components/issue_note_body_spec.js
spec/javascripts/notes/components/issue_note_body_spec.js
+2
-2
spec/javascripts/notes/components/issue_note_form_spec.js
spec/javascripts/notes/components/issue_note_form_spec.js
+2
-2
spec/javascripts/notes/components/issue_note_spec.js
spec/javascripts/notes/components/issue_note_spec.js
+2
-2
spec/javascripts/notes/mock_data.js
spec/javascripts/notes/mock_data.js
+2
-2
spec/javascripts/notes/stores/actions_spec.js
spec/javascripts/notes/stores/actions_spec.js
+4
-4
spec/javascripts/notes/stores/getters_spec.js
spec/javascripts/notes/stores/getters_spec.js
+5
-5
spec/javascripts/notes/stores/mutation_spec.js
spec/javascripts/notes/stores/mutation_spec.js
+5
-5
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
f8efaf1b
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
noteType
:
constants
.
COMMENT
,
noteType
:
constants
.
COMMENT
,
// Can't use mapGetters,
// Can't use mapGetters,
// this needs to be in the data object because it belongs to the state
// this needs to be in the data object because it belongs to the state
issueState
:
this
.
$store
.
getters
.
get
Issu
eData
.
state
,
issueState
:
this
.
$store
.
getters
.
get
Noteabl
eData
.
state
,
isSubmitting
:
false
,
isSubmitting
:
false
,
isSubmitButtonDisabled
:
true
,
isSubmitButtonDisabled
:
true
,
};
};
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
...
mapGetters
([
...
mapGetters
([
'
getCurrentUserLastNote
'
,
'
getCurrentUserLastNote
'
,
'
getUserData
'
,
'
getUserData
'
,
'
get
Issu
eData
'
,
'
get
Noteabl
eData
'
,
'
getNotesData
'
,
'
getNotesData
'
,
]),
]),
isLoggedIn
()
{
isLoggedIn
()
{
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
return
this
.
issueState
===
constants
.
OPENED
||
this
.
issueState
===
constants
.
REOPENED
;
return
this
.
issueState
===
constants
.
OPENED
||
this
.
issueState
===
constants
.
REOPENED
;
},
},
canCreateNote
()
{
canCreateNote
()
{
return
this
.
get
Issu
eData
.
current_user
.
can_create_note
;
return
this
.
get
Noteabl
eData
.
current_user
.
can_create_note
;
},
},
issueActionButtonTitle
()
{
issueActionButtonTitle
()
{
if
(
this
.
note
.
length
)
{
if
(
this
.
note
.
length
)
{
...
@@ -85,16 +85,16 @@
...
@@ -85,16 +85,16 @@
return
this
.
getNotesData
.
quickActionsDocsPath
;
return
this
.
getNotesData
.
quickActionsDocsPath
;
},
},
markdownPreviewPath
()
{
markdownPreviewPath
()
{
return
this
.
get
Issu
eData
.
preview_note_path
;
return
this
.
get
Noteabl
eData
.
preview_note_path
;
},
},
author
()
{
author
()
{
return
this
.
getUserData
;
return
this
.
getUserData
;
},
},
canUpdateIssue
()
{
canUpdateIssue
()
{
return
this
.
get
Issu
eData
.
current_user
.
can_update
;
return
this
.
get
Noteabl
eData
.
current_user
.
can_update
;
},
},
endpoint
()
{
endpoint
()
{
return
this
.
get
Issu
eData
.
create_note_path
;
return
this
.
get
Noteabl
eData
.
create_note_path
;
},
},
},
},
methods
:
{
methods
:
{
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
data
:
{
data
:
{
note
:
{
note
:
{
noteable_type
:
constants
.
NOTEABLE_TYPE
,
noteable_type
:
constants
.
NOTEABLE_TYPE
,
noteable_id
:
this
.
get
Issu
eData
.
id
,
noteable_id
:
this
.
get
Noteabl
eData
.
id
,
note
:
this
.
note
,
note
:
this
.
note
,
},
},
},
},
...
@@ -207,7 +207,7 @@
...
@@ -207,7 +207,7 @@
},
},
initAutoSave
()
{
initAutoSave
()
{
if
(
this
.
isLoggedIn
)
{
if
(
this
.
isLoggedIn
)
{
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
get
Issu
eData
.
id
],
'
issue
'
);
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
get
Noteabl
eData
.
id
],
'
issue
'
);
}
}
},
},
initTaskList
()
{
initTaskList
()
{
...
@@ -266,9 +266,9 @@
...
@@ -266,9 +266,9 @@
<div
class=
"error-alert"
></div>
<div
class=
"error-alert"
></div>
<issue-warning
<issue-warning
v-if=
"hasWarning(get
Issu
eData)"
v-if=
"hasWarning(get
Noteabl
eData)"
:is-locked=
"isLocked(get
Issu
eData)"
:is-locked=
"isLocked(get
Noteabl
eData)"
:is-confidential=
"isConfidential(get
Issu
eData)"
:is-confidential=
"isConfidential(get
Noteabl
eData)"
/>
/>
<markdown-field
<markdown-field
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
f8efaf1b
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
],
],
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
'
get
Issu
eData
'
,
'
get
Noteabl
eData
'
,
]),
]),
discussion
()
{
discussion
()
{
return
this
.
note
.
notes
[
0
];
return
this
.
note
.
notes
[
0
];
...
@@ -50,10 +50,10 @@
...
@@ -50,10 +50,10 @@
return
this
.
discussion
.
author
;
return
this
.
discussion
.
author
;
},
},
canReply
()
{
canReply
()
{
return
this
.
get
Issu
eData
.
current_user
.
can_create_note
;
return
this
.
get
Noteabl
eData
.
current_user
.
can_create_note
;
},
},
newNotePath
()
{
newNotePath
()
{
return
this
.
get
Issu
eData
.
create_note_path
;
return
this
.
get
Noteabl
eData
.
create_note_path
;
},
},
lastUpdatedBy
()
{
lastUpdatedBy
()
{
const
{
notes
}
=
this
.
note
;
const
{
notes
}
=
this
.
note
;
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
f8efaf1b
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
'
getDiscussionLastNote
'
,
'
getDiscussionLastNote
'
,
'
get
Issu
eData
'
,
'
get
Noteabl
eData
'
,
'
get
Issu
eDataByProp
'
,
'
get
Noteabl
eDataByProp
'
,
'
getNotesDataByProp
'
,
'
getNotesDataByProp
'
,
'
getUserDataByProp
'
,
'
getUserDataByProp
'
,
]),
]),
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
return
`#note_
${
this
.
noteId
}
`
;
return
`#note_
${
this
.
noteId
}
`
;
},
},
markdownPreviewPath
()
{
markdownPreviewPath
()
{
return
this
.
get
Issu
eDataByProp
(
'
preview_note_path
'
);
return
this
.
get
Noteabl
eDataByProp
(
'
preview_note_path
'
);
},
},
markdownDocsPath
()
{
markdownDocsPath
()
{
return
this
.
getNotesDataByProp
(
'
markdownDocsPath
'
);
return
this
.
getNotesDataByProp
(
'
markdownDocsPath
'
);
...
@@ -129,9 +129,9 @@
...
@@ -129,9 +129,9 @@
class=
"edit-note common-note-form js-quick-submit gfm-form"
>
class=
"edit-note common-note-form js-quick-submit gfm-form"
>
<issue-warning
<issue-warning
v-if=
"hasWarning(get
Issu
eData)"
v-if=
"hasWarning(get
Noteabl
eData)"
:is-locked=
"isLocked(get
Issu
eData)"
:is-locked=
"isLocked(get
Noteabl
eData)"
:is-confidential=
"isConfidential(get
Issu
eData)"
:is-confidential=
"isConfidential(get
Noteabl
eData)"
/>
/>
<markdown-field
<markdown-field
...
...
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
f8efaf1b
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
export
default
{
export
default
{
name
:
'
issueNotesApp
'
,
name
:
'
issueNotesApp
'
,
props
:
{
props
:
{
issu
eData
:
{
noteabl
eData
:
{
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
actionToggleAward
:
'
toggleAward
'
,
actionToggleAward
:
'
toggleAward
'
,
scrollToNoteIfNeeded
:
'
scrollToNoteIfNeeded
'
,
scrollToNoteIfNeeded
:
'
scrollToNoteIfNeeded
'
,
setNotesData
:
'
setNotesData
'
,
setNotesData
:
'
setNotesData
'
,
set
IssueData
:
'
setIssu
eData
'
,
set
NoteableData
:
'
setNoteabl
eData
'
,
setUserData
:
'
setUserData
'
,
setUserData
:
'
setUserData
'
,
setLastFetchedAt
:
'
setLastFetchedAt
'
,
setLastFetchedAt
:
'
setLastFetchedAt
'
,
setTargetNoteHash
:
'
setTargetNoteHash
'
,
setTargetNoteHash
:
'
setTargetNoteHash
'
,
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
},
},
created
()
{
created
()
{
this
.
setNotesData
(
this
.
notesData
);
this
.
setNotesData
(
this
.
notesData
);
this
.
set
IssueData
(
this
.
issu
eData
);
this
.
set
NoteableData
(
this
.
noteabl
eData
);
this
.
setUserData
(
this
.
userData
);
this
.
setUserData
(
this
.
userData
);
},
},
mounted
()
{
mounted
()
{
...
...
app/assets/javascripts/notes/index.js
View file @
f8efaf1b
...
@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
...
@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
const
notesDataset
=
document
.
getElementById
(
'
js-vue-notes
'
).
dataset
;
const
notesDataset
=
document
.
getElementById
(
'
js-vue-notes
'
).
dataset
;
return
{
return
{
issueData
:
JSON
.
parse
(
notesDataset
.
issu
eData
),
noteableData
:
JSON
.
parse
(
notesDataset
.
noteabl
eData
),
currentUserData
:
JSON
.
parse
(
notesDataset
.
currentUserData
),
currentUserData
:
JSON
.
parse
(
notesDataset
.
currentUserData
),
notesData
:
{
notesData
:
{
lastFetchedAt
:
notesDataset
.
lastFetchedAt
,
lastFetchedAt
:
notesDataset
.
lastFetchedAt
,
...
@@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
...
@@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
'
issue-notes-app
'
,
{
return
createElement
(
'
issue-notes-app
'
,
{
props
:
{
props
:
{
issueData
:
this
.
issu
eData
,
noteableData
:
this
.
noteabl
eData
,
notesData
:
this
.
notesData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
userData
:
this
.
currentUserData
,
},
},
...
...
app/assets/javascripts/notes/services/
issue_
notes_service.js
→
app/assets/javascripts/notes/services/notes_service.js
View file @
f8efaf1b
File moved
app/assets/javascripts/notes/stores/actions.js
View file @
f8efaf1b
...
@@ -4,7 +4,7 @@ import Poll from '../../lib/utils/poll';
...
@@ -4,7 +4,7 @@ import Poll from '../../lib/utils/poll';
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
utils
from
'
./utils
'
;
import
*
as
utils
from
'
./utils
'
;
import
*
as
constants
from
'
../constants
'
;
import
*
as
constants
from
'
../constants
'
;
import
service
from
'
../services/
issue_
notes_service
'
;
import
service
from
'
../services/notes_service
'
;
import
loadAwardsHandler
from
'
../../awards_handler
'
;
import
loadAwardsHandler
from
'
../../awards_handler
'
;
import
sidebarTimeTrackingEventHub
from
'
../../sidebar/event_hub
'
;
import
sidebarTimeTrackingEventHub
from
'
../../sidebar/event_hub
'
;
import
{
isInViewport
,
scrollToElement
}
from
'
../../lib/utils/common_utils
'
;
import
{
isInViewport
,
scrollToElement
}
from
'
../../lib/utils/common_utils
'
;
...
@@ -12,7 +12,7 @@ import { isInViewport, scrollToElement } from '../../lib/utils/common_utils';
...
@@ -12,7 +12,7 @@ import { isInViewport, scrollToElement } from '../../lib/utils/common_utils';
let
eTagPoll
;
let
eTagPoll
;
export
const
setNotesData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_NOTES_DATA
,
data
);
export
const
setNotesData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_NOTES_DATA
,
data
);
export
const
set
IssueData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_ISSU
E_DATA
,
data
);
export
const
set
NoteableData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_NOTEABL
E_DATA
,
data
);
export
const
setUserData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_USER_DATA
,
data
);
export
const
setUserData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_USER_DATA
,
data
);
export
const
setLastFetchedAt
=
({
commit
},
data
)
=>
commit
(
types
.
SET_LAST_FETCHED_AT
,
data
);
export
const
setLastFetchedAt
=
({
commit
},
data
)
=>
commit
(
types
.
SET_LAST_FETCHED_AT
,
data
);
export
const
setInitialNotes
=
({
commit
},
data
)
=>
commit
(
types
.
SET_INITIAL_NOTES
,
data
);
export
const
setInitialNotes
=
({
commit
},
data
)
=>
commit
(
types
.
SET_INITIAL_NOTES
,
data
);
...
...
app/assets/javascripts/notes/stores/getters.js
View file @
f8efaf1b
...
@@ -6,8 +6,8 @@ export const targetNoteHash = state => state.targetNoteHash;
...
@@ -6,8 +6,8 @@ export const targetNoteHash = state => state.targetNoteHash;
export
const
getNotesData
=
state
=>
state
.
notesData
;
export
const
getNotesData
=
state
=>
state
.
notesData
;
export
const
getNotesDataByProp
=
state
=>
prop
=>
state
.
notesData
[
prop
];
export
const
getNotesDataByProp
=
state
=>
prop
=>
state
.
notesData
[
prop
];
export
const
get
IssueData
=
state
=>
state
.
issu
eData
;
export
const
get
NoteableData
=
state
=>
state
.
noteabl
eData
;
export
const
get
IssueDataByProp
=
state
=>
prop
=>
state
.
issu
eData
[
prop
];
export
const
get
NoteableDataByProp
=
state
=>
prop
=>
state
.
noteabl
eData
[
prop
];
export
const
getUserData
=
state
=>
state
.
userData
||
{};
export
const
getUserData
=
state
=>
state
.
userData
||
{};
export
const
getUserDataByProp
=
state
=>
prop
=>
state
.
userData
&&
state
.
userData
[
prop
];
export
const
getUserDataByProp
=
state
=>
prop
=>
state
.
userData
&&
state
.
userData
[
prop
];
...
...
app/assets/javascripts/notes/stores/index.js
View file @
f8efaf1b
...
@@ -15,7 +15,7 @@ export default new Vuex.Store({
...
@@ -15,7 +15,7 @@ export default new Vuex.Store({
// holds endpoints and permissions provided through haml
// holds endpoints and permissions provided through haml
notesData
:
{},
notesData
:
{},
userData
:
{},
userData
:
{},
issu
eData
:
{},
noteabl
eData
:
{},
},
},
actions
,
actions
,
getters
,
getters
,
...
...
app/assets/javascripts/notes/stores/mutation_types.js
View file @
f8efaf1b
...
@@ -3,7 +3,7 @@ export const ADD_NEW_REPLY_TO_DISCUSSION = 'ADD_NEW_REPLY_TO_DISCUSSION';
...
@@ -3,7 +3,7 @@ export const ADD_NEW_REPLY_TO_DISCUSSION = 'ADD_NEW_REPLY_TO_DISCUSSION';
export
const
DELETE_NOTE
=
'
DELETE_NOTE
'
;
export
const
DELETE_NOTE
=
'
DELETE_NOTE
'
;
export
const
REMOVE_PLACEHOLDER_NOTES
=
'
REMOVE_PLACEHOLDER_NOTES
'
;
export
const
REMOVE_PLACEHOLDER_NOTES
=
'
REMOVE_PLACEHOLDER_NOTES
'
;
export
const
SET_NOTES_DATA
=
'
SET_NOTES_DATA
'
;
export
const
SET_NOTES_DATA
=
'
SET_NOTES_DATA
'
;
export
const
SET_
ISSUE_DATA
=
'
SET_ISSU
E_DATA
'
;
export
const
SET_
NOTEABLE_DATA
=
'
SET_NOTEABL
E_DATA
'
;
export
const
SET_USER_DATA
=
'
SET_USER_DATA
'
;
export
const
SET_USER_DATA
=
'
SET_USER_DATA
'
;
export
const
SET_INITIAL_NOTES
=
'
SET_INITIAL_NOTES
'
;
export
const
SET_INITIAL_NOTES
=
'
SET_INITIAL_NOTES
'
;
export
const
SET_LAST_FETCHED_AT
=
'
SET_LAST_FETCHED_AT
'
;
export
const
SET_LAST_FETCHED_AT
=
'
SET_LAST_FETCHED_AT
'
;
...
...
app/assets/javascripts/notes/stores/mutations.js
View file @
f8efaf1b
...
@@ -66,8 +66,8 @@ export default {
...
@@ -66,8 +66,8 @@ export default {
Object
.
assign
(
state
,
{
notesData
:
data
});
Object
.
assign
(
state
,
{
notesData
:
data
});
},
},
[
types
.
SET_
ISSU
E_DATA
](
state
,
data
)
{
[
types
.
SET_
NOTEABL
E_DATA
](
state
,
data
)
{
Object
.
assign
(
state
,
{
issu
eData
:
data
});
Object
.
assign
(
state
,
{
noteabl
eData
:
data
});
},
},
[
types
.
SET_USER_DATA
](
state
,
data
)
{
[
types
.
SET_USER_DATA
](
state
,
data
)
{
...
...
app/views/projects/issues/_discussion.html.haml
View file @
f8efaf1b
...
@@ -13,5 +13,5 @@
...
@@ -13,5 +13,5 @@
quick_actions_docs_path:
help_page_path
(
'user/project/quick_actions'
),
quick_actions_docs_path:
help_page_path
(
'user/project/quick_actions'
),
notes_path:
notes_url
,
notes_path:
notes_url
,
last_fetched_at:
Time
.
now
.
to_i
,
last_fetched_at:
Time
.
now
.
to_i
,
issu
e_data:
serialize_issuable
(
@issue
),
noteabl
e_data:
serialize_issuable
(
@issue
),
current_user_data:
UserSerializer
.
new
.
represent
(
current_user
).
to_json
}
}
current_user_data:
UserSerializer
.
new
.
represent
(
current_user
).
to_json
}
}
spec/features/issuables/discussion_lock_spec.rb
View file @
f8efaf1b
spec/javascripts/notes/components/issue_comment_form_spec.js
View file @
f8efaf1b
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
Autosize
from
'
autosize
'
;
import
Autosize
from
'
autosize
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
issueCommentForm
from
'
~/notes/components/issue_comment_form.vue
'
;
import
issueCommentForm
from
'
~/notes/components/issue_comment_form.vue
'
;
import
{
loggedOut
IssueData
,
notesDataMock
,
userDataMock
,
issu
eDataMock
}
from
'
../mock_data
'
;
import
{
loggedOut
noteableData
,
notesDataMock
,
userDataMock
,
noteabl
eDataMock
}
from
'
../mock_data
'
;
import
{
keyboardDownEvent
}
from
'
../../issue_show/helpers
'
;
import
{
keyboardDownEvent
}
from
'
../../issue_show/helpers
'
;
describe
(
'
issue_comment_form component
'
,
()
=>
{
describe
(
'
issue_comment_form component
'
,
()
=>
{
...
@@ -23,7 +23,7 @@ describe('issue_comment_form component', () => {
...
@@ -23,7 +23,7 @@ describe('issue_comment_form component', () => {
describe
(
'
user is logged in
'
,
()
=>
{
describe
(
'
user is logged in
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
vm
=
mountComponent
();
vm
=
mountComponent
();
...
@@ -178,7 +178,7 @@ describe('issue_comment_form component', () => {
...
@@ -178,7 +178,7 @@ describe('issue_comment_form component', () => {
describe
(
'
issue is confidential
'
,
()
=>
{
describe
(
'
issue is confidential
'
,
()
=>
{
it
(
'
shows information warning
'
,
(
done
)
=>
{
it
(
'
shows information warning
'
,
(
done
)
=>
{
store
.
dispatch
(
'
set
IssueData
'
,
Object
.
assign
(
issu
eDataMock
,
{
confidential
:
true
}));
store
.
dispatch
(
'
set
NoteableData
'
,
Object
.
assign
(
noteabl
eDataMock
,
{
confidential
:
true
}));
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.confidential-issue-warning
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.confidential-issue-warning
'
)).
toBeDefined
();
done
();
done
();
...
@@ -190,7 +190,7 @@ describe('issue_comment_form component', () => {
...
@@ -190,7 +190,7 @@ describe('issue_comment_form component', () => {
describe
(
'
user is not logged in
'
,
()
=>
{
describe
(
'
user is not logged in
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
setUserData
'
,
null
);
store
.
dispatch
(
'
setUserData
'
,
null
);
store
.
dispatch
(
'
set
IssueData
'
,
loggedOutIssu
eData
);
store
.
dispatch
(
'
set
NoteableData
'
,
loggedOutnoteabl
eData
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
vm
=
mountComponent
();
vm
=
mountComponent
();
...
...
spec/javascripts/notes/components/issue_discussion_spec.js
View file @
f8efaf1b
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
issueDiscussion
from
'
~/notes/components/issue_discussion.vue
'
;
import
issueDiscussion
from
'
~/notes/components/issue_discussion.vue
'
;
import
{
issu
eDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
{
noteabl
eDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
describe
(
'
issue_discussion component
'
,
()
=>
{
describe
(
'
issue_discussion component
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -9,7 +9,7 @@ describe('issue_discussion component', () => {
...
@@ -9,7 +9,7 @@ describe('issue_discussion component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
issueDiscussion
);
const
Component
=
Vue
.
extend
(
issueDiscussion
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
vm
=
new
Component
({
vm
=
new
Component
({
...
...
spec/javascripts/notes/components/issue_note_app_spec.js
View file @
f8efaf1b
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
issueNotesApp
from
'
~/notes/components/issue_notes_app.vue
'
;
import
issueNotesApp
from
'
~/notes/components/issue_notes_app.vue
'
;
import
service
from
'
~/notes/services/
issue_
notes_service
'
;
import
service
from
'
~/notes/services/notes_service
'
;
import
*
as
mockData
from
'
../mock_data
'
;
import
*
as
mockData
from
'
../mock_data
'
;
describe
(
'
issue_note_app
'
,
()
=>
{
describe
(
'
issue_note_app
'
,
()
=>
{
...
@@ -24,7 +24,7 @@ describe('issue_note_app', () => {
...
@@ -24,7 +24,7 @@ describe('issue_note_app', () => {
mountComponent
=
(
data
)
=>
{
mountComponent
=
(
data
)
=>
{
const
props
=
data
||
{
const
props
=
data
||
{
issueData
:
mockData
.
issu
eDataMock
,
noteableData
:
mockData
.
noteabl
eDataMock
,
notesData
:
mockData
.
notesDataMock
,
notesData
:
mockData
.
notesDataMock
,
userData
:
mockData
.
userDataMock
,
userData
:
mockData
.
userDataMock
,
};
};
...
@@ -60,7 +60,7 @@ describe('issue_note_app', () => {
...
@@ -60,7 +60,7 @@ describe('issue_note_app', () => {
});
});
it
(
'
should set issue data
'
,
()
=>
{
it
(
'
should set issue data
'
,
()
=>
{
expect
(
vm
.
$store
.
state
.
issueData
).
toEqual
(
mockData
.
issu
eDataMock
);
expect
(
vm
.
$store
.
state
.
noteableData
).
toEqual
(
mockData
.
noteabl
eDataMock
);
});
});
it
(
'
should set user data
'
,
()
=>
{
it
(
'
should set user data
'
,
()
=>
{
...
...
spec/javascripts/notes/components/issue_note_awards_list_spec.js
View file @
f8efaf1b
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
awardsNote
from
'
~/notes/components/issue_note_awards_list.vue
'
;
import
awardsNote
from
'
~/notes/components/issue_note_awards_list.vue
'
;
import
{
issu
eDataMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
{
noteabl
eDataMock
,
notesDataMock
}
from
'
../mock_data
'
;
describe
(
'
issue_note_awards_list component
'
,
()
=>
{
describe
(
'
issue_note_awards_list component
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -10,7 +10,7 @@ describe('issue_note_awards_list component', () => {
...
@@ -10,7 +10,7 @@ describe('issue_note_awards_list component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
awardsNote
);
const
Component
=
Vue
.
extend
(
awardsNote
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
awardsMock
=
[
awardsMock
=
[
{
{
...
...
spec/javascripts/notes/components/issue_note_body_spec.js
View file @
f8efaf1b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
noteBody
from
'
~/notes/components/issue_note_body.vue
'
;
import
noteBody
from
'
~/notes/components/issue_note_body.vue
'
;
import
{
issu
eDataMock
,
notesDataMock
,
note
}
from
'
../mock_data
'
;
import
{
noteabl
eDataMock
,
notesDataMock
,
note
}
from
'
../mock_data
'
;
describe
(
'
issue_note_body component
'
,
()
=>
{
describe
(
'
issue_note_body component
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -10,7 +10,7 @@ describe('issue_note_body component', () => {
...
@@ -10,7 +10,7 @@ describe('issue_note_body component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
noteBody
);
const
Component
=
Vue
.
extend
(
noteBody
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
vm
=
new
Component
({
vm
=
new
Component
({
...
...
spec/javascripts/notes/components/issue_note_form_spec.js
View file @
f8efaf1b
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
issueNoteForm
from
'
~/notes/components/issue_note_form.vue
'
;
import
issueNoteForm
from
'
~/notes/components/issue_note_form.vue
'
;
import
{
issu
eDataMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
{
noteabl
eDataMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
{
keyboardDownEvent
}
from
'
../../issue_show/helpers
'
;
import
{
keyboardDownEvent
}
from
'
../../issue_show/helpers
'
;
describe
(
'
issue_note_form component
'
,
()
=>
{
describe
(
'
issue_note_form component
'
,
()
=>
{
...
@@ -11,7 +11,7 @@ describe('issue_note_form component', () => {
...
@@ -11,7 +11,7 @@ describe('issue_note_form component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
issueNoteForm
);
const
Component
=
Vue
.
extend
(
issueNoteForm
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
props
=
{
props
=
{
...
...
spec/javascripts/notes/components/issue_note_spec.js
View file @
f8efaf1b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
issueNote
from
'
~/notes/components/issue_note.vue
'
;
import
issueNote
from
'
~/notes/components/issue_note.vue
'
;
import
{
issu
eDataMock
,
notesDataMock
,
note
}
from
'
../mock_data
'
;
import
{
noteabl
eDataMock
,
notesDataMock
,
note
}
from
'
../mock_data
'
;
describe
(
'
issue_note
'
,
()
=>
{
describe
(
'
issue_note
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -10,7 +10,7 @@ describe('issue_note', () => {
...
@@ -10,7 +10,7 @@ describe('issue_note', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
issueNote
);
const
Component
=
Vue
.
extend
(
issueNote
);
store
.
dispatch
(
'
set
IssueData
'
,
issu
eDataMock
);
store
.
dispatch
(
'
set
NoteableData
'
,
noteabl
eDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
store
.
dispatch
(
'
setNotesData
'
,
notesDataMock
);
vm
=
new
Component
({
vm
=
new
Component
({
...
...
spec/javascripts/notes/mock_data.js
View file @
f8efaf1b
...
@@ -18,7 +18,7 @@ export const userDataMock = {
...
@@ -18,7 +18,7 @@ export const userDataMock = {
username
:
'
root
'
,
username
:
'
root
'
,
};
};
export
const
issu
eDataMock
=
{
export
const
noteabl
eDataMock
=
{
assignees
:
[],
assignees
:
[],
author_id
:
1
,
author_id
:
1
,
branch_name
:
null
,
branch_name
:
null
,
...
@@ -271,7 +271,7 @@ export const discussionMock = {
...
@@ -271,7 +271,7 @@ export const discussionMock = {
individual_note
:
false
,
individual_note
:
false
,
};
};
export
const
loggedOut
Issu
eData
=
{
export
const
loggedOut
noteabl
eData
=
{
"
id
"
:
98
,
"
id
"
:
98
,
"
iid
"
:
26
,
"
iid
"
:
26
,
"
author_id
"
:
1
,
"
author_id
"
:
1
,
...
...
spec/javascripts/notes/stores/actions_spec.js
View file @
f8efaf1b
import
*
as
actions
from
'
~/notes/stores/actions
'
;
import
*
as
actions
from
'
~/notes/stores/actions
'
;
import
testAction
from
'
../../helpers/vuex_action_helper
'
;
import
testAction
from
'
../../helpers/vuex_action_helper
'
;
import
{
discussionMock
,
notesDataMock
,
userDataMock
,
issu
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
import
{
discussionMock
,
notesDataMock
,
userDataMock
,
noteabl
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
describe
(
'
Actions Notes Store
'
,
()
=>
{
describe
(
'
Actions Notes Store
'
,
()
=>
{
describe
(
'
setNotesData
'
,
()
=>
{
describe
(
'
setNotesData
'
,
()
=>
{
...
@@ -11,10 +11,10 @@ describe('Actions Notes Store', () => {
...
@@ -11,10 +11,10 @@ describe('Actions Notes Store', () => {
});
});
});
});
describe
(
'
set
Issu
eData
'
,
()
=>
{
describe
(
'
set
Noteabl
eData
'
,
()
=>
{
it
(
'
should set received issue data
'
,
(
done
)
=>
{
it
(
'
should set received issue data
'
,
(
done
)
=>
{
testAction
(
actions
.
set
IssueData
,
null
,
{
issu
eData
:
{}
},
[
testAction
(
actions
.
set
NoteableData
,
null
,
{
noteabl
eData
:
{}
},
[
{
type
:
'
SET_
ISSUE_DATA
'
,
payload
:
issu
eDataMock
},
{
type
:
'
SET_
NOTEABLE_DATA
'
,
payload
:
noteabl
eDataMock
},
],
done
);
],
done
);
});
});
});
});
...
...
spec/javascripts/notes/stores/getters_spec.js
View file @
f8efaf1b
import
*
as
getters
from
'
~/notes/stores/getters
'
;
import
*
as
getters
from
'
~/notes/stores/getters
'
;
import
{
notesDataMock
,
userDataMock
,
issu
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
import
{
notesDataMock
,
userDataMock
,
noteabl
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
describe
(
'
Getters Notes Store
'
,
()
=>
{
describe
(
'
Getters Notes Store
'
,
()
=>
{
let
state
;
let
state
;
...
@@ -11,7 +11,7 @@ describe('Getters Notes Store', () => {
...
@@ -11,7 +11,7 @@ describe('Getters Notes Store', () => {
notesData
:
notesDataMock
,
notesData
:
notesDataMock
,
userData
:
userDataMock
,
userData
:
userDataMock
,
issueData
:
issu
eDataMock
,
noteableData
:
noteabl
eDataMock
,
};
};
});
});
describe
(
'
notes
'
,
()
=>
{
describe
(
'
notes
'
,
()
=>
{
...
@@ -32,9 +32,9 @@ describe('Getters Notes Store', () => {
...
@@ -32,9 +32,9 @@ describe('Getters Notes Store', () => {
});
});
});
});
describe
(
'
get
Issu
eData
'
,
()
=>
{
describe
(
'
get
Noteabl
eData
'
,
()
=>
{
it
(
'
should return all data in `
issu
eData`
'
,
()
=>
{
it
(
'
should return all data in `
noteabl
eData`
'
,
()
=>
{
expect
(
getters
.
get
IssueData
(
state
)).
toEqual
(
issu
eDataMock
);
expect
(
getters
.
get
NoteableData
(
state
)).
toEqual
(
noteabl
eDataMock
);
});
});
});
});
...
...
spec/javascripts/notes/stores/mutation_spec.js
View file @
f8efaf1b
import
mutations
from
'
~/notes/stores/mutations
'
;
import
mutations
from
'
~/notes/stores/mutations
'
;
import
{
note
,
discussionMock
,
notesDataMock
,
userDataMock
,
issu
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
import
{
note
,
discussionMock
,
notesDataMock
,
userDataMock
,
noteabl
eDataMock
,
individualNote
}
from
'
../mock_data
'
;
describe
(
'
Mutation Notes Store
'
,
()
=>
{
describe
(
'
Mutation Notes Store
'
,
()
=>
{
describe
(
'
ADD_NEW_NOTE
'
,
()
=>
{
describe
(
'
ADD_NEW_NOTE
'
,
()
=>
{
...
@@ -74,14 +74,14 @@ describe('Mutation Notes Store', () => {
...
@@ -74,14 +74,14 @@ describe('Mutation Notes Store', () => {
});
});
});
});
describe
(
'
SET_
ISSU
E_DATA
'
,
()
=>
{
describe
(
'
SET_
NOTEABL
E_DATA
'
,
()
=>
{
it
(
'
should set the issue data
'
,
()
=>
{
it
(
'
should set the issue data
'
,
()
=>
{
const
state
=
{
const
state
=
{
issu
eData
:
{},
noteabl
eData
:
{},
};
};
mutations
.
SET_
ISSUE_DATA
(
state
,
issu
eDataMock
);
mutations
.
SET_
NOTEABLE_DATA
(
state
,
noteabl
eDataMock
);
expect
(
state
.
issueData
).
toEqual
(
issu
eDataMock
);
expect
(
state
.
noteableData
).
toEqual
(
noteabl
eDataMock
);
});
});
});
});
...
...
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