Commit f5e7b7a8 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/235529/replyExpandsCollapsedDiscussion' into 'master'

Expand collapsed discussion when replying

Closes #235529

See merge request gitlab-org/gitlab!39571
parents f05e1aec bf0b712e
...@@ -149,9 +149,14 @@ export default { ...@@ -149,9 +149,14 @@ export default {
'removePlaceholderNotes', 'removePlaceholderNotes',
'toggleResolveNote', 'toggleResolveNote',
'removeConvertedDiscussion', 'removeConvertedDiscussion',
'expandDiscussion',
]), ]),
showReplyForm() { showReplyForm() {
this.isReplying = true; this.isReplying = true;
if (!this.discussion.expanded) {
this.expandDiscussion({ discussionId: this.discussion.id });
}
}, },
cancelReplyForm(shouldConfirm, isDirty) { cancelReplyForm(shouldConfirm, isDirty) {
if (shouldConfirm && isDirty) { if (shouldConfirm && isDirty) {
......
---
title: Fixed discussion not expanding when replying to a collapsed discussion
merge_request: 39571
author:
type: fixed
...@@ -89,6 +89,23 @@ describe('noteable_discussion component', () => { ...@@ -89,6 +89,23 @@ describe('noteable_discussion component', () => {
}); });
}); });
it('should expand discussion', async () => {
const expandDiscussion = jest.fn();
const discussion = { ...discussionMock };
discussion.expanded = false;
wrapper.setProps({ discussion });
wrapper.setMethods({ expandDiscussion });
await wrapper.vm.$nextTick();
wrapper.vm.showReplyForm();
await wrapper.vm.$nextTick();
expect(expandDiscussion).toHaveBeenCalledWith({ discussionId: discussion.id });
});
it('does not render jump to thread button', () => { it('does not render jump to thread button', () => {
expect(wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists()).toBe( expect(wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists()).toBe(
false, false,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment