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
f473fe3e
Commit
f473fe3e
authored
Jul 28, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change $emit invoke to single arg in HistoryEntry
parent
cd5e6ba4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
ee/app/assets/javascripts/vulnerabilities/components/history_comment.vue
...avascripts/vulnerabilities/components/history_comment.vue
+1
-1
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
.../javascripts/vulnerabilities/components/history_entry.vue
+2
-2
ee/spec/frontend/vulnerabilities/history_comment_spec.js
ee/spec/frontend/vulnerabilities/history_comment_spec.js
+6
-5
ee/spec/frontend/vulnerabilities/history_entry_spec.js
ee/spec/frontend/vulnerabilities/history_entry_spec.js
+11
-15
No files found.
ee/app/assets/javascripts/vulnerabilities/components/history_comment.vue
View file @
f473fe3e
...
...
@@ -105,7 +105,7 @@ export default {
axios
({
method
,
url
,
data
})
.
then
(({
data
:
responseData
})
=>
{
this
.
isEditingComment
=
false
;
this
.
$emit
(
emitName
,
responseData
,
this
.
comment
);
this
.
$emit
(
emitName
,
{
response
:
responseData
,
comment
:
this
.
comment
}
);
})
.
catch
(()
=>
{
createFlash
({
...
...
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
View file @
f473fe3e
...
...
@@ -36,11 +36,11 @@ export default {
addComment
(
comment
)
{
this
.
notes
.
push
(
comment
);
},
updateComment
(
data
,
comment
)
{
updateComment
(
{
response
,
comment
}
)
{
const
index
=
this
.
notes
.
indexOf
(
comment
);
if
(
index
>
-
1
)
{
this
.
notes
.
splice
(
index
,
1
,
{
...
comment
,
...
data
});
this
.
notes
.
splice
(
index
,
1
,
{
...
comment
,
...
response
});
}
},
removeComment
(
comment
)
{
...
...
ee/spec/frontend/vulnerabilities/history_comment_spec.js
View file @
f473fe3e
...
...
@@ -115,8 +115,9 @@ describe('History Comment', () => {
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
post
).
toHaveLength
(
1
);
expect
(
wrapper
.
emitted
().
onCommentAdded
).
toBeTruthy
();
expect
(
wrapper
.
emitted
().
onCommentAdded
[
0
][
0
]).
toEqual
(
comment
);
expect
(
wrapper
.
emitted
().
onCommentAdded
[
0
]).
toEqual
([
{
response
:
comment
,
comment
:
undefined
},
]);
});
});
...
...
@@ -239,9 +240,9 @@ describe('History Comment', () => {
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
put
).
toHaveLength
(
1
);
expect
(
wrapper
.
emitted
().
onCommentUpdated
).
toBeTruthy
();
expect
(
wrapper
.
emitted
().
onCommentUpdated
[
0
][
0
]).
toEqual
(
responseData
);
expect
(
wrapper
.
emitted
().
onCommentUpdated
[
0
][
1
]).
toEqual
(
comment
);
expect
(
wrapper
.
emitted
().
onCommentUpdated
[
0
]).
toEqual
([
{
response
:
responseData
,
comment
},
]
);
});
});
...
...
ee/spec/frontend/vulnerabilities/history_entry_spec.js
View file @
f473fe3e
...
...
@@ -39,9 +39,9 @@ describe('History Entry', () => {
});
};
const
eventItem
=
()
=>
wrapper
.
find
(
EventItem
);
const
newComment
=
()
=>
wrapper
.
find
({
ref
:
'
newComment
'
});
const
existingComments
=
()
=>
wrapper
.
findAll
({
ref
:
'
existingComment
'
});
const
eventItem
=
()
=>
wrapper
.
find
Component
(
EventItem
);
const
newComment
=
()
=>
wrapper
.
find
Component
({
ref
:
'
newComment
'
});
const
existingComments
=
()
=>
wrapper
.
findAll
Components
({
ref
:
'
existingComment
'
});
const
commentAt
=
(
index
)
=>
existingComments
().
at
(
index
);
afterEach
(()
=>
wrapper
.
destroy
());
...
...
@@ -92,23 +92,19 @@ describe('History Entry', () => {
});
});
it
(
'
updates an existing comment correctly
'
,
()
=>
{
const
note
=
'
new note
'
;
it
(
'
updates an existing comment correctly
'
,
async
()
=>
{
const
response
=
{
note
:
'
new note
'
}
;
createWrapper
(
systemNote
,
commentNote
);
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
{
note
},
commentNote
);
await
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
{
response
,
comment
:
commentNote
}
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
commentAt
(
0
).
props
(
'
comment
'
).
note
).
toBe
(
note
);
});
expect
(
commentAt
(
0
).
props
(
'
comment
'
).
note
).
toBe
(
response
.
note
);
});
it
(
'
deletes an existing comment correctly
'
,
()
=>
{
it
(
'
deletes an existing comment correctly
'
,
async
()
=>
{
createWrapper
(
systemNote
,
commentNote
);
commentAt
(
0
).
vm
.
$emit
(
'
onCommentDeleted
'
,
commentNote
);
await
commentAt
(
0
).
vm
.
$emit
(
'
onCommentDeleted
'
,
commentNote
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
newComment
().
exists
()).
toBe
(
true
);
expect
(
existingComments
()).
toHaveLength
(
0
);
});
expect
(
newComment
().
exists
()).
toBe
(
true
);
expect
(
existingComments
()).
toHaveLength
(
0
);
});
});
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