From 0e8f8eba5a4e87070dedc47d9efb4b2a450a2b41 Mon Sep 17 00:00:00 2001 From: Jack Chapman Date: Mon, 4 Aug 2025 10:59:30 +0100 Subject: [PATCH 1/2] Enable more epic bulk edit options Enables assignee, health status, subscription, confidentiality, and milestone. EE: true Changelog: added --- .../work_item_bulk_edit_sidebar.vue | 7 +-- .../work_item_bulk_edit_sidebar_spec.js | 56 +++++-------------- 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/app/assets/javascripts/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar.vue b/app/assets/javascripts/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar.vue index 61e7af8c5faa0c..94fbabb621b7b7 100644 --- a/app/assets/javascripts/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar.vue +++ b/app/assets/javascripts/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar.vue @@ -276,7 +276,6 @@ export default { data-testid="bulk-edit-state" /> { }); describe('"Assignee" component', () => { - it.each([true, false])('renders depending on isEpicsList prop', (isEpicsList) => { - createComponent({ props: { isEpicsList } }); - - expect(findAssigneeComponent().exists()).toBe(!isEpicsList); - }); - it('updates assignee when "Assignee" component emits "input" event', async () => { createComponent(); @@ -526,18 +520,19 @@ describe('WorkItemBulkEditSidebar component', () => { }); describe('"Health status" component', () => { - it.each` - isEpicsList | hasIssuableHealthStatusFeature | expected - ${false} | ${false} | ${false} - ${false} | ${true} | ${true} - ${true} | ${false} | ${false} - ${true} | ${true} | ${false} - `( - 'renders only when isEpicsList=false and hasIssuableHealthStatusFeature=true', - ({ isEpicsList, hasIssuableHealthStatusFeature, expected }) => { - createComponent({ provide: { hasIssuableHealthStatusFeature }, props: { isEpicsList } }); - - expect(findHealthStatusComponent().exists()).toBe(expected); + it.each([true, false])( + 'renders depending on hasIssuableHealthStatusFeature feature', + (hasIssuableHealthStatusFeature) => { + createComponent({ + provide: { + glFeatures: { + workItemsBulkEdit: true, + }, + hasIssuableHealthStatusFeature, + }, + }); + + expect(findHealthStatusComponent().exists()).toBe(hasIssuableHealthStatusFeature); }, ); @@ -589,12 +584,6 @@ describe('WorkItemBulkEditSidebar component', () => { }); describe('"Subscription" component', () => { - it.each([true, false])('renders depending on isEpicsList prop', (isEpicsList) => { - createComponent({ props: { isEpicsList } }); - - expect(findSubscriptionComponent().exists()).toBe(!isEpicsList); - }); - it('updates subscription when "Subscription" component emits "input" event', async () => { createComponent(); @@ -606,12 +595,6 @@ describe('WorkItemBulkEditSidebar component', () => { }); describe('"Confidentiality" component', () => { - it.each([true, false])('renders depending on isEpicsList prop', (isEpicsList) => { - createComponent({ props: { isEpicsList } }); - - expect(findConfidentialityComponent().exists()).toBe(!isEpicsList); - }); - it('updates confidentiality when "Confidentiality" component emits "input" event', async () => { createComponent(); @@ -623,19 +606,6 @@ describe('WorkItemBulkEditSidebar component', () => { }); describe('"Milestone" component', () => { - it.each([true, false])('renders depending on isEpicsList prop', (isEpicsList) => { - createComponent({ - provide: { - glFeatures: { - workItemsBulkEdit: true, - }, - }, - props: { isEpicsList }, - }); - - expect(findMilestoneComponent().exists()).toBe(!isEpicsList); - }); - it('updates milestone when "Milestone" component emits "input" event', async () => { createComponent({ provide: { -- GitLab From f5cfbb178102bafb8a2cabbc412ad328de5db45a Mon Sep 17 00:00:00 2001 From: Jack Chapman Date: Tue, 5 Aug 2025 11:55:54 +0100 Subject: [PATCH 2/2] Add specs for component visibility --- .../work_item_bulk_edit_sidebar_spec.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/spec/frontend/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar_spec.js b/spec/frontend/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar_spec.js index 0c0f103c75903b..eb134fe79e49c5 100644 --- a/spec/frontend/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar_spec.js +++ b/spec/frontend/work_items/components/work_item_bulk_edit/work_item_bulk_edit_sidebar_spec.js @@ -319,6 +319,65 @@ describe('WorkItemBulkEditSidebar component', () => { }); }); + describe('widget visibility', () => { + it('shows the correct widgets when GraphQL is disabled', () => { + createComponent({ provide: { hasIssuableHealthStatusFeature: true } }); + + // visible + expect(findStateComponent().exists()).toBe(true); + expect(findAssigneeComponent().exists()).toBe(true); + expect(findAddLabelsComponent().exists()).toBe(true); + expect(findRemoveLabelsComponent().exists()).toBe(true); + expect(findHealthStatusComponent().exists()).toBe(true); + expect(findSubscriptionComponent().exists()).toBe(true); + expect(findConfidentialityComponent().exists()).toBe(true); + + // hidden + expect(findMilestoneComponent().exists()).toBe(false); + expect(findParentComponent().exists()).toBe(false); + expect(findBulkMoveComponent().exists()).toBe(false); + }); + + it('shows the correct widgets when GraphQL is enabled', () => { + createComponent({ + provide: { hasIssuableHealthStatusFeature: true, glFeatures: { workItemsBulkEdit: true } }, + }); + + // visible + expect(findStateComponent().exists()).toBe(true); + expect(findAssigneeComponent().exists()).toBe(true); + expect(findAddLabelsComponent().exists()).toBe(true); + expect(findRemoveLabelsComponent().exists()).toBe(true); + expect(findHealthStatusComponent().exists()).toBe(true); + expect(findSubscriptionComponent().exists()).toBe(true); + expect(findConfidentialityComponent().exists()).toBe(true); + expect(findMilestoneComponent().exists()).toBe(true); + expect(findParentComponent().exists()).toBe(true); + expect(findBulkMoveComponent().exists()).toBe(true); + }); + + it('shows the correct widgets when GraphQL is enabled and on epics list', () => { + createComponent({ + props: { isEpicsList: true }, + provide: { hasIssuableHealthStatusFeature: true, glFeatures: { workItemsBulkEdit: true } }, + }); + + // visible + expect(findAssigneeComponent().exists()).toBe(true); + expect(findAddLabelsComponent().exists()).toBe(true); + expect(findRemoveLabelsComponent().exists()).toBe(true); + expect(findHealthStatusComponent().exists()).toBe(true); + expect(findSubscriptionComponent().exists()).toBe(true); + expect(findConfidentialityComponent().exists()).toBe(true); + expect(findMilestoneComponent().exists()).toBe(true); + + // hidden + expect(findStateComponent().exists()).toBe(false); + expect(findParentComponent().exists()).toBe(false); + expect(findBulkMoveComponent().exists()).toBe(false); + }); + }); + describe('getAvailableBulkEditWidgets query', () => { beforeEach(() => { createComponent({ provide: { glFeatures: { workItemsBulkEdit: true } } }); -- GitLab