diff --git a/src/plugins/workspace/public/components/workspace_list/index.test.tsx b/src/plugins/workspace/public/components/workspace_list/index.test.tsx index 76429a53f4a..3e7220323a6 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.test.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.test.tsx @@ -302,6 +302,29 @@ describe('WorkspaceList', () => { expect(queryByText('Create workspace')).toBeNull(); }); + it('displays "Delete 1 workspace" when one workspace is selected for deletion', async () => { + const { getByText, container, getByTestId } = render(getWrapWorkspaceListInContext()); + const checkboxes = container.querySelectorAll('[data-test-subj^="checkboxSelectRow-"]'); + expect(checkboxes.length).toBeGreaterThanOrEqual(2); + fireEvent.click(checkboxes[0]); + expect(getByText('Delete 1 workspace')).toBeInTheDocument(); + const deleteButton = getByTestId('workspace-list-page-delete-button'); + fireEvent.click(deleteButton); + expect(screen.queryByLabelText('mock delete workspace modal')).toBeInTheDocument(); + }); + + it('should display "Delete 2 workspaces" and show modal when two workspaces are selected for deletion', async () => { + const { getByText, container, getByTestId } = render(getWrapWorkspaceListInContext()); + const checkboxes = container.querySelectorAll('[data-test-subj^="checkboxSelectRow-"]'); + expect(checkboxes.length).toBeGreaterThanOrEqual(2); + fireEvent.click(checkboxes[0]); + fireEvent.click(checkboxes[1]); + expect(getByText('Delete 2 workspaces')).toBeInTheDocument(); + const deleteButton = getByTestId('workspace-list-page-delete-button'); + fireEvent.click(deleteButton); + expect(screen.queryByLabelText('mock delete workspace modal')).toBeInTheDocument(); + }); + it('should render data source badge when more than two data sources', async () => { const { getByTestId } = render(getWrapWorkspaceListInContext()); await waitFor(() => { diff --git a/src/plugins/workspace/public/components/workspace_list/index.tsx b/src/plugins/workspace/public/components/workspace_list/index.tsx index fcf7da34c71..24126075e51 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.tsx @@ -354,7 +354,13 @@ export const WorkspaceListInner = ({ size="s" data-test-subj="multi-deletion-button" > - Delete {selection.length} Workspace + {i18n.translate('workspace.list.page.delete.button.info', { + defaultMessage: 'Delete {num} workspace{pluralSuffix, select, true {} other {s}}', + values: { + num: selection.length, + pluralSuffix: selection.length === 1, + }, + })} {deletedWorkspaces && deletedWorkspaces.length > 0 && (