From ed9c28f57aa03457c8e77e5cf0212c18d578a187 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Wed, 11 Dec 2024 07:25:06 -0500 Subject: [PATCH] Allow the start date to be removed --- .../EditPartnershipInfoModal.test.tsx | 16 ++++++++++++++++ .../EditPartnershipInfoModal.tsx | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx index d2b0aa5c0..409ff4e26 100644 --- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx +++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx @@ -434,6 +434,22 @@ describe('EditPartnershipInfoModal', () => { expect(handleClose).toHaveBeenCalled(); }); + it('should allow for user to remove the start date', async () => { + const { getByLabelText, getByText, findByText } = render(); + const datePickerButton = getByLabelText('Start Date'); + userEvent.click(datePickerButton); + userEvent.click(await findByText('Clear')); + userEvent.click(getByText('Save')); + + await waitFor(() => + expect(mutationSpy).toHaveGraphqlOperation('UpdateContactPartnership', { + attributes: { + pledgeStartDate: null, + }, + }), + ); + }); + it('should handle editing newsletter', async () => { const { getByRole } = render(); diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx index 6efe37fe0..7b40dc5ab 100644 --- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx +++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx @@ -137,7 +137,7 @@ export const EditPartnershipInfoModal: React.FC< accountListId: accountListId ?? '', attributes: { ...attributes, - pledgeStartDate: attributes.pledgeStartDate?.toISODate(), + pledgeStartDate: attributes.pledgeStartDate?.toISODate() ?? null, nextAsk: attributes.nextAsk?.toISODate() ?? null, primaryPersonId: attributes.primaryPersonId, },