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.js13
-rw-r--r--spec/frontend/boards/components/__snapshots__/board_blocked_icon_spec.js.snap30
-rw-r--r--spec/frontend/boards/components/board_blocked_icon_spec.js264
-rw-r--r--spec/frontend/boards/components/board_filtered_search_spec.js8
-rw-r--r--spec/frontend/boards/stores/actions_spec.js254
5 files changed, 139 insertions, 430 deletions
diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js
index 2c3ec69f9ae..3ebc51c4bcb 100644
--- a/spec/frontend/boards/board_card_inner_spec.js
+++ b/spec/frontend/boards/board_card_inner_spec.js
@@ -5,7 +5,7 @@ import { nextTick } from 'vue';
import setWindowLocation from 'helpers/set_window_location_helper';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { mountExtended } from 'helpers/vue_test_utils_helper';
-import BoardBlockedIcon from '~/boards/components/board_blocked_icon.vue';
+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';
@@ -39,7 +39,7 @@ describe('Board card component', () => {
let list;
let store;
- const findBoardBlockedIcon = () => wrapper.findComponent(BoardBlockedIcon);
+ const findIssuableBlockedIcon = () => wrapper.findComponent(IssuableBlockedIcon);
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findEpicCountablesTotalTooltip = () => wrapper.findComponent(GlTooltip);
const findEpicCountables = () => wrapper.findByTestId('epic-countables');
@@ -189,7 +189,7 @@ describe('Board card component', () => {
},
});
- expect(findBoardBlockedIcon().exists()).toBe(true);
+ expect(findIssuableBlockedIcon().exists()).toBe(true);
});
it('does not show blocked icon if issue is not blocked', () => {
@@ -200,7 +200,7 @@ describe('Board card component', () => {
},
});
- expect(findBoardBlockedIcon().exists()).toBe(false);
+ expect(findIssuableBlockedIcon().exists()).toBe(false);
});
});
@@ -595,5 +595,10 @@ 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/components/__snapshots__/board_blocked_icon_spec.js.snap b/spec/frontend/boards/components/__snapshots__/board_blocked_icon_spec.js.snap
deleted file mode 100644
index 34e4f996ff0..00000000000
--- a/spec/frontend/boards/components/__snapshots__/board_blocked_icon_spec.js.snap
+++ /dev/null
@@ -1,30 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`BoardBlockedIcon on mouseenter on blocked icon with more than three blocking issues matches the snapshot 1`] = `
-"<div class=\\"gl-display-inline\\"><svg data-testid=\\"issue-blocked-icon\\" role=\\"img\\" aria-hidden=\\"true\\" class=\\"issue-blocked-icon gl-mr-2 gl-cursor-pointer gl-text-red-500 gl-icon s16\\" id=\\"blocked-icon-uniqueId\\">
- <use href=\\"#issue-block\\"></use>
- </svg>
- <div class=\\"gl-popover\\">
- <ul class=\\"gl-list-style-none gl-p-0\\">
- <li><a href=\\"http://gdk.test:3000/gitlab-org/my-project-1/-/issues/6\\" class=\\"gl-link gl-text-blue-500! gl-font-sm\\">my-project-1#6</a>
- <p data-testid=\\"issuable-title\\" class=\\"gl-mb-3 gl-display-block!\\">
- blocking issue title 1
- </p>
- </li>
- <li><a href=\\"http://gdk.test:3000/gitlab-org/my-project-1/-/issues/5\\" class=\\"gl-link gl-text-blue-500! gl-font-sm\\">my-project-1#5</a>
- <p data-testid=\\"issuable-title\\" class=\\"gl-mb-3 gl-display-block!\\">
- blocking issue title 2 + blocking issue title 2 + blocking issue title 2 + bloc…
- </p>
- </li>
- <li><a href=\\"http://gdk.test:3000/gitlab-org/my-project-1/-/issues/4\\" class=\\"gl-link gl-text-blue-500! gl-font-sm\\">my-project-1#4</a>
- <p data-testid=\\"issuable-title\\" class=\\"gl-mb-3 gl-display-block!\\">
- blocking issue title 3
- </p>
- </li>
- </ul>
- <div class=\\"gl-mt-4\\">
- <p data-testid=\\"hidden-blocking-count\\" class=\\"gl-mb-3\\">+ 1 more issue</p> <a data-testid=\\"view-all-issues\\" href=\\"http://gdk.test:3000/gitlab-org/my-project-1/-/issues/0#related-issues\\" class=\\"gl-link gl-text-blue-500! gl-font-sm\\">View all blocking issues</a>
- </div><span data-testid=\\"popover-title\\">Blocked by 4 issues</span>
- </div>
-</div>"
-`;
diff --git a/spec/frontend/boards/components/board_blocked_icon_spec.js b/spec/frontend/boards/components/board_blocked_icon_spec.js
deleted file mode 100644
index ffdc0a7cecc..00000000000
--- a/spec/frontend/boards/components/board_blocked_icon_spec.js
+++ /dev/null
@@ -1,264 +0,0 @@
-import { GlIcon, GlLink, GlPopover, GlLoadingIcon } from '@gitlab/ui';
-import { shallowMount, mount } from '@vue/test-utils';
-import Vue, { nextTick } from 'vue';
-import VueApollo from 'vue-apollo';
-import createMockApollo from 'helpers/mock_apollo_helper';
-import { extendedWrapper } from 'helpers/vue_test_utils_helper';
-import waitForPromises from 'helpers/wait_for_promises';
-import BoardBlockedIcon from '~/boards/components/board_blocked_icon.vue';
-import { blockingIssuablesQueries, issuableTypes } from '~/boards/constants';
-import { truncate } from '~/lib/utils/text_utility';
-import {
- mockIssue,
- mockEpic,
- mockBlockingIssue1,
- mockBlockingIssue2,
- mockBlockingEpic1,
- mockBlockingIssuablesResponse1,
- mockBlockingIssuablesResponse2,
- mockBlockingIssuablesResponse3,
- mockBlockedIssue1,
- mockBlockedIssue2,
- mockBlockedEpic1,
- mockBlockingEpicIssuablesResponse1,
-} from '../mock_data';
-
-describe('BoardBlockedIcon', () => {
- let wrapper;
- let mockApollo;
-
- const findGlIcon = () => wrapper.findComponent(GlIcon);
- const findGlPopover = () => wrapper.findComponent(GlPopover);
- const findGlLink = () => wrapper.findComponent(GlLink);
- const findPopoverTitle = () => wrapper.findByTestId('popover-title');
- const findIssuableTitle = () => wrapper.findByTestId('issuable-title');
- const findHiddenBlockingCount = () => wrapper.findByTestId('hidden-blocking-count');
- const findViewAllIssuableLink = () => wrapper.findByTestId('view-all-issues');
-
- const waitForApollo = async () => {
- jest.runOnlyPendingTimers();
- await waitForPromises();
- };
-
- const mouseenter = async () => {
- findGlIcon().vm.$emit('mouseenter');
-
- await nextTick();
- await waitForApollo();
- };
-
- afterEach(() => {
- wrapper.destroy();
- wrapper = null;
- });
-
- const createWrapperWithApollo = ({
- item = mockBlockedIssue1,
- blockingIssuablesSpy = jest.fn().mockResolvedValue(mockBlockingIssuablesResponse1),
- issuableItem = mockIssue,
- issuableType = issuableTypes.issue,
- } = {}) => {
- mockApollo = createMockApollo([
- [blockingIssuablesQueries[issuableType].query, blockingIssuablesSpy],
- ]);
-
- Vue.use(VueApollo);
- wrapper = extendedWrapper(
- mount(BoardBlockedIcon, {
- apolloProvider: mockApollo,
- propsData: {
- item: {
- ...issuableItem,
- ...item,
- },
- uniqueId: 'uniqueId',
- issuableType,
- },
- attachTo: document.body,
- }),
- );
- };
-
- const createWrapper = ({
- item = {},
- queries = {},
- data = {},
- loading = false,
- mockIssuable = mockIssue,
- issuableType = issuableTypes.issue,
- } = {}) => {
- wrapper = extendedWrapper(
- shallowMount(BoardBlockedIcon, {
- propsData: {
- item: {
- ...mockIssuable,
- ...item,
- },
- uniqueId: 'uniqueid',
- issuableType,
- },
- data() {
- return {
- ...data,
- };
- },
- mocks: {
- $apollo: {
- queries: {
- blockingIssuables: { loading },
- ...queries,
- },
- },
- },
- stubs: {
- GlPopover,
- },
- attachTo: document.body,
- }),
- );
- };
-
- it.each`
- mockIssuable | issuableType | expectedIcon
- ${mockIssue} | ${issuableTypes.issue} | ${'issue-block'}
- ${mockEpic} | ${issuableTypes.epic} | ${'entity-blocked'}
- `(
- 'should render blocked icon for $issuableType',
- ({ mockIssuable, issuableType, expectedIcon }) => {
- createWrapper({
- mockIssuable,
- issuableType,
- });
-
- expect(findGlIcon().exists()).toBe(true);
- const icon = findGlIcon();
- expect(icon.exists()).toBe(true);
- expect(icon.props('name')).toBe(expectedIcon);
- },
- );
-
- it('should display a loading spinner while loading', () => {
- createWrapper({ loading: true });
-
- expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
- });
-
- it('should not query for blocking issuables by default', async () => {
- createWrapperWithApollo();
-
- expect(findGlPopover().text()).not.toContain(mockBlockingIssue1.title);
- });
-
- describe('on mouseenter on blocked icon', () => {
- it.each`
- item | issuableType | mockBlockingIssuable | issuableItem | blockingIssuablesSpy
- ${mockBlockedIssue1} | ${issuableTypes.issue} | ${mockBlockingIssue1} | ${mockIssue} | ${jest.fn().mockResolvedValue(mockBlockingIssuablesResponse1)}
- ${mockBlockedEpic1} | ${issuableTypes.epic} | ${mockBlockingEpic1} | ${mockEpic} | ${jest.fn().mockResolvedValue(mockBlockingEpicIssuablesResponse1)}
- `(
- 'should query for blocking issuables and render the result for $issuableType',
- async ({ item, issuableType, issuableItem, mockBlockingIssuable, blockingIssuablesSpy }) => {
- createWrapperWithApollo({
- item,
- issuableType,
- issuableItem,
- blockingIssuablesSpy,
- });
-
- expect(findGlPopover().text()).not.toContain(mockBlockingIssuable.title);
-
- await mouseenter();
-
- expect(findGlPopover().exists()).toBe(true);
- expect(findIssuableTitle().text()).toContain(mockBlockingIssuable.title);
- expect(wrapper.vm.skip).toBe(true);
- },
- );
-
- it('should emit "blocking-issuables-error" event on query error', async () => {
- const mockError = new Error('mayday');
- createWrapperWithApollo({ blockingIssuablesSpy: jest.fn().mockRejectedValue(mockError) });
-
- await mouseenter();
-
- const [
- [
- {
- message,
- error: { networkError },
- },
- ],
- ] = wrapper.emitted('blocking-issuables-error');
- expect(message).toBe('Failed to fetch blocking issues');
- expect(networkError).toBe(mockError);
- });
-
- describe('with a single blocking issue', () => {
- beforeEach(async () => {
- createWrapperWithApollo();
-
- await mouseenter();
- });
-
- it('should render a title of the issuable', async () => {
- expect(findIssuableTitle().text()).toBe(mockBlockingIssue1.title);
- });
-
- it('should render issuable reference and link to the issuable', async () => {
- const formattedRef = mockBlockingIssue1.reference.split('/')[1];
-
- expect(findGlLink().text()).toBe(formattedRef);
- expect(findGlLink().attributes('href')).toBe(mockBlockingIssue1.webUrl);
- });
-
- it('should render popover title with correct blocking issuable count', async () => {
- expect(findPopoverTitle().text()).toBe('Blocked by 1 issue');
- });
- });
-
- describe('when issue has a long title', () => {
- it('should render a truncated title', async () => {
- createWrapperWithApollo({
- blockingIssuablesSpy: jest.fn().mockResolvedValue(mockBlockingIssuablesResponse2),
- });
-
- await mouseenter();
-
- const truncatedTitle = truncate(
- mockBlockingIssue2.title,
- wrapper.vm.$options.textTruncateWidth,
- );
- expect(findIssuableTitle().text()).toBe(truncatedTitle);
- });
- });
-
- describe('with more than three blocking issues', () => {
- beforeEach(async () => {
- createWrapperWithApollo({
- item: mockBlockedIssue2,
- blockingIssuablesSpy: jest.fn().mockResolvedValue(mockBlockingIssuablesResponse3),
- });
-
- await mouseenter();
- });
-
- it('matches the snapshot', () => {
- expect(wrapper.html()).toMatchSnapshot();
- });
-
- it('should render popover title with correct blocking issuable count', async () => {
- expect(findPopoverTitle().text()).toBe('Blocked by 4 issues');
- });
-
- it('should render the number of hidden blocking issuables', () => {
- expect(findHiddenBlockingCount().text()).toBe('+ 1 more issue');
- });
-
- it('should link to the blocked issue page at the related issue anchor', async () => {
- expect(findViewAllIssuableLink().text()).toBe('View all blocking issues');
- expect(findViewAllIssuableLink().attributes('href')).toBe(
- `${mockBlockedIssue2.webUrl}#related-issues`,
- );
- });
- });
- });
-});
diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js
index 731578e15a3..1a07b9f0b78 100644
--- a/spec/frontend/boards/components/board_filtered_search_spec.js
+++ b/spec/frontend/boards/components/board_filtered_search_spec.js
@@ -126,6 +126,7 @@ describe('BoardFilteredSearch', () => {
{ 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: '=' } },
];
jest.spyOn(urlUtility, 'updateHistory');
findFilteredSearch().vm.$emit('onFilter', mockFilters);
@@ -134,7 +135,7 @@ describe('BoardFilteredSearch', () => {
title: '',
replace: true,
url:
- 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label%262&assignee_username=root&milestone_title=New%20Milestone&iteration_id=Any&iteration_cadence_id=3&types=INCIDENT&weight=2&release_tag=v1.0.0',
+ 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label%262&assignee_username=root&milestone_title=New%20Milestone&iteration_id=Any&iteration_cadence_id=3&types=INCIDENT&weight=2&release_tag=v1.0.0&health_status=onTrack',
});
});
@@ -160,7 +161,9 @@ describe('BoardFilteredSearch', () => {
describe('when url params are already set', () => {
beforeEach(() => {
- createComponent({ initialFilterParams: { authorUsername: 'root', labelName: ['label'] } });
+ createComponent({
+ initialFilterParams: { authorUsername: 'root', labelName: ['label'], healthStatus: 'Any' },
+ });
jest.spyOn(store, 'dispatch');
});
@@ -169,6 +172,7 @@ describe('BoardFilteredSearch', () => {
expect(findFilteredSearch().props('initialFilterValue')).toEqual([
{ type: 'author', value: { data: 'root', operator: '=' } },
{ type: 'label', value: { data: 'label', operator: '=' } },
+ { type: 'health_status', value: { data: 'Any', operator: '=' } },
]);
});
});
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js
index e919300228a..78859525a63 100644
--- a/spec/frontend/boards/stores/actions_spec.js
+++ b/spec/frontend/boards/stores/actions_spec.js
@@ -1047,60 +1047,58 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
let undoMutations;
describe('when re-ordering card', () => {
- beforeEach(
- ({
- itemId = 123,
- fromListId = 'gid://gitlab/List/1',
- toListId = 'gid://gitlab/List/1',
- originalIssue = { foo: 'bar' },
- originalIndex = 0,
- moveBeforeId = undefined,
- moveAfterId = undefined,
- allItemsLoadedInList = true,
- listPosition = undefined,
- } = {}) => {
- state = {
- boardLists: {
- [toListId]: { listType: ListType.backlog },
- [fromListId]: { listType: ListType.backlog },
- },
- boardItems: { [itemId]: originalIssue },
- boardItemsByListId: { [fromListId]: [123] },
- };
- params = {
- itemId,
- fromListId,
- toListId,
- moveBeforeId,
- moveAfterId,
- listPosition,
- allItemsLoadedInList,
- };
- moveMutations = [
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: {
- itemId,
- listId: toListId,
- moveBeforeId,
- moveAfterId,
- listPosition,
- allItemsLoadedInList,
- atIndex: originalIndex,
- },
- },
- ];
- undoMutations = [
- { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: fromListId, atIndex: originalIndex },
+ beforeEach(() => {
+ const itemId = 123;
+ const fromListId = 'gid://gitlab/List/1';
+ const toListId = 'gid://gitlab/List/1';
+ const originalIssue = { foo: 'bar' };
+ const originalIndex = 0;
+ const moveBeforeId = undefined;
+ const moveAfterId = undefined;
+ const allItemsLoadedInList = true;
+ const listPosition = undefined;
+
+ state = {
+ boardLists: {
+ [toListId]: { listType: ListType.backlog },
+ [fromListId]: { listType: ListType.backlog },
+ },
+ boardItems: { [itemId]: originalIssue },
+ boardItemsByListId: { [fromListId]: [123] },
+ };
+ params = {
+ itemId,
+ fromListId,
+ toListId,
+ moveBeforeId,
+ moveAfterId,
+ listPosition,
+ allItemsLoadedInList,
+ };
+ moveMutations = [
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: {
+ itemId,
+ listId: toListId,
+ moveBeforeId,
+ moveAfterId,
+ listPosition,
+ allItemsLoadedInList,
+ atIndex: originalIndex,
},
- ];
- },
- );
+ },
+ ];
+ undoMutations = [
+ { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: fromListId, atIndex: originalIndex },
+ },
+ ];
+ });
it('moveIssueCard commits a correct set of actions', () => {
testAction({
@@ -1144,42 +1142,40 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
},
],
])('when %s', (_, { toListType, fromListType }) => {
- beforeEach(
- ({
- itemId = 123,
- fromListId = 'gid://gitlab/List/1',
- toListId = 'gid://gitlab/List/2',
- originalIssue = { foo: 'bar' },
- originalIndex = 0,
- moveBeforeId = undefined,
- moveAfterId = undefined,
- } = {}) => {
- state = {
- boardLists: {
- [fromListId]: { listType: fromListType },
- [toListId]: { listType: toListType },
- },
- boardItems: { [itemId]: originalIssue },
- boardItemsByListId: { [fromListId]: [123], [toListId]: [] },
- };
- params = { itemId, fromListId, toListId, moveBeforeId, moveAfterId };
- moveMutations = [
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: toListId, moveBeforeId, moveAfterId },
- },
- ];
- undoMutations = [
- { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: toListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: fromListId, atIndex: originalIndex },
- },
- ];
- },
- );
+ beforeEach(() => {
+ const itemId = 123;
+ const fromListId = 'gid://gitlab/List/1';
+ const toListId = 'gid://gitlab/List/2';
+ const originalIssue = { foo: 'bar' };
+ const originalIndex = 0;
+ const moveBeforeId = undefined;
+ const moveAfterId = undefined;
+
+ state = {
+ boardLists: {
+ [fromListId]: { listType: fromListType },
+ [toListId]: { listType: toListType },
+ },
+ boardItems: { [itemId]: originalIssue },
+ boardItemsByListId: { [fromListId]: [123], [toListId]: [] },
+ };
+ params = { itemId, fromListId, toListId, moveBeforeId, moveAfterId };
+ moveMutations = [
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: toListId, moveBeforeId, moveAfterId },
+ },
+ ];
+ undoMutations = [
+ { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: toListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: fromListId, atIndex: originalIndex },
+ },
+ ];
+ });
it('moveIssueCard commits a correct set of actions', () => {
testAction({
@@ -1216,47 +1212,45 @@ describe('moveIssueCard and undoMoveIssueCard', () => {
},
],
])('when %s', (_, { toListType, fromListType }) => {
- beforeEach(
- ({
- itemId = 123,
- fromListId = 'gid://gitlab/List/1',
- toListId = 'gid://gitlab/List/2',
- originalIssue = { foo: 'bar' },
- originalIndex = 0,
- moveBeforeId = undefined,
- moveAfterId = undefined,
- } = {}) => {
- state = {
- boardLists: {
- [fromListId]: { listType: fromListType },
- [toListId]: { listType: toListType },
- },
- boardItems: { [itemId]: originalIssue },
- boardItemsByListId: { [fromListId]: [123], [toListId]: [] },
- };
- params = { itemId, fromListId, toListId, moveBeforeId, moveAfterId };
- moveMutations = [
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: toListId, moveBeforeId, moveAfterId },
- },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: fromListId, atIndex: originalIndex },
- },
- ];
- undoMutations = [
- { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
- { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: toListId } },
- {
- type: types.ADD_BOARD_ITEM_TO_LIST,
- payload: { itemId, listId: fromListId, atIndex: originalIndex },
- },
- ];
- },
- );
+ beforeEach(() => {
+ const itemId = 123;
+ const fromListId = 'gid://gitlab/List/1';
+ const toListId = 'gid://gitlab/List/2';
+ const originalIssue = { foo: 'bar' };
+ const originalIndex = 0;
+ const moveBeforeId = undefined;
+ const moveAfterId = undefined;
+
+ state = {
+ boardLists: {
+ [fromListId]: { listType: fromListType },
+ [toListId]: { listType: toListType },
+ },
+ boardItems: { [itemId]: originalIssue },
+ boardItemsByListId: { [fromListId]: [123], [toListId]: [] },
+ };
+ params = { itemId, fromListId, toListId, moveBeforeId, moveAfterId };
+ moveMutations = [
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: toListId, moveBeforeId, moveAfterId },
+ },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: fromListId, atIndex: originalIndex },
+ },
+ ];
+ undoMutations = [
+ { type: types.UPDATE_BOARD_ITEM, payload: originalIssue },
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: fromListId } },
+ { type: types.REMOVE_BOARD_ITEM_FROM_LIST, payload: { itemId, listId: toListId } },
+ {
+ type: types.ADD_BOARD_ITEM_TO_LIST,
+ payload: { itemId, listId: fromListId, atIndex: originalIndex },
+ },
+ ];
+ });
it('moveIssueCard commits a correct set of actions', () => {
testAction({