From 395cb54bf2846a6b6a4ce097e5a21e58ed600815 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Wed, 11 Dec 2024 06:33:30 -0500 Subject: [PATCH] Allow the next increase ask to be removed from the partner info --- .../EditPartnershipInfoModal.test.tsx | 31 +++++++++++++++++++ .../EditPartnershipInfoModal.tsx | 2 +- 2 files changed, 32 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 9cf922388..c1583f4c8 100644 --- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx +++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx @@ -703,4 +703,35 @@ describe('EditPartnershipInfoModal', () => { ); expect(handleClose).toHaveBeenCalled(); }); + + it('should allow user to remove next ask date', async () => { + const mutationSpy = jest.fn(); + const { getByLabelText, getByText, findByText } = render( + + + + + + + + + , + ); + const datePickerButton = getByLabelText('Next Increase Ask'); + userEvent.click(datePickerButton); + const clearButton = await findByText('Clear'); + userEvent.click(clearButton); + userEvent.click(getByText('Save')); + + await waitFor(() => + expect(mutationSpy).toHaveGraphqlOperation('UpdateContactPartnership', { + attributes: { + nextAsk: null, + }, + }), + ); + }); }); diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx index 8af1ca3a1..6efe37fe0 100644 --- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx +++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.tsx @@ -138,7 +138,7 @@ export const EditPartnershipInfoModal: React.FC< attributes: { ...attributes, pledgeStartDate: attributes.pledgeStartDate?.toISODate(), - nextAsk: attributes.nextAsk?.toISODate(), + nextAsk: attributes.nextAsk?.toISODate() ?? null, primaryPersonId: attributes.primaryPersonId, }, },