Extract setListDetail() into issue boards store

This commit is contained in:
Winnie Hellmann 2019-06-05 12:44:29 +00:00 committed by Fatih Acet
parent 7922270b44
commit 89ea4a63a2
4 changed files with 17 additions and 2 deletions

View File

@ -66,7 +66,7 @@ export default {
eventHub.$emit('clearDetailIssue');
} else {
eventHub.$emit('newDetailIssue', this.issue);
boardsStore.detail.list = this.list;
boardsStore.setListDetail(this.list);
}
}
},

View File

@ -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

View File

@ -207,6 +207,10 @@ const boardsStore = {
eventHub.$emit('updateTokens');
},
setListDetail(newList) {
this.detail.list = newList;
},
updateFiltersUrl() {
window.history.pushState(null, null, `?${this.filter.path}`);
},

View File

@ -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';