From b1635cd5508d3658bc820d7b53cbeb9190fa82e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Thu, 8 Jun 2017 16:48:50 +0200 Subject: [PATCH] SONAR-9245 Display new_lines measure even if there is no data on the leak projects page --- .../components/ProjectCardLeakMeasures.js | 25 +- .../__tests__/ProjectCardLeakMeasures-test.js | 27 +- .../ProjectCardLeakMeasures-test.js.snap | 244 ++++++++++++++---- 3 files changed, 219 insertions(+), 77 deletions(-) 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`] = `