From: Grégoire Aubert Date: Thu, 8 Jun 2017 14:48:50 +0000 (+0200) Subject: SONAR-9245 Display new_lines measure even if there is no data on the leak projects... X-Git-Tag: 6.5-M1~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b1635cd5508d3658bc820d7b53cbeb9190fa82e0;p=sonarqube.git SONAR-9245 Display new_lines measure even if there is no data on the leak projects page --- diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js index db61abdf13a..2675af49875 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeakMeasures.js @@ -116,20 +116,19 @@ export default function ProjectCardLeakMeasures({ measures }: Props) { - {measures['new_lines'] != null && -
-
-
- -
-
- {translate('metric.lines.name')} -
+
+
+
+
-
} +
+ {translate('metric.lines.name')} +
+
+
); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeakMeasures-test.js b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeakMeasures-test.js index 8ef407e3181..5003e421267 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeakMeasures-test.js +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeakMeasures-test.js @@ -39,23 +39,16 @@ it('should render correctly with all data', () => { expect(wrapper).toMatchSnapshot(); }); -it('should not render new coverage', () => { +it('should render no data style new coverage, new duplications and new lines', () => { const wrapper = shallow( - + ); - expect(wrapper.find('[data-key="new_coverage"]')).toMatchSnapshot(); -}); - -it('should not render new duplications', () => { - const wrapper = shallow( - - ); - expect(wrapper.find('[data-key="new_duplicated_lines_density"]')).toMatchSnapshot(); -}); - -it('should not render new lines', () => { - const wrapper = shallow( - - ); - expect(wrapper.find('[data-key="new_lines"]')).toMatchSnapshot(); + expect(wrapper).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeakMeasures-test.js.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeakMeasures-test.js.snap index fa740a935fe..ff9b33de649 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeakMeasures-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeakMeasures-test.js.snap @@ -1,76 +1,226 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should not render new coverage 1`] = ` +exports[`should render correctly with all data 1`] = `
- + + /> + +
+
+ + metric.bugs.name +
+
+
- metric.coverage.name +
+ + +
+
+ + metric.vulnerabilities.name +
- -`; - -exports[`should not render new duplications 1`] = ` -
- + + /> + +
+
+ + metric.code_smells.name +
+
+
- metric.duplicated_lines_density.short_name +
+ +
+
+ metric.coverage.name +
+
+
+
+
+
+ +
+
+ metric.duplicated_lines_density.short_name +
+
+
+
+
+
+ +
+
+ metric.lines.name +
`; -exports[`should not render new lines 1`] = `undefined`; - -exports[`should render correctly with all data 1`] = ` +exports[`should render no data style new coverage, new duplications and new lines 1`] = `
@@ -207,7 +357,7 @@ exports[`should render correctly with all data 1`] = `