2019-04-19 04:43:51 +00:00
|
|
|
/* global List */
|
|
|
|
/* global ListIssue */
|
|
|
|
import MockAdapter from 'axios-mock-adapter';
|
|
|
|
import Sortable from 'sortablejs';
|
2021-02-14 18:09:20 +00:00
|
|
|
import Vue from 'vue';
|
2021-01-18 09:11:05 +00:00
|
|
|
import BoardList from '~/boards/components/board_list_deprecated.vue';
|
2019-04-19 04:43:51 +00:00
|
|
|
import '~/boards/models/issue';
|
|
|
|
import '~/boards/models/list';
|
2019-10-28 15:05:58 +00:00
|
|
|
import store from '~/boards/stores';
|
2019-04-19 04:43:51 +00:00
|
|
|
import boardsStore from '~/boards/stores/boards_store';
|
2021-02-15 21:08:59 +00:00
|
|
|
import axios from '~/lib/utils/axios_utils';
|
2021-02-01 15:08:56 +00:00
|
|
|
import { listObj, boardsMockInterceptor } from './mock_data';
|
2019-04-19 04:43:51 +00:00
|
|
|
|
|
|
|
window.Sortable = Sortable;
|
|
|
|
|
2019-11-12 15:06:26 +00:00
|
|
|
export default function createComponent({
|
|
|
|
done,
|
|
|
|
listIssueProps = {},
|
|
|
|
componentProps = {},
|
|
|
|
listProps = {},
|
|
|
|
}) {
|
2019-04-19 04:43:51 +00:00
|
|
|
const el = document.createElement('div');
|
|
|
|
|
|
|
|
document.body.appendChild(el);
|
|
|
|
const mock = new MockAdapter(axios);
|
|
|
|
mock.onAny().reply(boardsMockInterceptor);
|
|
|
|
boardsStore.create();
|
|
|
|
|
|
|
|
const BoardListComp = Vue.extend(BoardList);
|
2019-11-12 15:06:26 +00:00
|
|
|
const list = new List({ ...listObj, ...listProps });
|
2019-04-19 04:43:51 +00:00
|
|
|
const issue = new ListIssue({
|
|
|
|
title: 'Testing',
|
|
|
|
id: 1,
|
|
|
|
iid: 1,
|
|
|
|
confidential: false,
|
|
|
|
labels: [],
|
|
|
|
assignees: [],
|
|
|
|
...listIssueProps,
|
|
|
|
});
|
2019-11-12 15:06:26 +00:00
|
|
|
if (!Object.prototype.hasOwnProperty.call(listProps, 'issuesSize')) {
|
|
|
|
list.issuesSize = 1;
|
|
|
|
}
|
2019-04-19 04:43:51 +00:00
|
|
|
list.issues.push(issue);
|
|
|
|
|
|
|
|
const component = new BoardListComp({
|
|
|
|
el,
|
2019-10-28 15:05:58 +00:00
|
|
|
store,
|
2019-04-19 04:43:51 +00:00
|
|
|
propsData: {
|
|
|
|
disabled: false,
|
|
|
|
list,
|
|
|
|
issues: list.issues,
|
|
|
|
loading: false,
|
|
|
|
...componentProps,
|
|
|
|
},
|
2020-09-17 09:09:32 +00:00
|
|
|
provide: {
|
|
|
|
groupId: null,
|
|
|
|
rootPath: '/',
|
|
|
|
},
|
2019-04-19 04:43:51 +00:00
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
Vue.nextTick(() => {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
return { component, mock };
|
|
|
|
}
|