From af8660d1e489a70ea5281309de2e0eea76b072c5 Mon Sep 17 00:00:00 2001 From: adongare Date: Mon, 28 Oct 2024 14:38:19 -0400 Subject: [PATCH] MAT-7854 Quantity value should be a number --- .../common/quantityInput/QuantityInput.test.tsx | 8 ++++---- src/components/common/quantityInput/QuantityInput.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/common/quantityInput/QuantityInput.test.tsx b/src/components/common/quantityInput/QuantityInput.test.tsx index ea9f2eceb..870745ffc 100644 --- a/src/components/common/quantityInput/QuantityInput.test.tsx +++ b/src/components/common/quantityInput/QuantityInput.test.tsx @@ -142,14 +142,14 @@ describe("QuantityInput Component", () => { expect(quantityFieldInput.value).toBe(""); expect(onQuantityChange).toBeCalled(); userEvent.type(quantityFieldInput, "-1-"); - await expect(onQuantityChange).toHaveBeenNthCalledWith(2, { + expect(onQuantityChange).toHaveBeenNthCalledWith(2, { unit: "mg", - value: "-1", + value: -1, }); userEvent.type(quantityFieldInput, "2.5/...-"); - await expect(onQuantityChange).toHaveBeenNthCalledWith(6, { + expect(onQuantityChange).toHaveBeenNthCalledWith(6, { unit: "mg", - value: "2.5", + value: 2.5, }); }); }); diff --git a/src/components/common/quantityInput/QuantityInput.tsx b/src/components/common/quantityInput/QuantityInput.tsx index a15467beb..3e1809545 100644 --- a/src/components/common/quantityInput/QuantityInput.tsx +++ b/src/components/common/quantityInput/QuantityInput.tsx @@ -105,7 +105,7 @@ const QuantityInput = ({ const handleQuantityValueChange = (newValue) => { const newQuantity: CQL.Quantity = { - value: newValue, + value: Number(newValue), unit: currentQuantity.unit, }; setCurrentQuantity(newQuantity);