summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2019-06-05 12:44:30 +0000
committerFatih Acet <acetfatih@gmail.com>2019-06-05 12:44:30 +0000
commit7861503c06e8167b9f392412ae8bb9d65b1825a4 (patch)
tree25f6af09a95306c09c2a6f6e6f552ef1ec2440f3
parent7922270b444836313a5b8be27d2973d41b9dd0c4 (diff)
parent89ea4a63a223468b3ac934f4ce4e3ef11ce26142 (diff)
downloadgitlab-ce-7861503c06e8167b9f392412ae8bb9d65b1825a4.tar.gz
Merge branch 'winh-issue-boards-setListDetail' into 'master'
Extract setListDetail() into issue boards store See merge request gitlab-org/gitlab-ce!29063
-rw-r--r--app/assets/javascripts/boards/components/board_card.vue2
-rw-r--r--app/assets/javascripts/boards/components/board_new_issue.vue2
-rw-r--r--app/assets/javascripts/boards/stores/boards_store.js4
-rw-r--r--spec/javascripts/boards/boards_store_spec.js11
4 files changed, 17 insertions, 2 deletions
diff --git a/app/assets/javascripts/boards/components/board_card.vue b/app/assets/javascripts/boards/components/board_card.vue
index b8882203cc7..179148b6887 100644
--- a/app/assets/javascripts/boards/components/board_card.vue
+++ b/app/assets/javascripts/boards/components/board_card.vue
@@ -66,7 +66,7 @@ export default {
eventHub.$emit('clearDetailIssue');
} else {
eventHub.$emit('newDetailIssue', this.issue);
- boardsStore.detail.list = this.list;
+ boardsStore.setListDetail(this.list);
}
}
},
diff --git a/app/assets/javascripts/boards/components/board_new_issue.vue b/app/assets/javascripts/boards/components/board_new_issue.vue
index 63dc99db086..cc6af8e88cd 100644
--- a/app/assets/javascripts/boards/components/board_new_issue.vue
+++ b/app/assets/javascripts/boards/components/board_new_issue.vue
@@ -73,7 +73,7 @@ export default {
$(this.$refs.submitButton).enable();
boardsStore.setIssueDetail(issue);
- boardsStore.detail.list = this.list;
+ boardsStore.setListDetail(this.list);
})
.catch(() => {
// Need this because our jQuery very kindly disables buttons on ALL form submissions
diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js
index f72ab189015..4b3b44574a8 100644
--- a/app/assets/javascripts/boards/stores/boards_store.js
+++ b/app/assets/javascripts/boards/stores/boards_store.js
@@ -207,6 +207,10 @@ const boardsStore = {
eventHub.$emit('updateTokens');
},
+ setListDetail(newList) {
+ this.detail.list = newList;
+ },
+
updateFiltersUrl() {
window.history.pushState(null, null, `?${this.filter.path}`);
},
diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js
index 68e66346bfd..b5559db8784 100644
--- a/spec/javascripts/boards/boards_store_spec.js
+++ b/spec/javascripts/boards/boards_store_spec.js
@@ -312,6 +312,17 @@ describe('Store', () => {
});
});
+ describe('setListDetail', () => {
+ it('sets the list detail', () => {
+ boardsStore.detail.list = 'not a list';
+
+ const dummyValue = 'new list';
+ boardsStore.setListDetail(dummyValue);
+
+ expect(boardsStore.detail.list).toEqual(dummyValue);
+ });
+ });
+
describe('clearDetailIssue', () => {
it('resets issue details', () => {
boardsStore.detail.issue = 'something';