aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorGuillaume Peoc'h <guillaume.peoch@sonarsource.com>2022-10-07 11:43:23 +0200
committersonartech <sonartech@sonarsource.com>2022-10-11 20:03:59 +0000
commit8cd18056f08bd9b2f705cab6e8be8aaf91f43834 (patch)
tree6873dd54f2d88f31f897bc175887eb62f7d2d04d /server/sonar-web/src/main/js
parenta0cc4b0b773fe299cdf685d3a667010088d4b429 (diff)
downloadsonarqube-8cd18056f08bd9b2f705cab6e8be8aaf91f43834.tar.gz
sonarqube-8cd18056f08bd9b2f705cab6e8be8aaf91f43834.zip
SONAR-17001 [894147] Button: Button does not have a name
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx16
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap1
2 files changed, 11 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx
index e131d1993bc..c26f9de9f02 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx
@@ -22,6 +22,7 @@ import * as React from 'react';
import { ClearButton } from '../../components/controls/buttons';
import AlertWarnIcon from '../../components/icons/AlertWarnIcon';
import ChartLegendIcon from '../../components/icons/ChartLegendIcon';
+import { translateWithParameters } from '../../helpers/l10n';
interface Props {
className?: string;
@@ -40,22 +41,25 @@ export default class GraphsLegendItem extends React.PureComponent<Props> {
};
render() {
+ const { className, name, index } = this.props;
const isActionable = this.props.removeMetric != null;
- const legendClass = classNames(
- { 'activity-graph-legend-actionable': isActionable },
- this.props.className
- );
+ const legendClass = classNames({ 'activity-graph-legend-actionable': isActionable }, className);
+
return (
<span className={legendClass}>
{this.props.showWarning ? (
<AlertWarnIcon className="spacer-right" />
) : (
- <ChartLegendIcon className="text-middle spacer-right" index={this.props.index} />
+ <ChartLegendIcon className="text-middle spacer-right" index={index} />
)}
- <span className="text-middle">{this.props.name}</span>
+ <span className="text-middle">{name}</span>
{isActionable && (
<ClearButton
className="button-tiny spacer-left text-middle"
+ aria-label={translateWithParameters(
+ 'project_activity.graphs.custom.remove_metric',
+ name
+ )}
iconProps={{ size: 12 }}
onClick={this.handleClick}
/>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap b/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap
index d374734cb54..37369e0d970 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap
@@ -30,6 +30,7 @@ exports[`should render correctly a legend: with legend 1`] = `
Foo
</span>
<ClearButton
+ aria-label="project_activity.graphs.custom.remove_metric.Foo"
className="button-tiny spacer-left text-middle"
iconProps={
Object {