From 664eb7854d14ac3b45bae30cfc7d9243bf7ddb2a Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 16 Aug 2017 13:01:06 +0200 Subject: [PATCH] SONAR-9708 apply feedback (#2362) --- .../components/BackgroundTasksApp.js | 1 - .../apps/background-tasks/components/Task.js | 5 +- .../components/TaskComponent.js | 9 ++- .../apps/background-tasks/components/Tasks.js | 4 +- .../__tests__/TaskComponent-test.js | 36 +++++++++++ .../__snapshots__/TaskComponent-test.js.snap | 64 +++++++++++++++++++ .../resources/org/sonar/l10n/core.properties | 2 +- 7 files changed, 108 insertions(+), 13 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js create mode 100644 server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js index cda4776cf7c..9fa9496d367 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js @@ -246,7 +246,6 @@ class BackgroundTasksApp extends React.PureComponent { 0 ? tasks[index - 1] : null; return ( - + diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js index 839f2c7b0e2..1123a8de956 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js @@ -27,13 +27,12 @@ import Organization from '../../../components/shared/Organization'; /*:: type Props = { - task: Task, - types: Array + task: Task }; */ export default function TaskComponent(props /*: Props */) { - const { task, types } = props; + const { task } = props; if (!task.componentKey) { return ( @@ -41,7 +40,7 @@ export default function TaskComponent(props /*: Props */) { {task.id} - {types.length > 1 && } + ); } @@ -58,7 +57,7 @@ export default function TaskComponent(props /*: Props */) { {task.componentName} - {types.length > 1 && } + ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js index 8eb3e2c68bf..fef3f83eea7 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js @@ -27,7 +27,6 @@ import { translate } from '../../../helpers/l10n'; type Props = { tasks: Array<*>, component: Object, - types: Array<*>, loading: boolean, onCancelTask: Function, onFilterTask: Function @@ -43,7 +42,7 @@ export default class Tasks extends React.PureComponent { /*:: state: State; */ render() { - const { tasks, component, types, loading, onCancelTask, onFilterTask } = this.props; + const { tasks, component, loading, onCancelTask, onFilterTask } = this.props; const className = classNames('data zebra zebra-hover background-tasks', { 'new-loading': loading @@ -86,7 +85,6 @@ export default class Tasks extends React.PureComponent { index={index} tasks={tasks} component={component} - types={types} onCancelTask={onCancelTask} onFilterTask={onFilterTask} /> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js new file mode 100644 index 00000000000..b1c54c7f158 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +/* @flow */ +import React from 'react'; +import { shallow } from 'enzyme'; +import TaskComponent from '../TaskComponent'; + +it('renders', () => { + const task = { + componentKey: 'foo', + componentName: 'foo', + componentQualifier: 'TRK', + id: 'bar', + organization: 'org', + type: 'REPORT' + }; + expect(shallow()).toMatchSnapshot(); + expect(shallow()).toMatchSnapshot(); +}); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap new file mode 100644 index 00000000000..703c9f27eea --- /dev/null +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap @@ -0,0 +1,64 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders 1`] = ` + + + + + + + foo + + + +`; + +exports[`renders 2`] = ` + + + bar + + + +`; diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index f45218ea69b..0d10ae67275 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -82,7 +82,7 @@ identifier_abbreviated=Id inactive=Inactive including_abbreviated=incl. incremental=Incremental -incrementa.project_tooltip=Overall project status could be incomplete: incremental mode was used in the last analysis, so only changed files were examined. +incremental.project_tooltip=Overall project status could be incomplete: incremental mode was used in the last analysis, so only changed files were examined. info=Info issue=Issue issues=Issues -- 2.39.5