diff --git a/app/assets/javascripts/pages/shared/wikis/wiki_notes/components/wiki_discussion.vue b/app/assets/javascripts/pages/shared/wikis/wiki_notes/components/wiki_discussion.vue index 89966550cb7c2b1bfda48a748a5eacfc7658b804..7580882a594534772614d50d7a946e1874d4991d 100644 --- a/app/assets/javascripts/pages/shared/wikis/wiki_notes/components/wiki_discussion.vue +++ b/app/assets/javascripts/pages/shared/wikis/wiki_notes/components/wiki_discussion.vue @@ -99,9 +99,8 @@ export default { this.isReplying = value; if (!this.isReplying) clearDraft(this.autosaveKey); }, - updateNote({ notes: { nodes } }) { + updateNote() { this.placeholderNote = {}; - this.replies = [...this.replies, nodes[nodes.length - 1]]; this.toggleReplying(false); }, getUserPermissions(note) { @@ -126,6 +125,7 @@ export default { <div v-for="reply in replies" :key="reply.id"> <wiki-note reply-note + data-testid="wiki-reply-note" :noteable-id="noteableId" :user-permissions="getUserPermissions(reply)" :note="reply" diff --git a/spec/frontend/pages/shared/wikis/notes/components/wiki_discussion_spec.js b/spec/frontend/pages/shared/wikis/notes/components/wiki_discussion_spec.js index 6a6b1a0431f884adf9c2858d23d66e9cb7e4fc80..0b4bae5490e02c889cf57d8ab198ba7280b814ef 100644 --- a/spec/frontend/pages/shared/wikis/notes/components/wiki_discussion_spec.js +++ b/spec/frontend/pages/shared/wikis/notes/components/wiki_discussion_spec.js @@ -193,7 +193,7 @@ describe('WikiDiscussion', () => { expect(placeholderNote.exists()).toBe(false); }); - it('should remove placeholer and add new reply to replies list when creating-note:success event is fired', async () => { + it('should remove placeholer when creating-note:success event is fired', async () => { const newReply = { ...note, id: 'gid://gitlab/DiscussionNote/1525', @@ -202,11 +202,8 @@ describe('WikiDiscussion', () => { replyForm.$emit('creating-note:success', { notes: { nodes: [newReply] } }); await nextTick(); - const reply = noteFooter().findComponent(WikiNote); - const placeholderNote = noteFooter().findComponent(PlaceholderNote); - + const placeholderNote = wrapper.findComponent(PlaceholderNote); expect(placeholderNote.exists()).toBe(false); - expect(reply.exists()).toBe(true); }); }); });