summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes/stores/mutation_spec.js
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2018-03-13 13:09:37 -0500
committerClement Ho <ClemMakesApps@gmail.com>2018-03-13 13:09:37 -0500
commit736b4ecf8efa034d95923e8741fb0e31b0d15bfe (patch)
tree96ed63e408c2ac24cc704a6b5a48b3497ed01f16 /spec/javascripts/notes/stores/mutation_spec.js
parent2e5de941392c8463a5e15e9f8cb3a3ab147b656d (diff)
parent8f73ddd896dad7bd66d9c96dafcc4311ce272447 (diff)
downloadgitlab-ce-add-csslab.tar.gz
Merge branch 'master' into add-csslabadd-csslab
Diffstat (limited to 'spec/javascripts/notes/stores/mutation_spec.js')
-rw-r--r--spec/javascripts/notes/stores/mutation_spec.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/spec/javascripts/notes/stores/mutation_spec.js b/spec/javascripts/notes/stores/mutation_spec.js
index 34884f8968f..98f101d6bc5 100644
--- a/spec/javascripts/notes/stores/mutation_spec.js
+++ b/spec/javascripts/notes/stores/mutation_spec.js
@@ -228,4 +228,70 @@ describe('Notes Store mutations', () => {
expect(state.notes[0].notes[0].note).toEqual('Foo');
});
});
+
+ describe('CLOSE_ISSUE', () => {
+ it('should set issue as closed', () => {
+ const state = {
+ notes: [],
+ targetNoteHash: null,
+ lastFetchedAt: null,
+ isToggleStateButtonLoading: false,
+ notesData: {},
+ userData: {},
+ noteableData: {},
+ };
+
+ mutations.CLOSE_ISSUE(state);
+ expect(state.noteableData.state).toEqual('closed');
+ });
+ });
+
+ describe('REOPEN_ISSUE', () => {
+ it('should set issue as closed', () => {
+ const state = {
+ notes: [],
+ targetNoteHash: null,
+ lastFetchedAt: null,
+ isToggleStateButtonLoading: false,
+ notesData: {},
+ userData: {},
+ noteableData: {},
+ };
+
+ mutations.REOPEN_ISSUE(state);
+ expect(state.noteableData.state).toEqual('reopened');
+ });
+ });
+
+ describe('TOGGLE_STATE_BUTTON_LOADING', () => {
+ it('should set isToggleStateButtonLoading as true', () => {
+ const state = {
+ notes: [],
+ targetNoteHash: null,
+ lastFetchedAt: null,
+ isToggleStateButtonLoading: false,
+ notesData: {},
+ userData: {},
+ noteableData: {},
+ };
+
+ mutations.TOGGLE_STATE_BUTTON_LOADING(state, true);
+ expect(state.isToggleStateButtonLoading).toEqual(true);
+ });
+
+ it('should set isToggleStateButtonLoading as false', () => {
+ const state = {
+ notes: [],
+ targetNoteHash: null,
+ lastFetchedAt: null,
+ isToggleStateButtonLoading: true,
+ notesData: {},
+ userData: {},
+ noteableData: {},
+ };
+
+ mutations.TOGGLE_STATE_BUTTON_LOADING(state, false);
+ expect(state.isToggleStateButtonLoading).toEqual(false);
+ });
+ });
});