diff --git a/src/logistration/RegistrationPage.jsx b/src/logistration/RegistrationPage.jsx index f01837e0..bd0496ed 100644 --- a/src/logistration/RegistrationPage.jsx +++ b/src/logistration/RegistrationPage.jsx @@ -305,7 +305,13 @@ class RegistrationPage extends React.Component { return ( - { nodes } + + { nodes } + ); } @@ -319,7 +325,7 @@ class RegistrationPage extends React.Component { key={field.name} invalid={this.state.errors[stateVar] !== ''} invalidMessage={field.errorMessages.required} - className="custom-control" + className="custom-control mb-0" > {beforeLink} @@ -342,8 +348,9 @@ class RegistrationPage extends React.Component { key={field.name} invalid={this.state.errors[stateVar] !== ''} invalidMessage={field.errorMessages.required} + className="mb-0" > - {field.label} (required) + {field.label} (required) ); @@ -357,7 +364,7 @@ class RegistrationPage extends React.Component { addExtraOptionalFields() { const fields = this.props.formData.fields.map((field) => { let options = null; - let cssClass = null; + let cssClass = 'mb-0'; if (REGISTRATION_EXTRA_FIELDS.includes(field.name)) { if (!field.required && field.name !== 'honor_code' && field.name !== 'country') { REGISTRATION_OPTIONAL_MAP[field.name] = true; @@ -376,11 +383,11 @@ class RegistrationPage extends React.Component { props.options = options; } if (field.name === 'gender') { - cssClass = 'opt-inline-field'; + cssClass += ' opt-inline-field'; } if (field.name === 'year_of_birth') { - cssClass = 'opt-inline-field opt-year-field'; + cssClass += ' opt-inline-field opt-year-field'; } return ( @@ -389,7 +396,7 @@ class RegistrationPage extends React.Component { key={field.name} className={cssClass} > - + {field.label} {this.props.intl.formatMessage(messages['logistration.register.optional.label'])} @@ -484,8 +491,9 @@ class RegistrationPage extends React.Component { for="name" invalid={this.state.errors.name !== ''} invalidMessage={this.state.errors.name} + className="mb-0" > - + {intl.formatMessage(messages['logistration.fullname.label'])} - + {intl.formatMessage(messages['logistration.username.label'])} - + {intl.formatMessage(messages['logistration.register.page.email.label'])} - + {intl.formatMessage(messages['logistration.password.label'])} this.handleOnOptional(e)} required /> - this.handleOnOptional(e)}> + this.handleOnOptional(e)}> {intl.formatMessage(messages['logistration.support.education.research'])} { this.state.enableOptionalField ? this.addExtraOptionalFields() : null} { options: [{ value: '', name: '--' }, { value: 'p', name: 'Doctorate' }], required: false, }, + { + label: 'Year of birth.', + name: 'year_of_birth', + type: 'select', + options: [{ value: '', name: '--' }, { value: '2021', name: '2021' }], + required: false, + }, + { + label: 'Gender.', + name: 'gender', + type: 'select', + options: [{ value: '', name: '--' }, { value: 'f', name: 'Female' }], + required: false, + }, ], }, }, @@ -169,6 +183,8 @@ describe('./RegistrationPage.js', () => { registrationPage.update(); expect(registrationPage.find('textarea#goals').length).toEqual(1); expect(registrationPage.find('select#level_of_education').length).toEqual(1); + expect(registrationPage.find('select#year_of_birth').length).toEqual(1); + expect(registrationPage.find('select#gender').length).toEqual(1); }); it('should dispatch fetchRegistrationForm on ComponentDidMount', () => { diff --git a/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap b/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap index 594227a4..a9c78d8d 100644 --- a/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap +++ b/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap @@ -35,10 +35,10 @@ exports[`./RegistrationPage.js should display no password field when current pro className="mb-4 form-group" > Full Name (required) @@ -57,10 +57,10 @@ exports[`./RegistrationPage.js should display no password field when current pro /> Public Username (required) @@ -79,10 +79,10 @@ exports[`./RegistrationPage.js should display no password field when current pro /> Email (required) @@ -101,7 +101,7 @@ exports[`./RegistrationPage.js should display no password field when current pro /> Full Name (required) @@ -260,10 +261,10 @@ exports[`./RegistrationPage.js should match TPA provider snapshot 1`] = ` /> Public Username (required) @@ -282,10 +283,10 @@ exports[`./RegistrationPage.js should match TPA provider snapshot 1`] = ` /> Email (required) @@ -304,10 +305,10 @@ exports[`./RegistrationPage.js should match TPA provider snapshot 1`] = ` /> Password (required) @@ -326,7 +327,7 @@ exports[`./RegistrationPage.js should match TPA provider snapshot 1`] = ` /> Full Name (required) @@ -445,10 +447,10 @@ exports[`./RegistrationPage.js should match default section snapshot 1`] = ` /> Public Username (required) @@ -467,10 +469,10 @@ exports[`./RegistrationPage.js should match default section snapshot 1`] = ` /> Email (required) @@ -489,10 +491,10 @@ exports[`./RegistrationPage.js should match default section snapshot 1`] = ` /> Password (required) @@ -511,7 +513,7 @@ exports[`./RegistrationPage.js should match default section snapshot 1`] = ` /> Full Name (required) @@ -630,10 +633,10 @@ exports[`./RegistrationPage.js should match pending button state snapshot 1`] = /> Public Username (required) @@ -652,10 +655,10 @@ exports[`./RegistrationPage.js should match pending button state snapshot 1`] = /> Email (required) @@ -674,10 +677,10 @@ exports[`./RegistrationPage.js should match pending button state snapshot 1`] = /> Password (required) @@ -696,7 +699,7 @@ exports[`./RegistrationPage.js should match pending button state snapshot 1`] = /> Full Name (required) @@ -850,10 +854,10 @@ exports[`./RegistrationPage.js should show error message on 409 1`] = ` /> Public Username (required) @@ -872,10 +876,10 @@ exports[`./RegistrationPage.js should show error message on 409 1`] = ` /> Email (required) @@ -894,10 +898,10 @@ exports[`./RegistrationPage.js should show error message on 409 1`] = ` /> Password (required) @@ -916,7 +920,7 @@ exports[`./RegistrationPage.js should show error message on 409 1`] = ` />
this.handleOnOptional(e)}> +
this.handleOnOptional(e)}> {intl.formatMessage(messages['logistration.support.education.research'])}