diff --git a/.env.development b/.env.development index 160cec0f..0ef4d64d 100644 --- a/.env.development +++ b/.env.development @@ -23,4 +23,4 @@ AUTHN_MINIMAL_HEADER=true LOGIN_ISSUE_SUPPORT_LINK='' TOS_AND_HONOR_CODE='http://localhost:18000/honor' PRIVACY_POLICY='http://localhost:18000/privacy' -REGISTRATION_OPTIONAL_FIELDS='gender goals level_of_education year_of_birth' +REGISTRATION_OPTIONAL_FIELDS='gender,goals,level_of_education,year_of_birth' diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 0791ee64..911c1a50 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -122,7 +122,7 @@ class RegistrationPage extends React.Component { getOptionalFields() { const values = {}; - const optionalFields = getConfig().REGISTRATION_OPTIONAL_FIELDS.split(' '); + const optionalFields = getConfig().REGISTRATION_OPTIONAL_FIELDS.split(','); optionalFields.forEach((key) => { values[camelCase(key)] = this.state[camelCase(key)]; }); @@ -171,7 +171,7 @@ class RegistrationPage extends React.Component { } // Since optional fields are not validated we can add it to payload after required fields // have been validated. This will save us unwanted calls to validateInput() - const optionalFields = getConfig().REGISTRATION_OPTIONAL_FIELDS.split(' '); + const optionalFields = getConfig().REGISTRATION_OPTIONAL_FIELDS.split(','); optionalFields.forEach((key) => { const stateKey = camelCase(key); if (this.state[stateKey]) { diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx index 13b92f31..7284848f 100644 --- a/src/register/tests/RegistrationPage.test.jsx +++ b/src/register/tests/RegistrationPage.test.jsx @@ -27,7 +27,7 @@ const mockStore = configureStore(); describe('RegistrationPageTests', () => { mergeConfig({ PRIVACY_POLICY: 'http://privacy-policy.com', - REGISTRATION_OPTIONAL_FIELDS: 'gender goals level_of_education year_of_birth', + REGISTRATION_OPTIONAL_FIELDS: 'gender,goals,level_of_education,year_of_birth', TOS_AND_HONOR_CODE: 'http://tos-and-honot-code.com', }); @@ -153,7 +153,7 @@ describe('RegistrationPageTests', () => { expect(registrationPage.find('input#optional').length).toEqual(0); mergeConfig({ - REGISTRATION_OPTIONAL_FIELDS: 'gender goals level_of_education year_of_birth', + REGISTRATION_OPTIONAL_FIELDS: 'gender,goals,level_of_education,year_of_birth', }); registrationPage = mount(reduxWrapper());