diff options
author | Constance Okoghenun <constanceokoghenun@gmail.com> | 2019-02-18 10:16:13 +0300 |
---|---|---|
committer | Constance Okoghenun <constanceokoghenun@gmail.com> | 2019-02-18 10:16:13 +0300 |
commit | 5e137b58ca15f224a3b1b05999e6e689b463417a (patch) | |
tree | 6e76bdb0c5ef988cdb15172a580a56204f8fe404 /spec/javascripts/notes | |
parent | 10094950bd5c7adff6888a7835f098a759af5ba4 (diff) |
Cancelling reply reverts comment to initial state
When converting a comment to a discussion
if the "Cancel" button is used to exit the new discussion note,
the comment would revert back to its initial state
Diffstat (limited to 'spec/javascripts/notes')
-rw-r--r-- | spec/javascripts/notes/stores/actions_spec.js | 14 | ||||
-rw-r--r-- | spec/javascripts/notes/stores/mutation_spec.js | 19 |
2 files changed, 33 insertions, 0 deletions
diff --git a/spec/javascripts/notes/stores/actions_spec.js b/spec/javascripts/notes/stores/actions_spec.js index 4f70570ffcc..94ce6d8e222 100644 --- a/spec/javascripts/notes/stores/actions_spec.js +++ b/spec/javascripts/notes/stores/actions_spec.js @@ -737,4 +737,18 @@ describe('Actions Notes Store', () => { ); }); }); + + describe('removeConvertedDiscussion', () => { + it('commits CONVERT_TO_DISCUSSION with noteId', done => { + const noteId = 'dummy-id'; + testAction( + actions.removeConvertedDiscussion, + noteId, + {}, + [{ type: 'REMOVE_CONVERTED_DISCUSSION', payload: noteId }], + [], + done, + ); + }); + }); }); diff --git a/spec/javascripts/notes/stores/mutation_spec.js b/spec/javascripts/notes/stores/mutation_spec.js index 88c40dbc5ea..fcad1f245b6 100644 --- a/spec/javascripts/notes/stores/mutation_spec.js +++ b/spec/javascripts/notes/stores/mutation_spec.js @@ -536,4 +536,23 @@ describe('Notes Store mutations', () => { expect(state.convertedDisscussionIds).toContain(discussion.id); }); }); + + describe('REMOVE_CONVERTED_DISCUSSION', () => { + let discussion; + let state; + + beforeEach(() => { + discussion = { + id: 42, + individual_note: true, + }; + state = { convertedDisscussionIds: [41, 42] }; + }); + + it('removes a disucssion from convertedDisscussionIds', () => { + mutations.REMOVE_CONVERTED_DISCUSSION(state, discussion.id); + + expect(state.convertedDisscussionIds).not.toContain(discussion.id); + }); + }); }); |