Skip to content

Commit

Permalink
Made universal field required field in my premises page
Browse files Browse the repository at this point in the history
Universal field does not follow metafield requirements. Previously my premises page assumed universal field is not required. This change makes universal field always required in my premises page when a resource has universal field defined.
  • Loading branch information
SanttuA committed Mar 19, 2024
1 parent 62a53fb commit e4a8b8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ class ConfirmReservationModal extends Component {
field => camelCase(field)
)];

if (resource.universalField && resource.universalField.length) {
requiredFormFields.push('universalData');
}

if (termsAndConditions) {
requiredFormFields.push('termsAndConditions');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ describe('shared/reservation-confirmation/ConfirmReservationModal', () => {
expect(instance.getRequiredFormFields(
resource, null, reservationType)).toStrictEqual(['field1', 'field2']);
});

test('returns correct array when reservation type is not blocked and resource has universalField', () => {
const reservationType = constants.RESERVATION_TYPE.NORMAL_VALUE;
const resource = Resource.build({
requiredReservationExtraFields: ['field1', 'field2'],
universalField: [UniversalField.build()],
});
const instance = getWrapper({ resource, reservationType }).instance();
expect(instance.getRequiredFormFields(
resource, null, reservationType)).toStrictEqual(['field1', 'field2', 'universalData']);
});
});

/* Field hidden until it is needed again
Expand Down

0 comments on commit e4a8b8d

Please sign in to comment.