diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-05 18:10:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-05 18:10:05 +0300 |
commit | cf05fd7f3956f0b1a17caf313e89bb7b3315d947 (patch) | |
tree | 8d847ad538180a03a6a25e7ee81605d2f86358d5 /spec/frontend/boards/components | |
parent | 023e050d82ed11d9060ce5bdaec99c3871b98164 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/components')
-rw-r--r-- | spec/frontend/boards/components/board_card_spec.js | 100 |
1 files changed, 46 insertions, 54 deletions
diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js index e95cb17ee84..ceafa6ead94 100644 --- a/spec/frontend/boards/components/board_card_spec.js +++ b/spec/frontend/boards/components/board_card_spec.js @@ -15,7 +15,7 @@ describe('Board card', () => { const localVue = createLocalVue(); localVue.use(Vuex); - const createStore = ({ initialState = {}, isSwimlanesOn = false } = {}) => { + const createStore = ({ initialState = {} } = {}) => { mockActions = { toggleBoardItem: jest.fn(), toggleBoardItemMultiSelection: jest.fn(), @@ -30,7 +30,6 @@ describe('Board card', () => { }, actions: mockActions, getters: { - isSwimlanesOn: () => isSwimlanesOn, isEpicBoard: () => false, }, }); @@ -90,72 +89,65 @@ describe('Board card', () => { }); }); - describe.each` - isSwimlanesOn - ${true} | ${false} - `('when isSwimlanesOn is $isSwimlanesOn', ({ isSwimlanesOn }) => { - it('should not highlight the card by default', async () => { - createStore({ isSwimlanesOn }); - mountComponent(); + it('should not highlight the card by default', async () => { + createStore(); + mountComponent(); + + expect(wrapper.classes()).not.toContain('is-active'); + expect(wrapper.classes()).not.toContain('multi-select'); + }); - expect(wrapper.classes()).not.toContain('is-active'); - expect(wrapper.classes()).not.toContain('multi-select'); + it('should highlight the card with a correct style when selected', async () => { + createStore({ + initialState: { + activeId: mockIssue.id, + }, }); + mountComponent(); - it('should highlight the card with a correct style when selected', async () => { - createStore({ - initialState: { - activeId: mockIssue.id, - }, - isSwimlanesOn, - }); - mountComponent(); + expect(wrapper.classes()).toContain('is-active'); + expect(wrapper.classes()).not.toContain('multi-select'); + }); - expect(wrapper.classes()).toContain('is-active'); - expect(wrapper.classes()).not.toContain('multi-select'); + it('should highlight the card with a correct style when multi-selected', async () => { + createStore({ + initialState: { + activeId: inactiveId, + selectedBoardItems: [mockIssue], + }, }); + mountComponent(); - it('should highlight the card with a correct style when multi-selected', async () => { - createStore({ - initialState: { - activeId: inactiveId, - selectedBoardItems: [mockIssue], - }, - isSwimlanesOn, - }); - mountComponent(); + expect(wrapper.classes()).toContain('multi-select'); + expect(wrapper.classes()).not.toContain('is-active'); + }); - expect(wrapper.classes()).toContain('multi-select'); - expect(wrapper.classes()).not.toContain('is-active'); + describe('when mouseup event is called on the card', () => { + beforeEach(() => { + createStore(); + mountComponent(); }); - describe('when mouseup event is called on the card', () => { - beforeEach(() => { - createStore({ isSwimlanesOn }); - mountComponent(); - }); - - describe('when not using multi-select', () => { - it('should call vuex action "toggleBoardItem" with correct parameters', async () => { - await selectCard(); + describe('when not using multi-select', () => { + it('should call vuex action "toggleBoardItem" with correct parameters', async () => { + await selectCard(); - expect(mockActions.toggleBoardItem).toHaveBeenCalledTimes(1); - expect(mockActions.toggleBoardItem).toHaveBeenCalledWith(expect.any(Object), { - boardItem: mockIssue, - }); + expect(mockActions.toggleBoardItem).toHaveBeenCalledTimes(1); + expect(mockActions.toggleBoardItem).toHaveBeenCalledWith(expect.any(Object), { + boardItem: mockIssue, }); }); + }); - describe('when using multi-select', () => { - it('should call vuex action "multiSelectBoardItem" with correct parameters', async () => { - await multiSelectCard(); + describe('when using multi-select', () => { + it('should call vuex action "multiSelectBoardItem" with correct parameters', async () => { + await multiSelectCard(); - expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledTimes(1); - expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledWith( - expect.any(Object), - mockIssue, - ); - }); + expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledTimes(1); + expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledWith( + expect.any(Object), + mockIssue, + ); }); }); }); |