Commit a48c85a0 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '277099-hide-epic-lane-with-zero-issues' into 'master'

Swimlanes - Hide epic lanes with 0 issues

See merge request gitlab-org/gitlab!47257
parents c99ddf89 669e014e
...@@ -85,6 +85,9 @@ export default { ...@@ -85,6 +85,9 @@ export default {
isLoading() { isLoading() {
return Boolean(this.epicsFlags[this.epic.id]?.isLoading); return Boolean(this.epicsFlags[this.epic.id]?.isLoading);
}, },
shouldDisplay() {
return this.issuesCount > 0 || this.isLoading;
},
}, },
watch: { watch: {
filterParams: { filterParams: {
...@@ -116,8 +119,11 @@ export default { ...@@ -116,8 +119,11 @@ export default {
</script> </script>
<template> <template>
<div> <div v-if="shouldDisplay">
<div class="board-epic-lane gl-sticky gl-left-0 gl-display-inline-block"> <div
class="board-epic-lane gl-sticky gl-left-0 gl-display-inline-block"
data-testid="board-epic-lane"
>
<div class="gl-pb-5 gl-px-3 gl-display-flex gl-align-items-center"> <div class="gl-pb-5 gl-px-3 gl-display-flex gl-align-items-center">
<gl-button <gl-button
v-gl-tooltip.hover.right v-gl-tooltip.hover.right
......
...@@ -43,19 +43,29 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -43,19 +43,29 @@ RSpec.describe 'epics swimlanes', :js do
wait_for_board_cards_in_first_epic(0, 1) wait_for_board_cards_in_first_epic(0, 1)
wait_for_board_cards_in_second_epic(1, 1) wait_for_board_cards_in_second_epic(1, 1)
epic_lanes = page.all(:css, '.board-epic-lane')
expect(epic_lanes.length).to eq(2)
drag(list_from_index: 4, list_to_index: 1) drag(list_from_index: 4, list_to_index: 1)
epic_lanes = page.all(:css, '.board-epic-lane')
expect(epic_lanes.length).to eq(1)
wait_for_board_cards_in_first_epic(1, 1) wait_for_board_cards_in_first_epic(1, 1)
wait_for_board_cards_in_second_epic(1, 0)
end end
it 'from epic to unassigned issues lane' do it 'from epic to unassigned issues lane' do
wait_for_board_cards(1, 2) wait_for_board_cards(1, 2)
wait_for_board_cards_in_second_epic(1, 1) wait_for_board_cards_in_second_epic(1, 1)
epic_lanes = page.all(:css, '.board-epic-lane')
expect(epic_lanes.length).to eq(2)
drag(list_from_index: 4, list_to_index: 7) drag(list_from_index: 4, list_to_index: 7)
wait_for_board_cards_in_second_epic(1, 0) epic_lanes = page.all(:css, '.board-epic-lane')
expect(epic_lanes.length).to eq(1)
wait_for_board_cards_in_unassigned_lane(1, 1) wait_for_board_cards_in_unassigned_lane(1, 1)
end end
......
...@@ -16,14 +16,14 @@ describe('EpicLane', () => { ...@@ -16,14 +16,14 @@ describe('EpicLane', () => {
const updateBoardEpicUserPreferencesSpy = jest.fn(); const updateBoardEpicUserPreferencesSpy = jest.fn();
const createStore = isLoading => { const createStore = ({ isLoading = false, issuesByListId = mockIssuesByListId }) => {
return new Vuex.Store({ return new Vuex.Store({
actions: { actions: {
fetchIssuesForEpic: jest.fn(), fetchIssuesForEpic: jest.fn(),
updateBoardEpicUserPreferences: updateBoardEpicUserPreferencesSpy, updateBoardEpicUserPreferences: updateBoardEpicUserPreferencesSpy,
}, },
state: { state: {
issuesByListId: mockIssuesByListId, issuesByListId,
issues, issues,
epicsFlags: { epicsFlags: {
[mockEpic.id]: { isLoading }, [mockEpic.id]: { isLoading },
...@@ -33,8 +33,12 @@ describe('EpicLane', () => { ...@@ -33,8 +33,12 @@ describe('EpicLane', () => {
}); });
}; };
const createComponent = ({ props = {}, isLoading = false } = {}) => { const createComponent = ({
const store = createStore(isLoading); props = {},
isLoading = false,
issuesByListId = mockIssuesByListId,
} = {}) => {
const store = createStore({ isLoading, issuesByListId });
const defaultProps = { const defaultProps = {
epic: mockEpic, epic: mockEpic,
...@@ -119,5 +123,10 @@ describe('EpicLane', () => { ...@@ -119,5 +123,10 @@ describe('EpicLane', () => {
expect(wrapper.vm.isCollapsed).toBe(true); expect(wrapper.vm.isCollapsed).toBe(true);
}); });
}); });
it('does not render when issuesCount is 0', () => {
createComponent({ issuesByListId: {} });
expect(findByTestId('board-epic-lane').exists()).toBe(false);
});
}); });
}); });
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