Commit 021ca831 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'ss/rm-swimlanes-from-board-card' into 'master'

Rm isSwimlanesOn from board_card.vue

See merge request gitlab-org/gitlab!60450
parents 29582602 b1ce5132
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import BoardCardInner from './board_card_inner.vue'; import BoardCardInner from './board_card_inner.vue';
export default { export default {
...@@ -31,7 +31,6 @@ export default { ...@@ -31,7 +31,6 @@ export default {
}, },
computed: { computed: {
...mapState(['selectedBoardItems', 'activeId']), ...mapState(['selectedBoardItems', 'activeId']),
...mapGetters(['isSwimlanesOn']),
isActive() { isActive() {
return this.item.id === this.activeId; return this.item.id === this.activeId;
}, },
......
...@@ -15,7 +15,7 @@ describe('Board card', () => { ...@@ -15,7 +15,7 @@ describe('Board card', () => {
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
const createStore = ({ initialState = {}, isSwimlanesOn = false } = {}) => { const createStore = ({ initialState = {} } = {}) => {
mockActions = { mockActions = {
toggleBoardItem: jest.fn(), toggleBoardItem: jest.fn(),
toggleBoardItemMultiSelection: jest.fn(), toggleBoardItemMultiSelection: jest.fn(),
...@@ -30,7 +30,6 @@ describe('Board card', () => { ...@@ -30,7 +30,6 @@ describe('Board card', () => {
}, },
actions: mockActions, actions: mockActions,
getters: { getters: {
isSwimlanesOn: () => isSwimlanesOn,
isEpicBoard: () => false, isEpicBoard: () => false,
}, },
}); });
...@@ -90,72 +89,65 @@ describe('Board card', () => { ...@@ -90,72 +89,65 @@ describe('Board card', () => {
}); });
}); });
describe.each` it('should not highlight the card by default', async () => {
isSwimlanesOn createStore();
${true} | ${false} mountComponent();
`('when isSwimlanesOn is $isSwimlanesOn', ({ isSwimlanesOn }) => {
it('should not highlight the card by default', async () => { expect(wrapper.classes()).not.toContain('is-active');
createStore({ isSwimlanesOn }); expect(wrapper.classes()).not.toContain('multi-select');
mountComponent(); });
expect(wrapper.classes()).not.toContain('is-active'); it('should highlight the card with a correct style when selected', async () => {
expect(wrapper.classes()).not.toContain('multi-select'); createStore({
initialState: {
activeId: mockIssue.id,
},
}); });
mountComponent();
it('should highlight the card with a correct style when selected', async () => { expect(wrapper.classes()).toContain('is-active');
createStore({ expect(wrapper.classes()).not.toContain('multi-select');
initialState: { });
activeId: mockIssue.id,
},
isSwimlanesOn,
});
mountComponent();
expect(wrapper.classes()).toContain('is-active'); it('should highlight the card with a correct style when multi-selected', async () => {
expect(wrapper.classes()).not.toContain('multi-select'); createStore({
initialState: {
activeId: inactiveId,
selectedBoardItems: [mockIssue],
},
}); });
mountComponent();
it('should highlight the card with a correct style when multi-selected', async () => { expect(wrapper.classes()).toContain('multi-select');
createStore({ expect(wrapper.classes()).not.toContain('is-active');
initialState: { });
activeId: inactiveId,
selectedBoardItems: [mockIssue],
},
isSwimlanesOn,
});
mountComponent();
expect(wrapper.classes()).toContain('multi-select'); describe('when mouseup event is called on the card', () => {
expect(wrapper.classes()).not.toContain('is-active'); beforeEach(() => {
createStore();
mountComponent();
}); });
describe('when mouseup event is called on the card', () => { describe('when not using multi-select', () => {
beforeEach(() => { it('should call vuex action "toggleBoardItem" with correct parameters', async () => {
createStore({ isSwimlanesOn }); await selectCard();
mountComponent();
});
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).toHaveBeenCalledTimes(1);
expect(mockActions.toggleBoardItem).toHaveBeenCalledWith(expect.any(Object), { expect(mockActions.toggleBoardItem).toHaveBeenCalledWith(expect.any(Object), {
boardItem: mockIssue, boardItem: mockIssue,
});
}); });
}); });
});
describe('when using multi-select', () => { describe('when using multi-select', () => {
it('should call vuex action "multiSelectBoardItem" with correct parameters', async () => { it('should call vuex action "multiSelectBoardItem" with correct parameters', async () => {
await multiSelectCard(); await multiSelectCard();
expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledTimes(1); expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledTimes(1);
expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledWith( expect(mockActions.toggleBoardItemMultiSelection).toHaveBeenCalledWith(
expect.any(Object), expect.any(Object),
mockIssue, mockIssue,
); );
});
}); });
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment