Commit 98e1f7d5 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'winh-boardsStore.moving' into 'master'

Move boardsStore.moving to BoardList component

See merge request gitlab-org/gitlab-ce!29076
parents c90e6943 e0594255
...@@ -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