From ca6ddb253d4e7fc7cbdfac45fdfd2e7db461467c Mon Sep 17 00:00:00 2001 From: Siegfried Ehret <49895321+siegfried-ehret-sonarsource@users.noreply.github.com> Date: Mon, 21 Oct 2019 11:44:46 +0200 Subject: SONAR-12611 Fix badges alignment on QG page --- .../src/main/js/app/styles/components/badges.css | 2 - .../main/js/apps/quality-gates/components/List.tsx | 20 ++---- .../components/__tests__/List-test.tsx | 39 ++++++++++++ .../__tests__/__snapshots__/List-test.tsx.snap | 73 ++++++++++++++++++++++ 4 files changed, 118 insertions(+), 16 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/List-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/__snapshots__/List-test.tsx.snap diff --git a/server/sonar-web/src/main/js/app/styles/components/badges.css b/server/sonar-web/src/main/js/app/styles/components/badges.css index af40a09aeb5..6a9a3c10d7c 100644 --- a/server/sonar-web/src/main/js/app/styles/components/badges.css +++ b/server/sonar-web/src/main/js/app/styles/components/badges.css @@ -42,12 +42,10 @@ a.badge { border-bottom: none; } -.list-group-item > .badge, .list-group-item-heading > .badge { float: right; margin: 3px; } -.list-group-item > .badge + .badge, .list-group-item-heading > .badge + .badge { margin-right: 5px; } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx index 7ada92f5d67..e773152c2d6 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx @@ -34,23 +34,15 @@ export default function List({ organization, qualityGates }: Props) { {qualityGates.map(qualityGate => ( - - - - - - - -
{qualityGate.name} - {qualityGate.isDefault && {translate('default')}} - {qualityGate.isBuiltIn && ( - - )} -
+ {qualityGate.name} + {qualityGate.isDefault && ( + {translate('default')} + )} + {qualityGate.isBuiltIn && } ))} diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/List-test.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/List-test.tsx new file mode 100644 index 00000000000..03de4e1e4b2 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/List-test.tsx @@ -0,0 +1,39 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { mockQualityGate } from '../../../../helpers/testMocks'; +import List from '../List'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender() { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/__snapshots__/List-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/__snapshots__/List-test.tsx.snap new file mode 100644 index 00000000000..ab4398468dd --- /dev/null +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/__snapshots__/List-test.tsx.snap @@ -0,0 +1,73 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
+ + + qualitygate + + + + + qualitygate + + + + + + qualitygate + + + default + + +
+`; -- cgit v1.2.3