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();
*/
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';
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 ? <DesiredIcon {...iconProps} /> : null;
+ return DesiredIcon ? (
+ <DesiredIcon {...iconProps} ariaLabel={ariaLabel ?? translate('severity', severity)} />
+ ) : null;
}
function BlockerSeverityIcon(iconProps: IconProps) {
<SelectList currentItem={issue.severity} items={SEVERITY} onSelect={onSelect}>
{SEVERITY.map((severity) => (
<SelectListItem className="display-flex-center" item={severity} key={severity}>
- <SeverityIcon className="little-spacer-right" severity={severity} />
+ <SeverityIcon className="little-spacer-right" severity={severity} aria-hidden={true} />
{translate('severity', severity)}
</SelectListItem>
))}
}
return (
<span className={className}>
- <SeverityIcon className="little-spacer-right" severity={severity} />
+ <SeverityIcon className="little-spacer-right" severity={severity} aria-hidden={true} />
{translate('severity', severity)}
</span>
);