Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/boards')
-rw-r--r--spec/frontend/boards/board_card_inner_spec.js241
-rw-r--r--spec/frontend/boards/board_list_helper.js2
-rw-r--r--spec/frontend/boards/board_list_spec.js6
-rw-r--r--spec/frontend/boards/components/board_add_new_column_spec.js2
-rw-r--r--spec/frontend/boards/components/board_app_spec.js1
-rw-r--r--spec/frontend/boards/components/board_card_move_to_position_spec.js1
-rw-r--r--spec/frontend/boards/components/board_card_spec.js2
-rw-r--r--spec/frontend/boards/components/board_content_spec.js84
-rw-r--r--spec/frontend/boards/components/board_filtered_search_spec.js44
-rw-r--r--spec/frontend/boards/components/board_list_header_spec.js2
-rw-r--r--spec/frontend/boards/components/board_settings_sidebar_spec.js1
-rw-r--r--spec/frontend/boards/components/board_top_bar_spec.js11
-rw-r--r--spec/frontend/boards/mock_data.js81
-rw-r--r--spec/frontend/boards/stores/actions_spec.js18
14 files changed, 319 insertions, 177 deletions
diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js
index 3ebc51c4bcb..d05e057095d 100644
--- a/spec/frontend/boards/board_card_inner_spec.js
+++ b/spec/frontend/boards/board_card_inner_spec.js
@@ -7,7 +7,6 @@ import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import IssuableBlockedIcon from '~/vue_shared/components/issuable_blocked_icon/issuable_blocked_icon.vue';
import BoardCardInner from '~/boards/components/board_card_inner.vue';
-import BoardCardMoveToPosition from '~/boards/components/board_card_move_to_position.vue';
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
import { issuableTypes } from '~/boards/constants';
import eventHub from '~/boards/eventhub';
@@ -49,12 +48,11 @@ describe('Board card component', () => {
const findEpicCountablesTotalWeight = () => wrapper.findByTestId('epic-countables-total-weight');
const findEpicProgressTooltip = () => wrapper.findByTestId('epic-progress-tooltip-content');
const findHiddenIssueIcon = () => wrapper.findByTestId('hidden-icon');
- const findMoveToPositionComponent = () => wrapper.findComponent(BoardCardMoveToPosition);
const findWorkItemIcon = () => wrapper.findComponent(WorkItemTypeIcon);
const performSearchMock = jest.fn();
- const createStore = ({ isEpicBoard = false, isProjectBoard = false } = {}) => {
+ const createStore = ({ isProjectBoard = false } = {}) => {
store = new Vuex.Store({
...defaultStore,
actions: {
@@ -67,13 +65,12 @@ describe('Board card component', () => {
},
getters: {
isGroupBoard: () => true,
- isEpicBoard: () => isEpicBoard,
isProjectBoard: () => isProjectBoard,
},
});
};
- const createWrapper = (props = {}) => {
+ const createWrapper = ({ props = {}, isEpicBoard = false } = {}) => {
wrapper = mountExtended(BoardCardInner, {
store,
propsData: {
@@ -99,6 +96,7 @@ describe('Board card component', () => {
provide: {
rootPath: '/',
scopedLabelsAvailable: false,
+ isEpicBoard,
},
});
};
@@ -113,7 +111,7 @@ describe('Board card component', () => {
};
createStore();
- createWrapper({ item: issue, list });
+ createWrapper({ props: { item: issue, list } });
});
afterEach(() => {
@@ -143,16 +141,12 @@ describe('Board card component', () => {
expect(findHiddenIssueIcon().exists()).toBe(false);
});
- it('renders the move to position icon', () => {
- expect(findMoveToPositionComponent().exists()).toBe(true);
- });
-
it('does not render the work type icon by default', () => {
expect(findWorkItemIcon().exists()).toBe(false);
});
it('renders the work type icon when props is passed', () => {
- createWrapper({ item: issue, list, showWorkItemTypeIcon: true });
+ createWrapper({ props: { item: issue, list, showWorkItemTypeIcon: true } });
expect(findWorkItemIcon().exists()).toBe(true);
expect(findWorkItemIcon().props('workItemType')).toBe(issue.type);
});
@@ -183,9 +177,11 @@ describe('Board card component', () => {
describe('blocked', () => {
it('renders blocked icon if issue is blocked', async () => {
createWrapper({
- item: {
- ...issue,
- blocked: true,
+ props: {
+ item: {
+ ...issue,
+ blocked: true,
+ },
},
});
@@ -194,9 +190,11 @@ describe('Board card component', () => {
it('does not show blocked icon if issue is not blocked', () => {
createWrapper({
- item: {
- ...issue,
- blocked: false,
+ props: {
+ item: {
+ ...issue,
+ blocked: false,
+ },
},
});
@@ -207,9 +205,11 @@ describe('Board card component', () => {
describe('confidential issue', () => {
beforeEach(() => {
createWrapper({
- item: {
- ...wrapper.props('item'),
- confidential: true,
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ confidential: true,
+ },
},
});
});
@@ -222,9 +222,11 @@ describe('Board card component', () => {
describe('hidden issue', () => {
beforeEach(() => {
createWrapper({
- item: {
- ...wrapper.props('item'),
- hidden: true,
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ hidden: true,
+ },
},
});
});
@@ -247,11 +249,13 @@ describe('Board card component', () => {
describe('with avatar', () => {
beforeEach(() => {
createWrapper({
- item: {
- ...wrapper.props('item'),
- assignees: [user],
- updateData(newData) {
- Object.assign(this, newData);
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ assignees: [user],
+ updateData(newData) {
+ Object.assign(this, newData);
+ },
},
},
});
@@ -300,15 +304,17 @@ describe('Board card component', () => {
global.gon.default_avatar_url = 'default_avatar';
createWrapper({
- item: {
- ...wrapper.props('item'),
- assignees: [
- {
- id: 1,
- name: 'testing 123',
- username: 'test',
- },
- ],
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ assignees: [
+ {
+ id: 1,
+ name: 'testing 123',
+ username: 'test',
+ },
+ ],
+ },
},
});
});
@@ -329,28 +335,30 @@ describe('Board card component', () => {
describe('multiple assignees', () => {
beforeEach(() => {
createWrapper({
- item: {
- ...wrapper.props('item'),
- assignees: [
- {
- id: 2,
- name: 'user2',
- username: 'user2',
- avatarUrl: 'test_image',
- },
- {
- id: 3,
- name: 'user3',
- username: 'user3',
- avatarUrl: 'test_image',
- },
- {
- id: 4,
- name: 'user4',
- username: 'user4',
- avatarUrl: 'test_image',
- },
- ],
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ assignees: [
+ {
+ id: 2,
+ name: 'user2',
+ username: 'user2',
+ avatarUrl: 'test_image',
+ },
+ {
+ id: 3,
+ name: 'user3',
+ username: 'user3',
+ avatarUrl: 'test_image',
+ },
+ {
+ id: 4,
+ name: 'user4',
+ username: 'user4',
+ avatarUrl: 'test_image',
+ },
+ ],
+ },
},
});
});
@@ -370,9 +378,11 @@ describe('Board card component', () => {
});
createWrapper({
- item: {
- ...wrapper.props('item'),
- assignees,
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ assignees,
+ },
},
});
});
@@ -396,9 +406,11 @@ describe('Board card component', () => {
})),
];
createWrapper({
- item: {
- ...wrapper.props('item'),
- assignees,
+ props: {
+ item: {
+ ...wrapper.props('item'),
+ assignees,
+ },
},
});
@@ -411,7 +423,7 @@ describe('Board card component', () => {
describe('labels', () => {
beforeEach(() => {
- createWrapper({ item: { ...issue, labels: [list.label, label1] } });
+ createWrapper({ props: { item: { ...issue, labels: [list.label, label1] } } });
});
it('does not render list label but renders all other labels', () => {
@@ -423,7 +435,7 @@ describe('Board card component', () => {
});
it('does not render label if label does not have an ID', async () => {
- createWrapper({ item: { ...issue, labels: [label1, { title: 'closed' }] } });
+ createWrapper({ props: { item: { ...issue, labels: [label1, { title: 'closed' }] } } });
await nextTick();
@@ -435,11 +447,13 @@ describe('Board card component', () => {
describe('filterByLabel method', () => {
beforeEach(() => {
createWrapper({
- item: {
- ...issue,
- labels: [label1],
+ props: {
+ item: {
+ ...issue,
+ labels: [label1],
+ },
+ updateFilters: true,
},
- updateFilters: true,
});
});
@@ -486,9 +500,11 @@ describe('Board card component', () => {
describe('loading', () => {
it('renders loading icon', async () => {
createWrapper({
- item: {
- ...issue,
- isLoading: true,
+ props: {
+ item: {
+ ...issue,
+ isLoading: true,
+ },
},
});
@@ -510,17 +526,20 @@ describe('Board card component', () => {
};
beforeEach(() => {
- createStore({ isEpicBoard: true });
+ createStore();
});
it('should render if the item has issues', () => {
createWrapper({
- item: {
- ...issue,
- descendantCounts,
- descendantWeightSum,
- hasIssues: true,
+ props: {
+ item: {
+ ...issue,
+ descendantCounts,
+ descendantWeightSum,
+ hasIssues: true,
+ },
},
+ isEpicBoard: true,
});
expect(findEpicCountables().exists()).toBe(true);
@@ -541,18 +560,21 @@ describe('Board card component', () => {
it('shows render item countBadge, weights, and progress correctly', () => {
createWrapper({
- item: {
- ...issue,
- descendantCounts: {
- ...descendantCounts,
- openedIssues: 1,
- },
- descendantWeightSum: {
- closedIssues: 10,
- openedIssues: 5,
+ props: {
+ item: {
+ ...issue,
+ descendantCounts: {
+ ...descendantCounts,
+ openedIssues: 1,
+ },
+ descendantWeightSum: {
+ closedIssues: 10,
+ openedIssues: 5,
+ },
+ hasIssues: true,
},
- hasIssues: true,
},
+ isEpicBoard: true,
});
expect(findEpicCountablesBadgeIssues().text()).toBe('1');
@@ -562,15 +584,18 @@ describe('Board card component', () => {
it('does not render progress when weight is zero', () => {
createWrapper({
- item: {
- ...issue,
- descendantCounts: {
- ...descendantCounts,
- openedIssues: 1,
+ props: {
+ item: {
+ ...issue,
+ descendantCounts: {
+ ...descendantCounts,
+ openedIssues: 1,
+ },
+ descendantWeightSum,
+ hasIssues: true,
},
- descendantWeightSum,
- hasIssues: true,
},
+ isEpicBoard: true,
});
expect(findEpicBadgeProgress().exists()).toBe(false);
@@ -578,15 +603,18 @@ describe('Board card component', () => {
it('renders the tooltip with the correct data', () => {
createWrapper({
- item: {
- ...issue,
- descendantCounts,
- descendantWeightSum: {
- closedIssues: 10,
- openedIssues: 5,
+ props: {
+ item: {
+ ...issue,
+ descendantCounts,
+ descendantWeightSum: {
+ closedIssues: 10,
+ openedIssues: 5,
+ },
+ hasIssues: true,
},
- hasIssues: true,
},
+ isEpicBoard: true,
});
const tooltip = findEpicCountablesTotalTooltip();
@@ -595,10 +623,5 @@ describe('Board card component', () => {
expect(findEpicCountablesTotalWeight().text()).toBe('15');
expect(findEpicProgressTooltip().text()).toBe('10 of 15 weight completed');
});
-
- it('does not render the move to position icon', () => {
- createWrapper();
- expect(findMoveToPositionComponent().exists()).toBe(false);
- });
});
});
diff --git a/spec/frontend/boards/board_list_helper.js b/spec/frontend/boards/board_list_helper.js
index 65a41c49e7f..c5c3faf1712 100644
--- a/spec/frontend/boards/board_list_helper.js
+++ b/spec/frontend/boards/board_list_helper.js
@@ -101,6 +101,8 @@ export default function createComponent({
weightFeatureAvailable: false,
boardWeight: null,
canAdminList: true,
+ isIssueBoard: true,
+ isEpicBoard: false,
...provide,
},
stubs,
diff --git a/spec/frontend/boards/board_list_spec.js b/spec/frontend/boards/board_list_spec.js
index 9b0c0b93ffb..3a2beb714e9 100644
--- a/spec/frontend/boards/board_list_spec.js
+++ b/spec/frontend/boards/board_list_spec.js
@@ -6,6 +6,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import createComponent from 'jest/boards/board_list_helper';
import BoardCard from '~/boards/components/board_card.vue';
import eventHub from '~/boards/eventhub';
+import BoardCardMoveToPosition from '~/boards/components/board_card_move_to_position.vue';
import { mockIssues } from './mock_data';
@@ -15,6 +16,7 @@ describe('Board list component', () => {
const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const findIssueCountLoadingIcon = () => wrapper.find('[data-testid="count-loading-icon"]');
const findDraggable = () => wrapper.findComponent(Draggable);
+ const findMoveToPositionComponent = () => wrapper.findComponent(BoardCardMoveToPosition);
const startDrag = (
params = {
@@ -99,6 +101,10 @@ describe('Board list component', () => {
await nextTick();
expect(wrapper.find('.board-list-count').attributes('data-issue-id')).toBe('-1');
});
+
+ it('renders the move to position icon', () => {
+ expect(findMoveToPositionComponent().exists()).toBe(true);
+ });
});
describe('load more issues', () => {
diff --git a/spec/frontend/boards/components/board_add_new_column_spec.js b/spec/frontend/boards/components/board_add_new_column_spec.js
index 5fae1c4359f..a3b2988ce75 100644
--- a/spec/frontend/boards/components/board_add_new_column_spec.js
+++ b/spec/frontend/boards/components/board_add_new_column_spec.js
@@ -53,11 +53,11 @@ describe('Board card layout', () => {
state: {
labels,
labelsLoading: false,
- isEpicBoard: false,
},
}),
provide: {
scopedLabelsAvailable: true,
+ isEpicBoard: false,
},
}),
);
diff --git a/spec/frontend/boards/components/board_app_spec.js b/spec/frontend/boards/components/board_app_spec.js
index dee097bfb08..c209f2f82e6 100644
--- a/spec/frontend/boards/components/board_app_spec.js
+++ b/spec/frontend/boards/components/board_app_spec.js
@@ -28,6 +28,7 @@ describe('BoardApp', () => {
store,
provide: {
...provide,
+ fullBoardId: 'gid://gitlab/Board/1',
},
});
};
diff --git a/spec/frontend/boards/components/board_card_move_to_position_spec.js b/spec/frontend/boards/components/board_card_move_to_position_spec.js
index 7254b9486ef..8dee3c77787 100644
--- a/spec/frontend/boards/components/board_card_move_to_position_spec.js
+++ b/spec/frontend/boards/components/board_card_move_to_position_spec.js
@@ -48,6 +48,7 @@ describe('Board Card Move to position', () => {
propsData: {
item: mockIssue2,
list: mockList,
+ listItemsLength: 3,
index: 0,
...propsData,
},
diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js
index 2feaa5dff8c..38b79e2e3f3 100644
--- a/spec/frontend/boards/components/board_card_spec.js
+++ b/spec/frontend/boards/components/board_card_spec.js
@@ -30,7 +30,6 @@ describe('Board card', () => {
},
actions: mockActions,
getters: {
- isEpicBoard: () => false,
isProjectBoard: () => false,
},
});
@@ -61,6 +60,7 @@ describe('Board card', () => {
groupId: null,
rootPath: '/',
scopedLabelsAvailable: false,
+ isEpicBoard: false,
...provide,
},
});
diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js
index 97d9e08f5d4..b2138700602 100644
--- a/spec/frontend/boards/components/board_content_spec.js
+++ b/spec/frontend/boards/components/board_content_spec.js
@@ -1,15 +1,20 @@
import { GlAlert } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
-import Vue from 'vue';
+import Vue, { nextTick } from 'vue';
+import VueApollo from 'vue-apollo';
import Draggable from 'vuedraggable';
import Vuex from 'vuex';
+import waitForPromises from 'helpers/wait_for_promises';
+import createMockApollo from 'helpers/mock_apollo_helper';
import EpicsSwimlanes from 'ee_component/boards/components/epics_swimlanes.vue';
import getters from 'ee_else_ce/boards/stores/getters';
+import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql';
import BoardColumn from '~/boards/components/board_column.vue';
import BoardContent from '~/boards/components/board_content.vue';
import BoardContentSidebar from '~/boards/components/board_content_sidebar.vue';
-import { mockLists } from '../mock_data';
+import { mockLists, boardListsQueryResponse } from '../mock_data';
+Vue.use(VueApollo);
Vue.use(Vuex);
const actions = {
@@ -18,6 +23,7 @@ const actions = {
describe('BoardContent', () => {
let wrapper;
+ let fakeApollo;
window.gon = {};
const defaultState = {
@@ -35,26 +41,68 @@ describe('BoardContent', () => {
});
};
- const createComponent = ({ state, props = {}, canAdminList = true } = {}) => {
+ const createComponent = ({
+ state,
+ props = {},
+ canAdminList = true,
+ isApolloBoard = false,
+ issuableType = 'issue',
+ isIssueBoard = true,
+ isEpicBoard = false,
+ boardListQueryHandler = jest.fn().mockResolvedValue(boardListsQueryResponse),
+ } = {}) => {
+ fakeApollo = createMockApollo([[boardListsQuery, boardListQueryHandler]]);
+
const store = createStore({
...defaultState,
...state,
});
wrapper = shallowMount(BoardContent, {
+ apolloProvider: fakeApollo,
propsData: {
- lists: mockLists,
disabled: false,
+ boardId: 'gid://gitlab/Board/1',
...props,
},
provide: {
canAdminList,
+ boardType: 'group',
+ fullPath: 'gitlab-org/gitlab',
+ issuableType,
+ isIssueBoard,
+ isEpicBoard,
+ isApolloBoard,
},
store,
});
};
+ beforeAll(() => {
+ global.ResizeObserver = class MockResizeObserver {
+ constructor(callback) {
+ this.callback = callback;
+
+ this.entries = [];
+ }
+
+ observe(entry) {
+ this.entries.push(entry);
+ }
+
+ disconnect() {
+ this.entries = [];
+ this.callback = null;
+ }
+
+ trigger() {
+ this.callback(this.entries);
+ }
+ };
+ });
+
afterEach(() => {
wrapper.destroy();
+ fakeApollo = null;
});
describe('default', () => {
@@ -74,11 +122,22 @@ describe('BoardContent', () => {
expect(wrapper.findComponent(EpicsSwimlanes).exists()).toBe(false);
expect(wrapper.findComponent(GlAlert).exists()).toBe(false);
});
+
+ it('resizes the list on resize', async () => {
+ window.innerHeight = 1000;
+ jest.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ top: 100 });
+
+ wrapper.vm.resizeObserver.trigger();
+
+ await nextTick();
+
+ expect(wrapper.findComponent({ ref: 'list' }).attributes('style')).toBe('height: 900px;');
+ });
});
describe('when issuableType is not issue', () => {
beforeEach(() => {
- createComponent({ state: { issuableType: 'foo' } });
+ createComponent({ issuableType: 'foo', isIssueBoard: false });
});
it('does not render BoardContentSidebar', () => {
@@ -105,4 +164,19 @@ describe('BoardContent', () => {
expect(wrapper.findComponent(Draggable).exists()).toBe(false);
});
});
+
+ describe('when Apollo boards FF is on', () => {
+ beforeEach(async () => {
+ createComponent({ isApolloBoard: true });
+ await waitForPromises();
+ });
+
+ it('renders a BoardColumn component per list', () => {
+ expect(wrapper.findAllComponents(BoardColumn)).toHaveLength(mockLists.length);
+ });
+
+ it('renders BoardContentSidebar', () => {
+ expect(wrapper.findComponent(BoardContentSidebar).exists()).toBe(true);
+ });
+ });
});
diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js
index 1a07b9f0b78..6f17e4193a3 100644
--- a/spec/frontend/boards/components/board_filtered_search_spec.js
+++ b/spec/frontend/boards/components/board_filtered_search_spec.js
@@ -3,7 +3,19 @@ import Vue from 'vue';
import Vuex from 'vuex';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue';
import * as urlUtility from '~/lib/utils/url_utility';
-import { __ } from '~/locale';
+import {
+ TOKEN_TITLE_AUTHOR,
+ TOKEN_TITLE_LABEL,
+ TOKEN_TYPE_ASSIGNEE,
+ TOKEN_TYPE_AUTHOR,
+ TOKEN_TYPE_HEALTH,
+ TOKEN_TYPE_ITERATION,
+ TOKEN_TYPE_LABEL,
+ TOKEN_TYPE_MILESTONE,
+ TOKEN_TYPE_RELEASE,
+ TOKEN_TYPE_TYPE,
+ TOKEN_TYPE_WEIGHT,
+} from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBarRoot from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
@@ -17,7 +29,7 @@ describe('BoardFilteredSearch', () => {
const tokens = [
{
icon: 'labels',
- title: __('Label'),
+ title: TOKEN_TITLE_LABEL,
type: 'label',
operators: [
{ value: '=', description: 'is' },
@@ -30,7 +42,7 @@ describe('BoardFilteredSearch', () => {
},
{
icon: 'pencil',
- title: __('Author'),
+ title: TOKEN_TITLE_AUTHOR,
type: 'author',
operators: [
{ value: '=', description: 'is' },
@@ -117,16 +129,16 @@ describe('BoardFilteredSearch', () => {
it('sets the url params to the correct results', async () => {
const mockFilters = [
- { type: 'author', value: { data: 'root', operator: '=' } },
- { type: 'assignee', value: { data: 'root', operator: '=' } },
- { type: 'label', value: { data: 'label', operator: '=' } },
- { type: 'label', value: { data: 'label&2', operator: '=' } },
- { type: 'milestone', value: { data: 'New Milestone', operator: '=' } },
- { type: 'type', value: { data: 'INCIDENT', operator: '=' } },
- { type: 'weight', value: { data: '2', operator: '=' } },
- { type: 'iteration', value: { data: 'Any&3', operator: '=' } },
- { type: 'release', value: { data: 'v1.0.0', operator: '=' } },
- { type: 'health_status', value: { data: 'onTrack', operator: '=' } },
+ { type: TOKEN_TYPE_AUTHOR, value: { data: 'root', operator: '=' } },
+ { type: TOKEN_TYPE_ASSIGNEE, value: { data: 'root', operator: '=' } },
+ { type: TOKEN_TYPE_LABEL, value: { data: 'label', operator: '=' } },
+ { type: TOKEN_TYPE_LABEL, value: { data: 'label&2', operator: '=' } },
+ { type: TOKEN_TYPE_MILESTONE, value: { data: 'New Milestone', operator: '=' } },
+ { type: TOKEN_TYPE_TYPE, value: { data: 'INCIDENT', operator: '=' } },
+ { type: TOKEN_TYPE_WEIGHT, value: { data: '2', operator: '=' } },
+ { type: TOKEN_TYPE_ITERATION, value: { data: 'Any&3', operator: '=' } },
+ { type: TOKEN_TYPE_RELEASE, value: { data: 'v1.0.0', operator: '=' } },
+ { type: TOKEN_TYPE_HEALTH, value: { data: 'onTrack', operator: '=' } },
];
jest.spyOn(urlUtility, 'updateHistory');
findFilteredSearch().vm.$emit('onFilter', mockFilters);
@@ -170,9 +182,9 @@ describe('BoardFilteredSearch', () => {
it('passes the correct props to FilterSearchBar', () => {
expect(findFilteredSearch().props('initialFilterValue')).toEqual([
- { type: 'author', value: { data: 'root', operator: '=' } },
- { type: 'label', value: { data: 'label', operator: '=' } },
- { type: 'health_status', value: { data: 'Any', operator: '=' } },
+ { type: TOKEN_TYPE_AUTHOR, value: { data: 'root', operator: '=' } },
+ { type: TOKEN_TYPE_LABEL, value: { data: 'label', operator: '=' } },
+ { type: TOKEN_TYPE_HEALTH, value: { data: 'Any', operator: '=' } },
]);
});
});
diff --git a/spec/frontend/boards/components/board_list_header_spec.js b/spec/frontend/boards/components/board_list_header_spec.js
index 50901f3fe84..4633612891c 100644
--- a/spec/frontend/boards/components/board_list_header_spec.js
+++ b/spec/frontend/boards/components/board_list_header_spec.js
@@ -59,7 +59,6 @@ describe('Board List Header Component', () => {
store = new Vuex.Store({
state: {},
actions: { updateList: updateListSpy, toggleListCollapsed: toggleListCollapsedSpy },
- getters: { isEpicBoard: () => false },
});
fakeApollo = createMockApollo([[listQuery, listQueryHandler]]);
@@ -76,6 +75,7 @@ describe('Board List Header Component', () => {
boardId,
weightFeatureAvailable: false,
currentUserId,
+ isEpicBoard: false,
},
}),
);
diff --git a/spec/frontend/boards/components/board_settings_sidebar_spec.js b/spec/frontend/boards/components/board_settings_sidebar_spec.js
index 4171a6236de..7d602042685 100644
--- a/spec/frontend/boards/components/board_settings_sidebar_spec.js
+++ b/spec/frontend/boards/components/board_settings_sidebar_spec.js
@@ -45,6 +45,7 @@ describe('BoardSettingsSidebar', () => {
provide: {
canAdminList,
scopedLabelsAvailable: false,
+ isIssueBoard: true,
},
directives: {
GlModal: createMockDirective(),
diff --git a/spec/frontend/boards/components/board_top_bar_spec.js b/spec/frontend/boards/components/board_top_bar_spec.js
index 997768a0cc7..08b5042f70f 100644
--- a/spec/frontend/boards/components/board_top_bar_spec.js
+++ b/spec/frontend/boards/components/board_top_bar_spec.js
@@ -15,18 +15,14 @@ describe('BoardTopBar', () => {
Vue.use(Vuex);
- const createStore = ({ mockGetters = {} } = {}) => {
+ const createStore = () => {
return new Vuex.Store({
state: {},
- getters: {
- isEpicBoard: () => false,
- ...mockGetters,
- },
});
};
- const createComponent = ({ provide = {}, mockGetters = {} } = {}) => {
- const store = createStore({ mockGetters });
+ const createComponent = ({ provide = {} } = {}) => {
+ const store = createStore();
wrapper = shallowMount(BoardTopBar, {
store,
provide: {
@@ -36,6 +32,7 @@ describe('BoardTopBar', () => {
fullPath: 'gitlab-org',
boardType: 'group',
releasesFetchPath: '/releases',
+ isIssueBoard: true,
...provide,
},
stubs: { IssueBoardFilteredSearch },
diff --git a/spec/frontend/boards/mock_data.js b/spec/frontend/boards/mock_data.js
index dc1f3246be0..3c26fa97338 100644
--- a/spec/frontend/boards/mock_data.js
+++ b/spec/frontend/boards/mock_data.js
@@ -1,7 +1,22 @@
import { GlFilteredSearchToken } from '@gitlab/ui';
import { keyBy } from 'lodash';
import { ListType } from '~/boards/constants';
-import { __ } from '~/locale';
+import {
+ OPERATOR_IS_AND_IS_NOT,
+ OPERATOR_IS_ONLY,
+ TOKEN_TITLE_ASSIGNEE,
+ TOKEN_TITLE_AUTHOR,
+ TOKEN_TITLE_LABEL,
+ TOKEN_TITLE_MILESTONE,
+ TOKEN_TITLE_RELEASE,
+ TOKEN_TITLE_TYPE,
+ TOKEN_TYPE_ASSIGNEE,
+ TOKEN_TYPE_AUTHOR,
+ TOKEN_TYPE_LABEL,
+ TOKEN_TYPE_MILESTONE,
+ TOKEN_TYPE_RELEASE,
+ TOKEN_TYPE_TYPE,
+} from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
@@ -433,8 +448,11 @@ export const mockList = {
label: null,
assignee: null,
milestone: null,
+ iteration: null,
loading: false,
issuesCount: 1,
+ maxIssueCount: 0,
+ __typename: 'BoardList',
};
export const mockLabelList = {
@@ -449,11 +467,15 @@ export const mockLabelList = {
color: '#F0AD4E',
textColor: '#FFFFFF',
description: null,
+ descriptionHtml: null,
},
assignee: null,
milestone: null,
+ iteration: null,
loading: false,
issuesCount: 0,
+ maxIssueCount: 0,
+ __typename: 'BoardList',
};
export const mockMilestoneList = {
@@ -725,7 +747,7 @@ export const mockConfidentialToken = {
title: 'Confidential',
unique: true,
token: GlFilteredSearchToken,
- operators: [{ value: '=', description: 'is' }],
+ operators: OPERATOR_IS_ONLY,
options: [
{ icon: 'eye-slash', value: 'yes', title: 'Yes' },
{ icon: 'eye', value: 'no', title: 'No' },
@@ -735,12 +757,9 @@ export const mockConfidentialToken = {
export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedIn) => [
{
icon: 'user',
- title: __('Assignee'),
- type: 'assignee',
- operators: [
- { value: '=', description: 'is' },
- { value: '!=', description: 'is not' },
- ],
+ title: TOKEN_TITLE_ASSIGNEE,
+ type: TOKEN_TYPE_ASSIGNEE,
+ operators: OPERATOR_IS_AND_IS_NOT,
token: AuthorToken,
unique: true,
fetchAuthors,
@@ -748,12 +767,9 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
},
{
icon: 'pencil',
- title: __('Author'),
- type: 'author',
- operators: [
- { value: '=', description: 'is' },
- { value: '!=', description: 'is not' },
- ],
+ title: TOKEN_TITLE_AUTHOR,
+ type: TOKEN_TYPE_AUTHOR,
+ operators: OPERATOR_IS_AND_IS_NOT,
symbol: '@',
token: AuthorToken,
unique: true,
@@ -762,12 +778,9 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
},
{
icon: 'labels',
- title: __('Label'),
- type: 'label',
- operators: [
- { value: '=', description: 'is' },
- { value: '!=', description: 'is not' },
- ],
+ title: TOKEN_TITLE_LABEL,
+ type: TOKEN_TYPE_LABEL,
+ operators: OPERATOR_IS_AND_IS_NOT,
token: LabelToken,
unique: false,
symbol: '~',
@@ -776,9 +789,9 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
...(isSignedIn ? [mockEmojiToken, mockConfidentialToken] : []),
{
icon: 'clock',
- title: __('Milestone'),
+ title: TOKEN_TITLE_MILESTONE,
symbol: '%',
- type: 'milestone',
+ type: TOKEN_TYPE_MILESTONE,
shouldSkipSort: true,
token: MilestoneToken,
unique: true,
@@ -786,8 +799,8 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
},
{
icon: 'issues',
- title: __('Type'),
- type: 'type',
+ title: TOKEN_TITLE_TYPE,
+ type: TOKEN_TYPE_TYPE,
token: GlFilteredSearchToken,
unique: true,
options: [
@@ -796,8 +809,8 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
],
},
{
- type: 'release',
- title: __('Release'),
+ type: TOKEN_TYPE_RELEASE,
+ title: TOKEN_TITLE_RELEASE,
icon: 'rocket',
token: ReleaseToken,
fetchReleases: expect.any(Function),
@@ -844,6 +857,22 @@ export const mockGroupLabelsResponse = {
},
};
+export const boardListsQueryResponse = {
+ data: {
+ group: {
+ id: 'gid://gitlab/Group/1',
+ board: {
+ id: 'gid://gitlab/Board/1',
+ hideBacklogList: false,
+ lists: {
+ nodes: mockLists,
+ },
+ },
+ __typename: 'Group',
+ },
+ },
+};
+
export const boardListQueryResponse = (issuesCount = 20) => ({
data: {
boardList: {
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js
index 78859525a63..b3e90e34161 100644
--- a/spec/frontend/boards/stores/actions_spec.js
+++ b/spec/frontend/boards/stores/actions_spec.js
@@ -8,7 +8,6 @@ import {
ListType,
issuableTypes,
BoardType,
- listsQuery,
DraggableItemTypes,
} from 'ee_else_ce/boards/constants';
import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql';
@@ -21,7 +20,7 @@ import {
getMoveData,
updateListPosition,
} from 'ee_else_ce/boards/boards_util';
-import { gqlClient } from '~/boards/graphql';
+import { defaultClient as gqlClient } from '~/graphql_shared/issuable_client';
import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql';
import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql';
import actions from '~/boards/stores/actions';
@@ -318,21 +317,18 @@ describe('fetchLists', () => {
};
const variables = {
- query: listsQuery[issuableType].query,
- variables: {
- fullPath: 'gitlab-org',
- boardId: fullBoardId,
- filters: {},
- isGroup,
- isProject,
- },
+ fullPath: 'gitlab-org',
+ boardId: fullBoardId,
+ filters: {},
+ isGroup,
+ isProject,
};
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
await actions.fetchLists({ commit, state, dispatch });
- expect(gqlClient.query).toHaveBeenCalledWith(variables);
+ expect(gqlClient.query).toHaveBeenCalledWith(expect.objectContaining({ variables }));
},
);
});