提交 c61c3b68 编写于 作者: C Clement Ho

Merge branch 'fe-delete-old-boardservice' into 'master'

change BoardService in favor of boardsStore on board blank state of the component board

See merge request gitlab-org/gitlab-ce!30546
<script>
import { __ } from '~/locale';
/* global ListLabel */
import ListLabel from '~/boards/models/label';
import Cookies from 'js-cookie';
import boardsStore from '../stores/boards_store';
......@@ -30,13 +30,17 @@ export default {
});
// Save the labels
gl.boardService
boardsStore
.generateDefaultLists()
.then(res => res.data)
.then(data => {
data.forEach(listObj => {
const list = boardsStore.findList('title', listObj.title);
if (!list) {
return;
}
list.id = listObj.id;
list.label.id = listObj.label.id;
list.getIssues().catch(() => {
......@@ -69,8 +73,7 @@ export default {
<span
:style="{ backgroundColor: label.color }"
class="label-color position-relative d-inline-block rounded"
>
</span>
></span>
{{ label.title }}
</li>
</ul>
......
---
title: Change BoardService in favor of boardsStore on board blank state of the component
board
merge_request: 30546
author: eduarmreyes
type: other
import Vue from 'vue';
import boardsStore from '~/boards/stores/boards_store';
import BoardBlankState from '~/boards/components/board_blank_state.vue';
import { mockBoardService } from './mock_data';
describe('Boards blank state', () => {
let vm;
......@@ -11,9 +10,10 @@ describe('Boards blank state', () => {
const Comp = Vue.extend(BoardBlankState);
boardsStore.create();
gl.boardService = mockBoardService();
spyOn(gl.boardService, 'generateDefaultLists').and.callFake(
spyOn(boardsStore, 'addList').and.stub();
spyOn(boardsStore, 'removeList').and.stub();
spyOn(boardsStore, 'generateDefaultLists').and.callFake(
() =>
new Promise((resolve, reject) => {
if (fail) {
......@@ -71,9 +71,14 @@ describe('Boards blank state', () => {
vm.$el.querySelector('.btn-success').click();
setTimeout(() => {
expect(boardsStore.state.lists.length).toBe(2);
expect(boardsStore.state.lists[0].title).toEqual('To Do');
expect(boardsStore.state.lists[1].title).toEqual('Doing');
expect(boardsStore.addList).toHaveBeenCalledTimes(2);
expect(boardsStore.addList).toHaveBeenCalledWith(
jasmine.objectContaining({ title: 'To Do' }),
);
expect(boardsStore.addList).toHaveBeenCalledWith(
jasmine.objectContaining({ title: 'Doing' }),
);
done();
});
......@@ -86,7 +91,7 @@ describe('Boards blank state', () => {
setTimeout(() => {
expect(boardsStore.welcomeIsHidden()).toBeFalsy();
expect(boardsStore.state.lists.length).toBe(1);
expect(boardsStore.removeList).toHaveBeenCalledWith(undefined, 'label');
done();
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册