Skip to content

Commit

Permalink
add required email for 0845 (#33425)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhasselle-oddball authored Dec 10, 2024
1 parent 4d9d33c commit fb59971
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 22 deletions.
17 changes: 17 additions & 0 deletions src/applications/simple-forms/21-0845/config/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { AUTHORIZER_TYPES, INFORMATION_SCOPES } from '../definitions/constants';
import authorizerTypePg from '../pages/authorizerType';
import veteranPersonalInfoPg from '../pages/veteranPersonalInfo';
import veteranIdInfoPg from '../pages/veteranIdInfo';
import veteranContactInfoPg from '../pages/veteranContactInfo';
import thirdPartyTypePg from '../pages/thirdPartyType';
import personNamePg from '../pages/personName';
import personAddressPg from '../pages/personAddress';
Expand Down Expand Up @@ -60,6 +61,7 @@ const formConfig = {
formId: '21-0845',
dev: {
showNavLinks: !window.Cypress,
collapsibleNavLinks: true,
},
saveInProgress: {
messages: {
Expand Down Expand Up @@ -172,6 +174,21 @@ const formConfig = {
},
},
},
veteranContactInfoChapter: {
title: 'Your contact information',
pages: {
vetContactInfoPage: {
path: 'veteran-contact-information',
title: 'Your contact information',
depends: {
authorizerType: AUTHORIZER_TYPES.VETERAN,
},
uiSchema: veteranContactInfoPg.uiSchema,
schema: veteranContactInfoPg.schema,
scrollAndFocusTarget: pageFocusScroll(),
},
},
},
veteranIdentificationInfoChapter: {
title: ({ formData }) =>
formData?.authorizerType === AUTHORIZER_TYPES.VETERAN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ class IntroductionPage extends React.Component {
prefillEnabled={formConfig.prefillEnabled}
messages={formConfig.savedFormMessages}
pageList={pageList}
devOnly={{
forceShowFormControls: true,
}}
startText="Start your authorization"
unauthStartText="Sign in to start your authorization"
verifiedPrefillAlert={
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
import definitions from 'vets-json-schema/dist/definitions.json';
import {
emailToSendNotificationsSchema,
emailToSendNotificationsUI,
phoneSchema,
phoneUI,
} from 'platform/forms-system/src/js/web-component-patterns';

/** @type {PageSchema} */
export default {
uiSchema: {
authorizerPhone: {
'ui:title': 'Phone number',
'ui:errorMessages': {
required: 'Please enter a phone number.',
pattern:
'Please enter a 10-digit phone number (with or without dashes).',
},
},
authorizerEmail: {
'ui:title': 'Email address',
'ui:widget': 'email',
'ui:errorMessages': {
format:
'Enter a valid email address using the format [email protected]. Your email address can only have letters, numbers, the @ symbol and a period, with no spaces.',
},
},
authorizerPhone: phoneUI(),
authorizerEmail: emailToSendNotificationsUI(),
},
schema: {
type: 'object',
required: ['authorizerPhone'],
required: ['authorizerPhone', 'authorizerEmail'],
properties: {
authorizerPhone: definitions.phone,
authorizerEmail: definitions.email,
authorizerPhone: phoneSchema,
authorizerEmail: emailToSendNotificationsSchema,
},
},
};
22 changes: 22 additions & 0 deletions src/applications/simple-forms/21-0845/pages/veteranContactInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
emailToSendNotificationsSchema,
emailToSendNotificationsUI,
phoneSchema,
phoneUI,
} from 'platform/forms-system/src/js/web-component-patterns';

/** @type {PageSchema} */
export default {
uiSchema: {
veteranPhone: phoneUI(),
veteranEmail: emailToSendNotificationsUI(),
},
schema: {
type: 'object',
required: ['veteranEmail'],
properties: {
veteranPhone: phoneSchema,
veteranEmail: emailToSendNotificationsSchema,
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"postalCode": "12345"
},
"authorizerPhone": "5555555555",
"authorizerEmail": "[email protected]",
"veteranFullName": {
"first": "John",
"middle": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"middle": "",
"last": "Veteran"
},
"veteranEmail": "[email protected]",
"veteranPhone": "5555555555",
"veteranDateOfBirth": "2000-01-01",
"veteranSSN": "111223333",
"thirdPartyType": "person",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
"postalCode": "12345"
},
"authorizerPhone": "5555555555",
"authorizerEmail": "[email protected]",
"veteranFullName": {
"first": "John",
"middle": "",
"last": "Veteran"
},
"veteranEmail": "[email protected]",
"veteranPhone": "5555555555",
"veteranDateOfBirth": "2000-01-01",
"veteranSSN": "111223333",
"thirdPartyType": "organization",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
testNumberOfErrorsOnSubmit,
testNumberOfErrorsOnSubmitForWebComponents,
testNumberOfFields,
testNumberOfWebComponentFields,
} from '../../../shared/tests/pages/pageTests.spec';
import formConfig from '../../config/form';

Expand All @@ -11,7 +13,7 @@ const {

const pageTitle = 'Your contact information';

const expectedNumberOfFields = 2;
const expectedNumberOfFields = 0;
testNumberOfFields(
formConfig,
schema,
Expand All @@ -20,11 +22,29 @@ testNumberOfFields(
pageTitle,
);

const expectedNumberOfErrors = 1;
const expectedNumberOfErrors = 0;
testNumberOfErrorsOnSubmit(
formConfig,
schema,
uiSchema,
expectedNumberOfErrors,
pageTitle,
);

const expectedNumberOfWebComponentFields = 2;
testNumberOfWebComponentFields(
formConfig,
schema,
uiSchema,
expectedNumberOfWebComponentFields,
pageTitle,
);

const expectedNumberOfWebComponentErrors = 2;
testNumberOfErrorsOnSubmitForWebComponents(
formConfig,
schema,
uiSchema,
expectedNumberOfWebComponentErrors,
pageTitle,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
testNumberOfErrorsOnSubmit,
testNumberOfErrorsOnSubmitForWebComponents,
testNumberOfFields,
testNumberOfWebComponentFields,
} from '../../../shared/tests/pages/pageTests.spec';
import formConfig from '../../config/form';

const {
schema,
uiSchema,
} = formConfig.chapters.veteranContactInfoChapter.pages.vetContactInfoPage;

const pageTitle = 'Your contact information';

const expectedNumberOfFields = 0;
testNumberOfFields(
formConfig,
schema,
uiSchema,
expectedNumberOfFields,
pageTitle,
);

const expectedNumberOfErrors = 0;
testNumberOfErrorsOnSubmit(
formConfig,
schema,
uiSchema,
expectedNumberOfErrors,
pageTitle,
);

const expectedNumberOfWebComponentFields = 2;
testNumberOfWebComponentFields(
formConfig,
schema,
uiSchema,
expectedNumberOfWebComponentFields,
pageTitle,
);

const expectedNumberOfWebComponentErrors = 1;
testNumberOfErrorsOnSubmitForWebComponents(
formConfig,
schema,
uiSchema,
expectedNumberOfWebComponentErrors,
pageTitle,
);

0 comments on commit fb59971

Please sign in to comment.