From f52af3959d2917ed687e05afd1d00a03799ee38b Mon Sep 17 00:00:00 2001 From: Qxisylolo Date: Mon, 11 Nov 2024 15:14:02 +0800 Subject: [PATCH] solve conflicts, update tests Signed-off-by: Qxisylolo --- .../default_workspace.test.tsx.snap | 93 +------------------ .../components/workspace_list/index.test.tsx | 10 +- .../components/workspace_list/index.tsx | 6 +- 3 files changed, 14 insertions(+), 95 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_list/__snapshots__/default_workspace.test.tsx.snap b/src/plugins/workspace/public/components/workspace_list/__snapshots__/default_workspace.test.tsx.snap index a9ccce657cb..b43e356078e 100644 --- a/src/plugins/workspace/public/components/workspace_list/__snapshots__/default_workspace.test.tsx.snap +++ b/src/plugins/workspace/public/components/workspace_list/__snapshots__/default_workspace.test.tsx.snap @@ -157,24 +157,6 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = ` - - - - Permissions - - -
should be able to see the description tooltip when hovering over the description @@ -277,29 +259,6 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = `
- -
- Permissions -
-
- -
- Admin -
-
-
- @@ -438,7 +397,7 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = ` class="euiToolTipAnchor" >
should be able to see the description tooltip when hovering over the description @@ -446,29 +405,6 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = `
- -
- Permissions -
-
- -
- Admin -
-
-
- @@ -607,7 +543,7 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = ` class="euiToolTipAnchor" >
— @@ -615,29 +551,6 @@ exports[`UserDefaultWorkspace should render title and table normally 1`] = `
- -
- Permissions -
-
- -
- Admin -
-
-
- 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 3e7220323a6..ad18fe5eed8 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.test.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.test.tsx @@ -308,9 +308,12 @@ describe('WorkspaceList', () => { expect(checkboxes.length).toBeGreaterThanOrEqual(2); fireEvent.click(checkboxes[0]); expect(getByText('Delete 1 workspace')).toBeInTheDocument(); - const deleteButton = getByTestId('workspace-list-page-delete-button'); + const deleteButton = getByTestId('multi-deletion-button'); fireEvent.click(deleteButton); expect(screen.queryByLabelText('mock delete workspace modal')).toBeInTheDocument(); + const modalCancelButton = screen.getByLabelText('mock delete workspace modal button'); + fireEvent.click(modalCancelButton); + expect(screen.queryByLabelText('mock delete workspace modal')).not.toBeInTheDocument(); }); it('should display "Delete 2 workspaces" and show modal when two workspaces are selected for deletion', async () => { @@ -320,9 +323,12 @@ describe('WorkspaceList', () => { fireEvent.click(checkboxes[0]); fireEvent.click(checkboxes[1]); expect(getByText('Delete 2 workspaces')).toBeInTheDocument(); - const deleteButton = getByTestId('workspace-list-page-delete-button'); + const deleteButton = getByTestId('multi-deletion-button'); fireEvent.click(deleteButton); expect(screen.queryByLabelText('mock delete workspace modal')).toBeInTheDocument(); + const modalCancelButton = screen.getByLabelText('mock delete workspace modal button'); + fireEvent.click(modalCancelButton); + expect(screen.queryByLabelText('mock delete workspace modal')).not.toBeInTheDocument(); }); it('should render data source badge when more than two data sources', async () => { diff --git a/src/plugins/workspace/public/components/workspace_list/index.tsx b/src/plugins/workspace/public/components/workspace_list/index.tsx index 24126075e51..b84139e94d4 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.tsx @@ -355,10 +355,10 @@ export const WorkspaceListInner = ({ data-test-subj="multi-deletion-button" > {i18n.translate('workspace.list.page.delete.button.info', { - defaultMessage: 'Delete {num} workspace{pluralSuffix, select, true {} other {s}}', + defaultMessage: + '{selectedCount, plural, one {Delete # workspace} other {Delete # workspaces}}', values: { - num: selection.length, - pluralSuffix: selection.length === 1, + selectedCount: selection.length, }, })}