From 55eb20604c6a5367d2446402fa4d609e838844e6 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Fri, 10 Feb 2023 10:54:39 +0100 Subject: [PATCH] SONAR-18362 Text Alternative is missing --- .../components/SourceViewer/__tests__/SourceViewer-it.tsx | 2 +- .../src/main/js/components/icons/SeverityIcon.tsx | 7 +++++-- .../main/js/components/issue/popups/SetSeverityPopup.tsx | 2 +- .../src/main/js/components/shared/SeverityHelper.tsx | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx index 4f1e2a4afa7..cc0388f5704 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx @@ -52,7 +52,7 @@ jest.mock('../helpers/lines', () => { const ui = { codeSmellTypeButton: byRole('button', { name: 'issue.type.CODE_SMELL' }), - minorSeverityButton: byRole('button', { name: 'severity.MINOR' }), + minorSeverityButton: byRole('button', { name: /severity.MINOR/ }), }; const componentsHandler = new ComponentsServiceMock(); diff --git a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx index c513b825422..783c6c984e8 100644 --- a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx +++ b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import { colors } from '../../app/theme'; +import { translate } from '../../helpers/l10n'; import { Dict } from '../../types/types'; import Icon, { IconProps } from './Icon'; @@ -34,13 +35,15 @@ const severityIcons: Dict<(props: IconProps) => React.ReactElement> = { info: InfoSeverityIcon, }; -export default function SeverityIcon({ severity, ...iconProps }: Props) { +export default function SeverityIcon({ severity, ariaLabel, ...iconProps }: Props) { if (!severity) { return null; } const DesiredIcon = severityIcons[severity.toLowerCase()]; - return DesiredIcon ? : null; + return DesiredIcon ? ( + + ) : null; } function BlockerSeverityIcon(iconProps: IconProps) { diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx index 405408aa518..f2ecb48cce8 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx @@ -38,7 +38,7 @@ export default function SetSeverityPopup({ issue, onSelect }: Props) { {SEVERITY.map((severity) => ( - + {translate('severity', severity)} ))} diff --git a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx index 01f47307ca1..535a24b2d11 100644 --- a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx +++ b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx @@ -32,7 +32,7 @@ export default function SeverityHelper({ className, severity }: Props) { } return ( - + {translate('severity', severity)} ); -- 2.39.5