Skip to content
Snippets Groups Projects
Unverified Commit 99a002f8 authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

fix rendering of the progress bar static viz without a grouping separator (#19196)

parent 20b3dcb2
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ export const formatNumber = (number: number, options: NumberFormatOptions) => {
const formattedNumber = format
.format(number * scale)
.replace(/\./g, decimal_separator)
.replace(/,/g, grouping_separator);
.replace(/,/g, grouping_separator ?? "");
return `${prefix}${formattedNumber}${suffix}`;
};
......
......@@ -89,6 +89,16 @@ describe("formatNumber", () => {
expect(text).toEqual("prefix15suffix");
});
it("should format a number without grouping separator", () => {
const number = 10000.11;
const text = formatNumber(number, {
number_separators: ".",
});
expect(text).toEqual("10000.11");
});
});
describe("formatPercent", () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment