diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-09 12:07:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-09 12:07:42 +0300 |
commit | 44d4b37b52c678a0b6a3c18c8c87319553ce84a3 (patch) | |
tree | d09bcd1aad83fe5a4d596b32356bb260eb54aca2 /spec/frontend/boards | |
parent | 7b29a4f84e25ab3eb610c1595bad38478784f5ff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards')
8 files changed, 147 insertions, 109 deletions
diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js index 3b77c999a9e..d05e057095d 100644 --- a/spec/frontend/boards/board_card_inner_spec.js +++ b/spec/frontend/boards/board_card_inner_spec.js @@ -52,7 +52,7 @@ describe('Board card component', () => { const performSearchMock = jest.fn(); - const createStore = ({ isEpicBoard = false, isProjectBoard = false } = {}) => { + const createStore = ({ isProjectBoard = false } = {}) => { store = new Vuex.Store({ ...defaultStore, actions: { @@ -65,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: { @@ -97,6 +96,7 @@ describe('Board card component', () => { provide: { rootPath: '/', scopedLabelsAvailable: false, + isEpicBoard, }, }); }; @@ -111,7 +111,7 @@ describe('Board card component', () => { }; createStore(); - createWrapper({ item: issue, list }); + createWrapper({ props: { item: issue, list } }); }); afterEach(() => { @@ -146,7 +146,7 @@ describe('Board card component', () => { }); 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); }); @@ -177,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, + }, }, }); @@ -188,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, + }, }, }); @@ -201,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, + }, }, }); }); @@ -216,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, + }, }, }); }); @@ -241,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); + }, }, }, }); @@ -294,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', + }, + ], + }, }, }); }); @@ -323,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', + }, + ], + }, }, }); }); @@ -364,9 +378,11 @@ describe('Board card component', () => { }); createWrapper({ - item: { - ...wrapper.props('item'), - assignees, + props: { + item: { + ...wrapper.props('item'), + assignees, + }, }, }); }); @@ -390,9 +406,11 @@ describe('Board card component', () => { })), ]; createWrapper({ - item: { - ...wrapper.props('item'), - assignees, + props: { + item: { + ...wrapper.props('item'), + assignees, + }, }, }); @@ -405,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', () => { @@ -417,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(); @@ -429,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, }); }); @@ -480,9 +500,11 @@ describe('Board card component', () => { describe('loading', () => { it('renders loading icon', async () => { createWrapper({ - item: { - ...issue, - isLoading: true, + props: { + item: { + ...issue, + isLoading: true, + }, }, }); @@ -504,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); @@ -535,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'); @@ -556,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); @@ -572,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(); 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/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_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 bf491029c41..b2138700602 100644 --- a/spec/frontend/boards/components/board_content_spec.js +++ b/spec/frontend/boards/components/board_content_spec.js @@ -47,6 +47,8 @@ describe('BoardContent', () => { canAdminList = true, isApolloBoard = false, issuableType = 'issue', + isIssueBoard = true, + isEpicBoard = false, boardListQueryHandler = jest.fn().mockResolvedValue(boardListsQueryResponse), } = {}) => { fakeApollo = createMockApollo([[boardListsQuery, boardListQueryHandler]]); @@ -67,6 +69,8 @@ describe('BoardContent', () => { boardType: 'group', fullPath: 'gitlab-org/gitlab', issuableType, + isIssueBoard, + isEpicBoard, isApolloBoard, }, store, @@ -133,7 +137,7 @@ describe('BoardContent', () => { describe('when issuableType is not issue', () => { beforeEach(() => { - createComponent({ issuableType: 'foo' }); + createComponent({ issuableType: 'foo', isIssueBoard: false }); }); it('does not render BoardContentSidebar', () => { 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 }, |