]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17041 Fix new code tab when using reference_branch
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Fri, 15 Jul 2022 14:29:56 +0000 (16:29 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 18 Jul 2022 20:03:25 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx
server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx
server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ProjectLeakPeriodInfo-test.tsx.snap

index f58d63e6e0cbef9b1218e7d8d4cd6806ce12d14c..eccfce5a45a09973505803b9e92613468297381a 100644 (file)
@@ -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 <div className="note spacer-top">{leakPeriodLabel} </div>;
   }
 
index 0525cc409e24cbbf67956cf8be1d29cfb74b8e8a..f21aa5f15c94a6881a43bee8ef72012ac019c00f 100644 (file)
@@ -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();
index 334ecf878d4e5a279082c615b08ca37d14eeddf4..1323291149c5ba79033d4ca0e7f43efb35c6c48a 100644 (file)
@@ -16,6 +16,15 @@ exports[`should render a more precise date 1`] = `
 </Fragment>
 `;
 
+exports[`should render correctly for "REFERENCE_BRANCH" 1`] = `
+<div
+  className="note spacer-top"
+>
+  overview.period.reference_branch.master
+   
+</div>
+`;
+
 exports[`should render correctly for "manual_baseline" 1`] = `
 <Fragment>
   <div