Skip to content

Commit

Permalink
52465 VA Request Flow - Alerts for invalid input/selection (#28456)
Browse files Browse the repository at this point in the history
* update date selection error message

* update reason for appointment error messages

* update type of visit error message

* update contact info error messages
  • Loading branch information
vbahinwillit authored and wullaski committed Mar 14, 2024
1 parent a137e83 commit 980f9ad
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function validateLength(errors, email) {

if (email && email?.length > MAX_LENGTH) {
errors.addError(
`We do not support email addresses that exceeds ${MAX_LENGTH} characters`,
`We don’t support email addresses that exceeds ${MAX_LENGTH} characters`,
);
}
}
Expand Down Expand Up @@ -148,8 +148,8 @@ export default function ContactInfoPage({ changeCrumb }) {
...phoneConfig,
'ui:errorMessages': {
...phoneConfig['ui:errorMessages'],
pattern:
'Please enter a valid 10-digit phone number (with or without dashes)',
required: 'Enter a phone number',
pattern: 'Enter a valid 10-digit phone number (with or without dashes)',
},
},
bestTimeToCall: {
Expand Down Expand Up @@ -186,7 +186,8 @@ export default function ContactInfoPage({ changeCrumb }) {
email: {
'ui:title': 'Your email address',
'ui:errorMessages': {
required: 'Please enter an email address',
format: 'Enter a valid email address',
required: 'Enter an email address',
},
'ui:validations': [validateLength],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function VARequest({ changeCrumb }) {
renderOptions={props => <DateTimeRequestOptions {...props} />}
renderSelectedLabel={getSelectedLabel}
required
requiredMessage="Please select at least one preferred date for your appointment. You can select up to three dates."
requiredMessage="Select at least 1 preferred timeframe for your appointment."
showValidation={submitted && !userSelectedSlot(selectedDates)}
/>
<FormButtons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ const uiSchema = {
reasonForAppointment: {
'ui:widget': 'radio',
'ui:title': 'Let us know why you’re making this appointment.',
'ui:errorMessages': {
required: 'Select a reason for your appointment',
},
},
reasonAdditionalInfo: {
'ui:widget': TextareaWidget,
'ui:options': {
rows: 5,
},
'ui:validations': [validComment],
'ui:errorMessages': {
required:
'Provide more details about why you are requesting this appointment',
},
},
},
cc: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const uiSchema = {
'ui:widget': 'radio',
'ui:title':
'Please let us know how you would like to be seen for this appointment.',
'ui:errorMessages': {
required: 'Select an option',
},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('VAOS Page: ContactInfoPage', () => {
expect(screen.history.push.called).to.be.false;

expect(await screen.findByRole('alert')).to.contain.text(
'We do not support email addresses that exceeds 50 characters',
'We don’t support email addresses that exceeds 50 characters',
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('VAOS Page: ReasonForAppointmentPage', () => {
fireEvent.click(screen.getByText(/Continue/));

const alerts = await screen.findAllByRole('alert');
expect(alerts[0]).to.contain.text('Please provide a response');
expect(alerts[0]).to.contain.text('Select a reason for your appointment');
});

it('should show error msg when enter all spaces for VA medical request', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('VAOS Page: TypeOfVisitPage ', () => {

fireEvent.click(screen.getByText(/Continue/));

expect(await screen.findByText('Please provide a response')).to.exist;
expect(await screen.findByText('Select an option')).to.exist;
expect(screen.history.push.called).to.not.be.true;
});

Expand Down

0 comments on commit 980f9ad

Please sign in to comment.