diff --git a/lib/components/Input/base/index.tsx b/lib/components/Input/base/index.tsx index 79b020ed..b6e01329 100644 --- a/lib/components/Input/base/index.tsx +++ b/lib/components/Input/base/index.tsx @@ -269,7 +269,7 @@ const Input = forwardRef( {leftPlaceholder} )} - {formatProps ? ( + {formatProps?.format ? ( diff --git a/lib/components/Input/input-phone-number/__tests__/input-phone-number.test.tsx b/lib/components/Input/input-phone-number/__tests__/input-phone-number.test.tsx index 8f5b653a..699db314 100644 --- a/lib/components/Input/input-phone-number/__tests__/input-phone-number.test.tsx +++ b/lib/components/Input/input-phone-number/__tests__/input-phone-number.test.tsx @@ -24,19 +24,9 @@ describe("InputPhoneNumber Component", () => { expect(asFragment()).toMatchSnapshot(); }); - it("should render correctly with default props", () => { - const { getByPlaceholderText } = render( - , - ); - const input = getByPlaceholderText("00 0000 0000"); - expect(input).toBeInTheDocument(); - }); - it("should call onValueChange when input value changes", () => { - const { getByPlaceholderText } = render( - , - ); - const input = getByPlaceholderText("00 0000 0000"); + const { getByRole } = render(); + const input = getByRole("textbox"); fireEvent.change(input, { target: { value: "1234567890" } }); expect(defaultProps.onValueChange).toHaveBeenCalledWith("+11234567890"); @@ -62,14 +52,14 @@ describe("InputPhoneNumber Component", () => { }); it("should update phone code and input value state", () => { - const { getByText, getByPlaceholderText } = render( + const { getByText, getByRole } = render( , ); - const input = getByPlaceholderText("00 0000 0000"); + const input = getByRole("textbox"); const dropdownButton = getByText("Code"); fireEvent.click(dropdownButton); @@ -85,7 +75,7 @@ describe("InputPhoneNumber Component", () => { }); it("should render custom props correctly", () => { - const { getByPlaceholderText } = render( + const { getByRole } = render( { placeholder="Enter your phone number" />, ); - const input = getByPlaceholderText("Enter your phone number"); + const input = getByRole("textbox"); expect(input).toBeInTheDocument(); }); }); diff --git a/lib/components/Input/input-phone-number/index.tsx b/lib/components/Input/input-phone-number/index.tsx index fd93d076..56a043fb 100644 --- a/lib/components/Input/input-phone-number/index.tsx +++ b/lib/components/Input/input-phone-number/index.tsx @@ -40,11 +40,6 @@ const InputPhoneNumberContent = forwardRef< fillAddonBorderColor, countryCodes, shortCode, - placeholder = "00 0000 0000", - formatProps = { - format: "## #### ####", - mask: "", - }, onCodeChange, onValueChange, showFlags = true, @@ -129,12 +124,10 @@ const InputPhoneNumberContent = forwardRef<