From: Wouter Admiraal Date: Fri, 15 Jul 2022 14:29:56 +0000 (+0200) Subject: SONAR-17041 Fix new code tab when using reference_branch X-Git-Tag: 9.6.0.59041~218 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d76685c8a06b9cde9ce1fad7502b47573e1e4e31;p=sonarqube.git SONAR-17041 Fix new code tab when using reference_branch --- 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`] = `