Fix optional fields issue. (#152)
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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(<IntlRegistrationPage {...props} />));
|
||||
|
||||
Reference in New Issue
Block a user