Skip to content
Snippets Groups Projects
Unverified Commit 0ccc471c authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

fix formatting null values adds prefix and suffix (#47435)

parent 05c2fb22
Branches
Tags
No related merge requests found
......@@ -80,7 +80,7 @@ export function formatValue(value: unknown, _options: OptionsType = {}) {
return formatted;
}
}
if (prefix || suffix) {
if ((prefix || suffix) && formatted != null) {
if (options.jsx && typeof formatted !== "string") {
return (
<span>
......
......@@ -53,6 +53,16 @@ describe("link", () => {
expect(screen.getByText("23.12")).toBeInTheDocument();
});
it("should not apply prefix or suffix to null values", () => {
setup(null, {
prefix: "foo ",
suffix: " bar",
});
const anyContent = screen.queryByText(/./);
expect(anyContent).not.toBeInTheDocument();
});
it("should trim values to specified decimals", () => {
setup(23.123459, {
decimals: 5,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment