diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2019-06-04 18:34:19 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2019-06-04 18:34:19 +0300 |
commit | c027a3d92d1a02cec52e5b482ad72c55ae5164a4 (patch) | |
tree | 8c78e40eb81a5e847fb3f7b63551cd0a49537e83 | |
parent | f4cb5d2beb3d2d473a7ae7794774b554dc025aae (diff) | |
parent | 0c93e470fd2ff59bf59a13cc012ff33fd7a40704 (diff) |
Merge branch 'winh-issue-boards-setIssueDetail' into 'master'
Extract setIssueDetail() into issue boards store
See merge request gitlab-org/gitlab-ce!29071
4 files changed, 18 insertions, 3 deletions
diff --git a/app/assets/javascripts/boards/components/board_new_issue.vue b/app/assets/javascripts/boards/components/board_new_issue.vue index dc1bdc23b5e..63dc99db086 100644 --- a/app/assets/javascripts/boards/components/board_new_issue.vue +++ b/app/assets/javascripts/boards/components/board_new_issue.vue @@ -72,7 +72,7 @@ export default { // Need this because our jQuery very kindly disables buttons on ALL form submissions $(this.$refs.submitButton).enable(); - boardsStore.detail.issue = issue; + boardsStore.setIssueDetail(issue); boardsStore.detail.list = this.list; }) .catch(() => { diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index bc6a3cf212e..e9cab3e3bba 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -168,7 +168,7 @@ export default () => { }); } - boardsStore.detail.issue = newIssue; + boardsStore.setIssueDetail(newIssue); }, clearDetailIssue() { boardsStore.clearDetailIssue(); diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index d6718b96f2c..f72ab189015 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -212,7 +212,11 @@ const boardsStore = { }, clearDetailIssue() { - this.detail.issue = {}; + this.setIssueDetail({}); + }, + + setIssueDetail(issueDetail) { + this.detail.issue = issueDetail; }, }; diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js index e77768e3597..68e66346bfd 100644 --- a/spec/javascripts/boards/boards_store_spec.js +++ b/spec/javascripts/boards/boards_store_spec.js @@ -322,6 +322,17 @@ describe('Store', () => { }); }); + describe('setIssueDetail', () => { + it('sets issue details', () => { + boardsStore.detail.issue = 'some details'; + + const dummyValue = 'new details'; + boardsStore.setIssueDetail(dummyValue); + + expect(boardsStore.detail.issue).toEqual(dummyValue); + }); + }); + describe('startMoving', () => { it('stores list and issue', () => { const dummyIssue = 'some issue'; |