hospitalrun-frontend icon indicating copy to clipboard operation
hospitalrun-frontend copied to clipboard

ReportIncident save button always rendered

Open codyarose opened this issue 5 years ago • 8 comments

🐛 Bug Report

In ReportIncident.test.tsx there is a test implying that the save button should only be rendered after all required inputs are filled out, however the save button is always rendered regardless of input values, so the test will always fail. It may be because the Date of Incident input is prefilled with the current date/time, but in the staging app if you empty that input the page crashes.

https://github.com/HospitalRun/hospitalrun-frontend/pull/2516#discussion_r557076908

To Reproduce

Uncomment the test and run npm t

Expected behavior

Test passes

codyarose avatar Jan 15 '21 02:01 codyarose

Thanks for this @codyarose

In ReportIncident.test.tsx there is a test implying that the save button should only be rendered after all required inputs are filled out, however the save button is always rendered regardless of input values, so the test will always fail.

Agreed, the test will always fail. I am not sure if that test is valid since the 'save' buttons in all forms are currently always rendered regardless of whether or not the fields are filled in

@jackcmeyer thoughts?

in the staging app if you empty that input the page crashes

This is a bug that needs addressing, would you like to take a shot at it @codyarose ?

blestab avatar Jan 25 '21 09:01 blestab

@blestab I would like to take this up

Adarsh710 avatar Feb 01 '21 18:02 Adarsh710

@Adarsh710 sure

matteovivona avatar Feb 05 '21 10:02 matteovivona

@tehKapa If the input is empty and has focus then the user can enter a date and if not, then previous date will appear, is this a good flow?

Adarsh710 avatar Feb 05 '21 14:02 Adarsh710

@tehKapa If the input is empty and has focus then the user can enter a date and if not, then previous date will appear, is this a good flow?

If initial value was empty, how do you want to populate it? With the current date?

matteovivona avatar Feb 09 '21 11:02 matteovivona

@tehKapa If the input is empty and has focus then the user can enter a date and if not, then previous date will appear, is this a good flow?

If initial value was empty, how do you want to populate it? With the current date?

Yes, btw it is already populated with current date on initial render

Adarsh710 avatar Feb 09 '21 13:02 Adarsh710

So let's fallback on that

matteovivona avatar Feb 09 '21 17:02 matteovivona

@blestab, @tehKapa please assign reviewers to the above PR because I'm not able to do that

Adarsh710 avatar Feb 15 '21 12:02 Adarsh710