From d76685c8a06b9cde9ce1fad7502b47573e1e4e31 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Fri, 15 Jul 2022 16:29:56 +0200 Subject: [PATCH] SONAR-17041 Fix new code tab when using reference_branch --- .../js/apps/overview/branches/ProjectLeakPeriodInfo.tsx | 6 +++++- .../branches/__tests__/ProjectLeakPeriodInfo-test.tsx | 4 ++++ .../__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx index f58d63e6e0c..eccfce5a45a 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx @@ -47,7 +47,11 @@ export function ProjectLeakPeriodInfo(props: ProjectLeakPeriodInfoProps) { return null; } - if (leakPeriod.mode === 'days' || leakPeriod.mode === 'NUMBER_OF_DAYS') { + if ( + leakPeriod.mode === 'days' || + leakPeriod.mode === 'NUMBER_OF_DAYS' || + leakPeriod.mode === 'REFERENCE_BRANCH' + ) { return
{leakPeriodLabel}
; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx index 0525cc409e2..f21aa5f15c9 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx @@ -50,6 +50,10 @@ it('should render correctly for "previous_analysis"', () => { expect(shallowRender({ mode: 'previous_analysis' })).toMatchSnapshot(); }); +it('should render correctly for "REFERENCE_BRANCH"', () => { + expect(shallowRender({ mode: 'REFERENCE_BRANCH', parameter: 'master' })).toMatchSnapshot(); +}); + it('should render correctly for "manual_baseline"', () => { expect(shallowRender({ mode: 'manual_baseline' })).toMatchSnapshot(); expect(shallowRender({ mode: 'manual_baseline', parameter: '1.1.2' })).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap index 334ecf878d4..1323291149c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap @@ -16,6 +16,15 @@ exports[`should render a more precise date 1`] = ` `; +exports[`should render correctly for "REFERENCE_BRANCH" 1`] = ` +
+ overview.period.reference_branch.master + +
+`; + exports[`should render correctly for "manual_baseline" 1`] = `