From d2ebfa3f0df60e1d94620ced121c28d0b4b7b8bb Mon Sep 17 00:00:00 2001 From: Meghan McLaughlin Date: Sat, 18 Apr 2020 17:41:22 -0500 Subject: [PATCH] updating field title and submit button, subsequent tests --- pwa/src/components/PatientInfoForm.test.tsx | 6 +++--- pwa/src/components/PatientInfoForm.tsx | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pwa/src/components/PatientInfoForm.test.tsx b/pwa/src/components/PatientInfoForm.test.tsx index b1009fd..fb96fb6 100644 --- a/pwa/src/components/PatientInfoForm.test.tsx +++ b/pwa/src/components/PatientInfoForm.test.tsx @@ -23,11 +23,11 @@ test("female-only div is only displayed if the sex is selected as female", async test("sets visit input", () => { const dom = render(); - const visitYesInput = dom.queryByTestId("visit-Yes"); - const checkBox = visitYesInput.getElementsByTagName("span")[0]; + const firstVisitYesInput = dom.queryByTestId("first-visit-Yes"); + const checkBox = firstVisitYesInput.getElementsByTagName("span")[0]; expect(checkBox).not.toHaveClass("am-radio-checked"); - fireEvent.click(visitYesInput); + fireEvent.click(firstVisitYesInput); expect(checkBox).toHaveClass("am-radio-checked"); }); diff --git a/pwa/src/components/PatientInfoForm.tsx b/pwa/src/components/PatientInfoForm.tsx index fa39c95..5d5f54f 100644 --- a/pwa/src/components/PatientInfoForm.tsx +++ b/pwa/src/components/PatientInfoForm.tsx @@ -16,7 +16,7 @@ export default function Form(): ReactElement { // useState returns a value, and a function to set that value const [sex, setSex] = useState(null as Number); // Default: null const [albendazole, setAlbendazole] = useState(0); // Default: No - const [visit, setVisit] = useState(0); // Default: No + const [firstVisit, setFirstVisit] = useState(0); // Default: No const [pregnant, setPregnant] = useState(0); // Default: No const [planning, setPlanning] = useState(0); // Default: No @@ -125,14 +125,14 @@ export default function Form(): ReactElement { - "Visit?"}> + "First Visit?"}> {radioYesNo.map((i) => ( setVisit(i.value)} + checked={firstVisit === i.value} + onClick={() => setFirstVisit(i.value)} > {i.label} @@ -257,7 +257,7 @@ export default function Form(): ReactElement {
- +