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