Commit e0594255 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Mike Greiling

Move boardsStore.moving to BoardList component

parent c90e6943
...@@ -142,8 +142,10 @@ export default { ...@@ -142,8 +142,10 @@ export default {
const card = this.$refs.issue[e.oldIndex]; const card = this.$refs.issue[e.oldIndex];
card.showDetail = false; card.showDetail = false;
boardsStore.moving.list = card.list;
boardsStore.moving.issue = boardsStore.moving.list.findIssue(+e.item.dataset.issueId); const { list } = card;
const issue = list.findIssue(Number(e.item.dataset.issueId));
boardsStore.startMoving(list, issue);
sortableStart(); sortableStart();
}, },
......
...@@ -109,6 +109,11 @@ const boardsStore = { ...@@ -109,6 +109,11 @@ const boardsStore = {
}); });
listFrom.update(); listFrom.update();
}, },
startMoving(list, issue) {
Object.assign(this.moving, { list, issue });
},
moveIssueToList(listFrom, listTo, issue, newIndex) { moveIssueToList(listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id); const issueTo = listTo.findIssue(issue.id);
const issueLists = issue.getLists(); const issueLists = issue.getLists();
......
...@@ -287,4 +287,16 @@ describe('Store', () => { ...@@ -287,4 +287,16 @@ describe('Store', () => {
expect(boardsStore.detail.issue).toEqual({}); expect(boardsStore.detail.issue).toEqual({});
}); });
}); });
describe('startMoving', () => {
it('stores list and issue', () => {
const dummyIssue = 'some issue';
const dummyList = 'some list';
boardsStore.startMoving(dummyList, dummyIssue);
expect(boardsStore.moving.issue).toEqual(dummyIssue);
expect(boardsStore.moving.list).toEqual(dummyList);
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment