Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

fix: phone input validation component (2699) #2725

Closed
wants to merge 47 commits into from
Closed

fix: phone input validation component (2699) #2725

wants to merge 47 commits into from

Conversation

marcoboncoraglio
Copy link

Fixes #2699

Changes proposed in this pull request:

Add component for phone number validation taking the country into account

Newly added dependencies with Bundlephobia links:

react-intl-tel-input:
https://github.com/patw0929/react-intl-tel-input
https://bundlephobia.com/package/[email protected]

Notes:

There are a few things missing that I was not able to complete/get working as intended.

  1. Error handling: I had to write my own css to get error messages to show with this new component since we aren't using the native TextInput component to handle the error. Also the way the errors are handled might not be ideal as the added library is made to validate the input in the component itself (compared to doing that centrally after setting the patient object in the redux store) - make sure to run it locally to make sure it all makes sense to you.

  2. I wasn't able to get testing-framework to write into the input of this new component, so the test that assures that the component is editable fails.

@CLAassistant
Copy link

CLAassistant commented Aug 18, 2021

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Aug 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/ACJXvtzvQskEz5dyrUzouHZuD8Ke
✅ Preview: https://hospitalrun-frontend-git-fork-marcoboncoragl-8eb30d-hospitalrun.vercel.app

@marcoboncoraglio marcoboncoraglio changed the title 2699 phone input validation component fix - 2699: phone input validation component Aug 18, 2021
expect(phoneNumberField).toHaveProperty('id', 'phoneNumber0TextInput')
typeWritableAssertion(phoneNumberField, patient.phoneNumbers[0].value)
expect(phoneNumberField).toHaveProperty('id', 'phoneNumber0IntlTelPicker')
// typeWritableAssertion(phoneNumberField, patient.phoneNumbers[0].value) // Haven't been able to get testing-library working with telpicker
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out a test case

@marcoboncoraglio marcoboncoraglio changed the title fix - 2699: phone input validation component fix: phone input validation component (2699) Aug 19, 2021
@matteovivona matteovivona added the in progress indicates that issue/pull request is currently being worked on label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress indicates that issue/pull request is currently being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating new patient - validation messages not appropriate
3 participants