diff --git a/src/ui/TotalsNumber/TotalsNumber.test.tsx b/src/ui/TotalsNumber/TotalsNumber.test.tsx index 57eec37120..bb6b48043e 100644 --- a/src/ui/TotalsNumber/TotalsNumber.test.tsx +++ b/src/ui/TotalsNumber/TotalsNumber.test.tsx @@ -137,6 +137,25 @@ describe('TotalsNumber', () => { const changeValue = screen.getByTestId('change-value') expect(changeValue).toHaveTextContent('0') + expect(changeValue).not.toHaveClass("before:content-['+']") + + const numberValue = screen.getByTestId('number-value') + expect(numberValue).toHaveClass('bg-ds-coverage-covered') + }) + + it('does not render + sign for zero value', () => { + render( + + ) + + const changeValue = screen.getByTestId('change-value') + expect(changeValue).toHaveTextContent('0') + expect(changeValue).not.toHaveClass("before:content-['+']") const numberValue = screen.getByTestId('number-value') expect(numberValue).toHaveClass('bg-ds-coverage-covered') diff --git a/src/ui/TotalsNumber/TotalsNumber.tsx b/src/ui/TotalsNumber/TotalsNumber.tsx index 9e722bac90..1868169984 100644 --- a/src/ui/TotalsNumber/TotalsNumber.tsx +++ b/src/ui/TotalsNumber/TotalsNumber.tsx @@ -28,7 +28,7 @@ const getNumberClasses = ({ hasValue && parseFloat(value.toFixed(2)) < 0 && !plain, 'bg-ds-coverage-covered': hasValue && parseFloat(value.toFixed(2)) >= 0 && !plain, - "before:content-['+']": hasValue && showChange, + "before:content-['+']": hasValue && showChange && value > 0, }) }