From: Revanshu Paliwal Date: Tue, 20 Sep 2022 15:13:08 +0000 (+0200) Subject: SONAR-16906 Elements must only use allowed ARIA attributes X-Git-Tag: 9.7.0.61563~190 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b986abff6dc9b2d435efa02d5f2a8b6600254060;p=sonarqube.git SONAR-16906 Elements must only use allowed ARIA attributes --- diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx index ee151802289..c5d69b53b40 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx @@ -47,37 +47,33 @@ export function LineCoverage({ line, scrollToUncoveredLine }: LineCoverageProps) return ( -
+
); } function getStatusTooltip(line: SourceLine) { - if (line.coverageStatus === 'uncovered') { - if (line.conditions) { - return translateWithParameters('source_viewer.tooltip.uncovered.conditions', line.conditions); - } else { - return translate('source_viewer.tooltip.uncovered'); - } - } else if (line.coverageStatus === 'covered') { - if (line.conditions) { - return translateWithParameters('source_viewer.tooltip.covered.conditions', line.conditions); - } else { - return translate('source_viewer.tooltip.covered'); - } - } else if (line.coverageStatus === 'partially-covered') { - if (line.conditions) { - return translateWithParameters( - 'source_viewer.tooltip.partially-covered.conditions', - line.coveredConditions || 0, - line.conditions - ); - } else { - return translate('source_viewer.tooltip.partially-covered'); - } + switch (line.coverageStatus) { + case 'uncovered': + return line.conditions + ? translateWithParameters('source_viewer.tooltip.uncovered.conditions', line.conditions) + : translate('source_viewer.tooltip.uncovered'); + case 'covered': + return line.conditions + ? translateWithParameters('source_viewer.tooltip.covered.conditions', line.conditions) + : translate('source_viewer.tooltip.covered'); + case 'partially-covered': + return line.conditions + ? translateWithParameters( + 'source_viewer.tooltip.partially-covered.conditions', + line.coveredConditions || 0, + line.conditions + ) + : translate('source_viewer.tooltip.partially-covered'); + default: + return undefined; } - return undefined; } export default React.memo(LineCoverage);