diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdate.test.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdate.test.jsx
index 568902243d6..936cebbb572 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdate.test.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdate.test.jsx
@@ -25,6 +25,11 @@ const routingParams = {
moveCodeOrID: moveId,
shipmentId,
};
+const ppmRoutingParams = {
+ moveCode,
+ moveCodeOrID: moveId,
+ shipmentId: ppmShipmentId,
+};
jest.mock('services/primeApi', () => ({
...jest.requireActual('services/primeApi'),
@@ -293,6 +298,230 @@ const approvedMoveTaskOrder = {
},
};
+const approvedPPMMoveTaskOrder = {
+ moveTaskOrder: {
+ availableToPrimeAt: '2021-10-18T18:24:41.235Z',
+ createdAt: '2021-10-18T18:24:41.362Z',
+ diversion: false,
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNjIxNjRa',
+ excessWeightAcknowledgedAt: null,
+ excessWeightQualifiedAt: null,
+ excessWeightUploadId: null,
+ id: '9c7b255c-2981-4bf8-839f-61c7458e2b4d',
+ moveCode: 'LR4T8V',
+ mtoShipments: [
+ {
+ actualPickupDate: null,
+ approvedDate: null,
+ counselorRemarks: 'These are counselor remarks for a PPM.',
+ createdAt: '2022-07-01T13:41:33.261Z',
+ destinationAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ eTag: 'MjAyMi0wNy0wMVQxNDoyMzoxOS43MzgzODla',
+ firstAvailableDeliveryDate: null,
+ id: '1b695b60-c3ed-401b-b2e3-808d095eb8cc',
+ moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d',
+ pickupAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ ppmShipment: {
+ actualDestinationPostalCode: '30814',
+ actualMoveDate: '2022-07-13',
+ actualPickupPostalCode: '90212',
+ advanceAmountReceived: 598600,
+ advanceAmountRequested: 598700,
+ approvedAt: '2022-07-03T14:20:21.620Z',
+ createdAt: '2022-06-30T13:41:33.265Z',
+ eTag: 'MjAyMi0wNy0wMVQxNDoyMzoxOS43ODA1Mlo=',
+ estimatedIncentive: 1000000,
+ estimatedWeight: 4000,
+ expectedDepartureDate: '2020-03-15',
+ hasProGear: true,
+ hasReceivedAdvance: true,
+ hasRequestedAdvance: true,
+ id: 'd733fe2f-b08d-434a-ad8d-551f4d597b03',
+ proGearWeight: 1987,
+ reviewedAt: '2022-07-02T14:20:14.636Z',
+ shipmentId: '1b695b60-c3ed-401b-b2e3-808d095eb8cc',
+ sitEstimatedCost: 123456,
+ sitEstimatedDepartureDate: '2022-07-13',
+ sitEstimatedEntryDate: '2022-07-05',
+ sitEstimatedWeight: 1100,
+ sitExpected: true,
+ sitLocation: 'DESTINATION',
+ spouseProGearWeight: 498,
+ status: 'SUBMITTED',
+ submittedAt: '2022-07-01T13:41:33.252Z',
+ updatedAt: '2022-07-01T14:23:19.780Z',
+ pickupAddress: {
+ city: 'Beverly Hills',
+ county: 'Los Angeles',
+ country: 'US',
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNjc3Mjda',
+ id: 'cf159eca-162c-4131-84a0-795e684416a6',
+ postalCode: '90210',
+ state: 'CA',
+ streetAddress1: '123 Any Street',
+ streetAddress2: 'P.O. Box 12345',
+ streetAddress3: 'c/o Some Person',
+ },
+ destinationAddress: {
+ city: 'Fairfield',
+ county: 'Solano',
+ country: 'US',
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNzI3NDJa',
+ id: 'bfe61147-5fd7-426e-b473-54ccf77bde35',
+ postalCode: '94535',
+ state: 'CO',
+ streetAddress1: '987 Any Avenue',
+ streetAddress2: 'P.O. Box 9876',
+ streetAddress3: 'c/o Some Person',
+ },
+ secondaryDeliveryAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ secondaryPickupAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ tertiaryDeliveryAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ tertiaryPickupAddress: {
+ city: null,
+ postalCode: null,
+ state: null,
+ streetAddress1: null,
+ },
+ },
+ primeEstimatedWeightRecordedDate: null,
+ requestedPickupDate: null,
+ requiredDeliveryDate: null,
+ scheduledPickupDate: null,
+ shipmentType: 'PPM',
+ status: 'APPROVED',
+ updatedAt: '2022-07-01T14:23:19.738Z',
+ mtoServiceItems: [],
+ },
+ ],
+ order: {
+ customer: {
+ branch: 'AIR_FORCE',
+ dodID: '5917531070',
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4xNDIxNTZa',
+ email: 'leo_spaceman_sm@example.com',
+ firstName: 'Leo',
+ id: 'e2de409b-edb9-42af-b50f-564458e08ada',
+ lastName: 'Spacemen',
+ phone: '555-555-5555',
+ userID: 'ae204f8a-6222-45a1-9b79-e2d52441b4f2',
+ },
+ customerID: 'e2de409b-edb9-42af-b50f-564458e08ada',
+ destinationDutyLocation: {
+ address: {
+ city: 'Augusta',
+ country: 'United States',
+ eTag: 'MjAyMS0xMC0xOFQxODoyMzoxMi4zMTQzNDZa',
+ id: '5ac95be8-0230-47ea-90b4-b0f6f60de364',
+ postalCode: '30813',
+ state: 'GA',
+ streetAddress1: 'Fort Gordon',
+ },
+ addressID: '5ac95be8-0230-47ea-90b4-b0f6f60de364',
+ id: '2d5ada83-e09a-47f8-8de6-83ec51694a86',
+ name: 'Fort Gordon',
+ },
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4yMzAxMVo=',
+ entitlement: {
+ authorizedWeight: 8000,
+ dependentsAuthorized: true,
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4xNzc0MjZa',
+ id: '46ee60c2-9b17-44c7-9202-15a84327fc2f',
+ nonTemporaryStorage: true,
+ organizationalClothingAndIndividualEquipment: true,
+ privatelyOwnedVehicle: true,
+ proGearWeight: 2000,
+ proGearWeightSpouse: 500,
+ requiredMedicalEquipmentWeight: 1000,
+ storageInTransit: 2,
+ totalDependents: 1,
+ totalWeight: 5000,
+ },
+ id: '8cda4825-283c-4910-89f4-1741e2fd9cb7',
+ linesOfAccounting: 'F8E1',
+ orderNumber: 'ORDER3',
+ originDutyLocation: {
+ address: {
+ city: 'Des Moines',
+ country: 'US',
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4yMDgyNjha',
+ id: 'dbbee525-9c88-40c1-a549-6330b35972d2',
+ postalCode: '50309',
+ state: 'IA',
+ streetAddress1: '987 Other Avenue',
+ streetAddress2: 'P.O. Box 1234',
+ streetAddress3: 'c/o Another Person',
+ },
+ addressID: 'dbbee525-9c88-40c1-a549-6330b35972d2',
+ id: '0ecd8fb1-0551-44c8-a15e-83c5f4e3ae0f',
+ name: 'XOXhgDSIRS',
+ },
+ reportByDate: '2018-08-01',
+ },
+ orderID: '8cda4825-283c-4910-89f4-1741e2fd9cb7',
+ paymentRequests: [
+ {
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS41Nzc2OTha',
+ id: '532ec513-8297-44b3-91a8-5167650b2869',
+ isFinal: false,
+ moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d',
+ paymentRequestNumber: '3301-9920-1',
+ paymentServiceItems: [
+ {
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS42Mzc5MzJa',
+ id: '8fdf0b3a-c102-4084-84fe-22903f20470b',
+ mtoServiceItemID: '8829fb28-69c1-45d7-98bc-c724478d5106',
+ paymentRequestID: '532ec513-8297-44b3-91a8-5167650b2869',
+ referenceID: '3301-9920-8fdf0b3a',
+ status: 'REQUESTED',
+ },
+ ],
+ status: 'PENDING',
+ },
+ ],
+ ppmType: 'PARTIAL',
+ referenceId: '3301-9920',
+ updatedAt: '2021-10-18T18:24:41.362Z',
+ mtoServiceItems: [
+ {
+ reServiceCode: 'STEST',
+ eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS41MzE0NjRa',
+ id: '8829fb28-69c1-45d7-98bc-c724478d5106',
+ modelType: 'MTOServiceItemBasic',
+ moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d',
+ mtoShipmentID: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee',
+ reServiceName: 'Test Service',
+ status: 'APPROVED',
+ },
+ ],
+ },
+};
+
const approvedMoveTaskOrderWithOneHHG = {
moveTaskOrder: {
availableToPrimeAt: '2021-10-18T18:24:41.235Z',
@@ -487,6 +716,12 @@ const mockedComponent = (
);
+const mockedPPMComponent = (
+
+
+
+);
+
const readyReturnValue = {
...approvedMoveTaskOrder,
isLoading: false,
@@ -500,6 +735,13 @@ const readyReturnValueWithOneHHG = {
isSuccess: true,
};
+const readyPPMReturnValue = {
+ ...approvedPPMMoveTaskOrder,
+ isLoading: false,
+ isError: false,
+ isSuccess: true,
+};
+
const loadingReturnValue = {
...approvedMoveTaskOrder,
isLoading: true,
@@ -611,6 +853,24 @@ expect(
expect(await screen.findByRole('button', { name: 'Save' })).toBeEnabled();
expect(screen.getByText(/123 Any Street/)).toBeInTheDocument();
});
+
+ // Tested here rather than on the form because this component parses the data.
+ // Tests on the form were missing a parsing issue since they were passed fully formed test data.
+ it('displays all location lookup values', async () => {
+ usePrimeSimulatorGetMove.mockReturnValue(readyPPMReturnValue);
+
+ render(mockedPPMComponent);
+
+ expect(screen.getByText(/Beverly Hills/)).toBeInTheDocument();
+ expect(screen.getByText(/CA/)).toBeInTheDocument();
+ expect(screen.getByText(/Los Angeles/)).toBeInTheDocument();
+ expect(screen.getByText(/90210/)).toBeInTheDocument();
+
+ expect(screen.getByText(/Fairfield/)).toBeInTheDocument();
+ expect(screen.getByText(/CO/)).toBeInTheDocument();
+ expect(screen.getByText(/Solano/)).toBeInTheDocument();
+ expect(screen.getByText(/94535/)).toBeInTheDocument();
+ });
});
describe('successful submission of form', () => {
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.jsx
index 0d234eb1136..7c3c186b45e 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.jsx
@@ -88,7 +88,8 @@ const PrimeUIShipmentUpdateAddress = () => {
if (isError) return
;
const onSubmit = (values, { setSubmitting }) => {
- const { streetAddress1, streetAddress2, streetAddress3, city, state, postalCode } = values.address;
+ const { streetAddress1, streetAddress2, streetAddress3, city, county, state, postalCode, usPostRegionCitiesID } =
+ values.address;
const body = {
id: values.addressID,
@@ -96,8 +97,10 @@ const PrimeUIShipmentUpdateAddress = () => {
streetAddress2,
streetAddress3,
city,
+ county,
state,
postalCode,
+ usPostRegionCitiesID,
};
// Check if the address payload contains any blank properties and remove
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.test.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.test.jsx
index ed9eee256f3..a0fc67898d4 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.test.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddress.test.jsx
@@ -54,6 +54,7 @@ const moveTaskOrder = {
streetAddress1: '800 Madison Avenue',
city: 'New York',
state: 'NY',
+ county: 'New York',
postalCode: '10002',
},
destinationAddress: {
@@ -61,6 +62,7 @@ const moveTaskOrder = {
streetAddress1: '100 1st Avenue',
city: 'New York',
state: 'NY',
+ county: 'New York',
postalCode: '10001',
},
},
@@ -134,9 +136,15 @@ describe('PrimeUIShipmentUpdateAddress page', () => {
await waitFor(() => {
expect(screen.getAllByLabelText('Address 1')[0]).toHaveValue(shipment.pickupAddress.streetAddress1);
expect(screen.getAllByLabelText(/Address 2/)[0]).toHaveValue('');
- expect(screen.getAllByLabelText('City')[0]).toHaveValue(shipment.pickupAddress.city);
- expect(screen.getAllByLabelText('State')[0]).toHaveValue(shipment.pickupAddress.state);
- expect(screen.getAllByLabelText('ZIP')[0]).toHaveValue(shipment.pickupAddress.postalCode);
+ expect(screen.getAllByLabelText(/Address 3/)[0]).toHaveValue('');
+ expect(screen.getAllByText('City')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.pickupAddress.city)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('State')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.pickupAddress.state)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('County')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.pickupAddress.county)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('ZIP')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.pickupAddress.postalCode)[0]).toBeInTheDocument();
});
});
});
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.jsx
index ec188502922..75098a7af9d 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.jsx
@@ -29,25 +29,27 @@ const PrimeUIShipmentUpdateAddressForm = ({
return (
- {({ isValid, isSubmitting, handleSubmit, errors }) => (
-
- )}
+ {({ isValid, isSubmitting, handleSubmit, errors, ...formikProps }) => {
+ return (
+
+ );
+ }}
);
};
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.test.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.test.jsx
index 6d6f433142c..fc01df2ea5e 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.test.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateAddressForm.test.jsx
@@ -82,12 +82,14 @@ describe('PrimeUIShipmentUpdateAddressForm', () => {
expect(screen.getByLabelText(/Address 1/)).toBeInTheDocument();
expect(screen.getByLabelText(/Address 2/)).toBeInTheDocument();
expect(screen.getByLabelText(/Address 3/)).toBeInTheDocument();
- expect(screen.getByLabelText('City')).toBeInTheDocument();
- expect(screen.getByLabelText('City')).toHaveValue(shipmentAddress.city);
- expect(screen.getByLabelText('State')).toBeInTheDocument();
- expect(screen.getByLabelText('State')).toHaveValue(shipmentAddress.state);
- expect(screen.getByLabelText('ZIP')).toBeInTheDocument();
- expect(screen.getByLabelText('ZIP')).toHaveValue(shipmentAddress.postalCode);
+ expect(screen.getByText('City')).toBeInTheDocument();
+ expect(screen.getByText(shipmentAddress.city)).toBeInTheDocument();
+ expect(screen.getByText('State')).toBeInTheDocument();
+ expect(screen.getByText(shipmentAddress.state)).toBeInTheDocument();
+ expect(screen.getByText('County')).toBeInTheDocument();
+ expect(screen.getByText(shipmentAddress.county)).toBeInTheDocument();
+ expect(screen.getByText('ZIP')).toBeInTheDocument();
+ expect(screen.getByText(shipmentAddress.postalCode)).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Save' })).toBeEnabled();
});
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.jsx
index fc479853ab8..8bd474dc9d5 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.jsx
@@ -87,8 +87,10 @@ const PrimeUIShipmentUpdateDestinationAddress = () => {
streetAddress2: newAddress.address.streetAddress2,
streetAddress3: newAddress.address.streetAddress3,
city: newAddress.address.city,
+ county: newAddress.address.county,
state: newAddress.address.state,
postalCode: newAddress.address.postalCode,
+ usPostRegionCitiesID: newAddress.address.usPostRegionCitiesID,
},
contractorRemarks: values.contractorRemarks,
};
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.test.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.test.jsx
index 9e0c7c7a417..7c41a95769f 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.test.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddress.test.jsx
@@ -87,6 +87,7 @@ const testShipmentReturnValue = {
streetAddress1: '100 1st Avenue',
city: 'New York',
state: 'NY',
+ county: 'New York',
postalCode: '10001',
},
},
@@ -161,9 +162,17 @@ describe('PrimeUIShipmentUpdateAddress page', () => {
expect(screen.getAllByLabelText('Address 1').length).toBe(1);
expect(screen.getAllByLabelText('Address 1')[0]).toHaveValue(shipment.destinationAddress.streetAddress1);
expect(screen.getAllByLabelText(/Address 2/)[0]).toHaveValue('');
- expect(screen.getAllByLabelText('City')[0]).toHaveValue(shipment.destinationAddress.city);
- expect(screen.getAllByLabelText('State')[0]).toHaveValue(shipment.destinationAddress.state);
- expect(screen.getAllByLabelText('ZIP')[0]).toHaveValue(shipment.destinationAddress.postalCode);
+ expect(screen.getAllByLabelText(/Address 3/)[0]).toBeInTheDocument();
+
+ expect(screen.getAllByText('City')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.destinationAddress.city)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('State')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.destinationAddress.state)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('County')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.destinationAddress.county)[0]).toBeInTheDocument();
+ expect(screen.getAllByText('ZIP')[0]).toBeInTheDocument();
+ expect(screen.getAllByText(shipment.destinationAddress.postalCode)[0]).toBeInTheDocument();
+
expect(screen.getAllByLabelText('Contractor Remarks')[0]).toHaveValue('');
});
});
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.jsx
index 5ad4224990d..f4176cb68b3 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.jsx
@@ -27,50 +27,52 @@ const PrimeUIShipmentUpdateDestinationAddressForm = ({
return (
- {({ isValid, isSubmitting, handleSubmit, errors }) => (
-
- )}
+
+
+
+ );
+ }}
);
};
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.test.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.test.jsx
index c2ca0496a7e..19dc8fb5b2e 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.test.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateDestinationAddressForm.test.jsx
@@ -23,8 +23,9 @@ describe('PrimeUIShipmentUpdateDestinationAddressForm', () => {
id: 'c56a4180-65aa-42ec-a945-5fd21dec0538',
streetAddress1: '444 Main Ave',
streetAddress2: 'Apartment 9000',
- streetAddress3: '',
+ streetAddress3: 'J. Jonah Jameson',
city: 'Anytown',
+ county: 'SOLANO',
state: 'AL',
postalCode: '90210',
country: 'USA',
@@ -72,9 +73,15 @@ describe('PrimeUIShipmentUpdateDestinationAddressForm', () => {
);
expect(screen.getByLabelText(/Address 1/)).toBeInTheDocument();
expect(screen.getByLabelText(/Address 2/)).toBeInTheDocument();
- expect(screen.getByLabelText('City')).toBeInTheDocument();
- expect(screen.getByLabelText('State')).toBeInTheDocument();
- expect(screen.getByLabelText('ZIP')).toBeInTheDocument();
+ expect(screen.getByLabelText(/Address 3/)).toBeInTheDocument();
+ expect(screen.getByText('City')).toBeInTheDocument();
+ expect(screen.getByText(initialValuesDestinationAddress.newAddress.address.city)).toBeInTheDocument();
+ expect(screen.getByText('State')).toBeInTheDocument();
+ expect(screen.getByText(initialValuesDestinationAddress.newAddress.address.state)).toBeInTheDocument();
+ expect(screen.getByText('County')).toBeInTheDocument();
+ expect(screen.getByText(initialValuesDestinationAddress.newAddress.address.county)).toBeInTheDocument();
+ expect(screen.getByText('ZIP')).toBeInTheDocument();
+ expect(screen.getByText(initialValuesDestinationAddress.newAddress.address.postalCode)).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Save' })).toBeEnabled();
});
@@ -89,10 +96,8 @@ describe('PrimeUIShipmentUpdateDestinationAddressForm', () => {
);
await userEvent.type(screen.getByLabelText(/Address 1/), '23 City Str');
- await userEvent.type(screen.getByLabelText('City'), 'City');
- await userEvent.clear(screen.getByLabelText('ZIP'));
- await userEvent.type(screen.getByLabelText('ZIP'), '90210');
- await userEvent.selectOptions(screen.getByLabelText('State'), ['CA']);
+ await userEvent.type(screen.getByLabelText(/Address 2/), 'Apt 23');
+ await userEvent.type(screen.getByLabelText(/Address 3/), 'C/O Twenty Three');
await userEvent.type(screen.getByLabelText('Contractor Remarks'), 'Test remarks');
const submitBtn = screen.getByRole('button', { name: 'Save' });
@@ -102,23 +107,6 @@ describe('PrimeUIShipmentUpdateDestinationAddressForm', () => {
await userEvent.click(submitBtn);
});
- it('disables the submit button when the zip is bad', async () => {
- renderWithProviders(
-
,
- );
- await userEvent.clear(screen.getByLabelText('ZIP'));
- await userEvent.type(screen.getByLabelText('ZIP'), '1');
- (await screen.getByLabelText('ZIP')).blur();
- await waitFor(() => {
- expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled();
- });
- });
-
it('disables the submit button when the address 1 is missing', async () => {
renderWithProviders(
{
});
});
- it('disables the submit button when city is missing', async () => {
+ it('does not disable the submit button when address lines 2 or 3 are blank', async () => {
renderWithProviders(
{
name="newAddress.address"
/>,
);
- await userEvent.clear(screen.getByLabelText('City'));
- (await screen.getByLabelText('City')).blur();
+
+ await userEvent.clear(screen.getByLabelText(/Address 3/));
+ (await screen.getByLabelText(/Address 3/)).blur();
await waitFor(() => {
- expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled();
- expect(screen.getByText('Required')).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Save' }).getAttribute('disabled')).toBeFalsy();
+ });
+
+ await userEvent.clear(screen.getByLabelText(/Address 2/));
+ (await screen.getByLabelText(/Address 2/)).blur();
+ await waitFor(() => {
+ expect(screen.getByRole('button', { name: 'Save' }).getAttribute('disabled')).toBeFalsy();
});
});
});
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateForm.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateForm.jsx
index 080aa08c5ce..f05611aebe0 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateForm.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdateForm.jsx
@@ -46,6 +46,7 @@ const PrimeUIShipmentUpdateForm = ({
secondaryDeliveryAddress,
tertiaryDeliveryAddress,
shipmentType,
+ formikProps,
}) => {
const isNTS = shipmentType === SHIPMENT_OPTIONS.NTS;
const isNTSR = shipmentType === SHIPMENT_OPTIONS.NTSR;
@@ -150,28 +151,38 @@ const PrimeUIShipmentUpdateForm = ({
)}
Shipment Addresses
Pickup Address
- {editablePickupAddress && }
+ {editablePickupAddress && }
{!editablePickupAddress && formatAddress(pickupAddress)}
{!isNTSR && (
<>
Second Pickup Address
- {editableSecondaryPickupAddress && }
+ {editableSecondaryPickupAddress && (
+
+ )}
{!editableSecondaryPickupAddress && formatAddress(secondaryPickupAddress)}
Third Pickup Address
- {editableTertiaryPickupAddress && }
+ {editableTertiaryPickupAddress && (
+
+ )}
{!editableTertiaryPickupAddress && formatAddress(tertiaryPickupAddress)}
>
)}
Delivery Address
- {editableDestinationAddress && }
+ {editableDestinationAddress && (
+
+ )}
{!editableDestinationAddress && formatAddress(destinationAddress)}
{!isNTS && (
<>
Second Delivery Address
- {editableSecondaryDeliveryAddress && }
+ {editableSecondaryDeliveryAddress && (
+
+ )}
{!editableSecondaryDeliveryAddress && formatAddress(secondaryDeliveryAddress)}
Third Delivery Address
- {editableTertiaryDeliveryAddress && }
+ {editableTertiaryDeliveryAddress && (
+
+ )}
{!editableTertiaryDeliveryAddress && formatAddress(tertiaryDeliveryAddress)}
>
)}
@@ -199,6 +210,7 @@ PrimeUIShipmentUpdateForm.propTypes = {
actualSpouseProGearWeight: PropTypes.string,
pickupAddress: ResidentialAddressShape,
destinationAddress: ResidentialAddressShape,
+ formikProps: PropTypes.object.isRequired,
};
PrimeUIShipmentUpdateForm.defaultProps = {
diff --git a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdatePPMForm.jsx b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdatePPMForm.jsx
index daf02c6b903..3955c36bd71 100644
--- a/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdatePPMForm.jsx
+++ b/src/pages/PrimeUI/Shipment/PrimeUIShipmentUpdatePPMForm.jsx
@@ -14,7 +14,7 @@ import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextFi
const sitLocationOptions = dropdownInputOptions(LOCATION_TYPES);
const PrimeUIShipmentUpdatePPMForm = () => {
- const { values } = useFormikContext();
+ const { values, setFieldTouched, setFieldValue } = useFormikContext();
const {
sitExpected,
hasProGear,
@@ -36,6 +36,11 @@ const PrimeUIShipmentUpdatePPMForm = () => {
(
<>
What address are the movers picking up from?
@@ -71,7 +76,14 @@ const PrimeUIShipmentUpdatePPMForm = () => {
{hasSecondaryPickupAddress === 'true' && (
<>
-
+
Third Pickup Address
@@ -101,7 +113,16 @@ const PrimeUIShipmentUpdatePPMForm = () => {
/>