From 60dd54fcb62f5a475e292c3b8d2a1465c1360399 Mon Sep 17 00:00:00 2001 From: David Cho-Lerat Date: Tue, 13 Jun 2023 14:09:09 +0200 Subject: [PATCH] SONAR-19345 Allow deselection of now-empty facets --- .../sonar-web/design-system/src/components/FacetItem.tsx | 4 +++- .../js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/design-system/src/components/FacetItem.tsx b/server/sonar-web/design-system/src/components/FacetItem.tsx index 9fbeff5e730..6a4a262d417 100644 --- a/server/sonar-web/design-system/src/components/FacetItem.tsx +++ b/server/sonar-web/design-system/src/components/FacetItem.tsx @@ -47,7 +47,9 @@ export function FacetItem({ tooltip, value, }: FacetItemProps) { - const disabled = disabledProp || (stat !== undefined && stat === 0); + // alow an active facet to be disabled even if it now has a "0" stat + // (it was activated when a different value of My issues/All/New code was selected) + const disabled = disabledProp || (!active && stat !== undefined && stat === 0); const handleClick = (event: React.MouseEvent) => { event.preventDefault(); diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx index 6343f5a293a..b0ae3c87562 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx @@ -42,14 +42,14 @@ const ui = { exportBtn: byRole('button', { name: 'project_dump.do_export' }), importBtn: byRole('button', { name: 'project_dump.do_import' }), - successExport: byText('project_dump.latest_export_available.June 8, 2023 at', { exact: false }), - pendingExport: byText('project_dump.pending_export.June 8, 2023 at', { exact: false }), + successExport: byText('project_dump.latest_export_available.June 8, 2023', { exact: false }), + pendingExport: byText('project_dump.pending_export.June 8, 2023', { exact: false }), inProgressExport: byText('project_dump.in_progress_export.1 hour ago'), failedExport: byText('project_dump.failed_export'), cantExportMsg: byText('project_dump.can_not_export'), - successImport: byText('project_dump.import_success.June 8, 2023 at', { exact: false }), - pendingImport: byText('project_dump.pending_import.June 8, 2023 at', { exact: false }), + successImport: byText('project_dump.import_success.June 8, 2023', { exact: false }), + pendingImport: byText('project_dump.pending_import.June 8, 2023', { exact: false }), inProgressImport: byText('project_dump.in_progress_import.1 hour ago'), failedImport: byText('project_dump.failed_import'), cantImportMsg: byText('project_dump.can_not_import'), -- 2.39.5