Skip to content

Commit

Permalink
fix: add title to registration form (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless authored Feb 7, 2022
1 parent 9a433e9 commit 3e1d3b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { instance, mock } from 'ts-mockito';
import { AccountFacade } from 'ish-core/facades/account.facade';
import { FeatureToggleModule } from 'ish-core/feature-toggle.module';
import { extractKeys } from 'ish-shared/formly/dev/testing/formly-testing-utils';
import { FormsService } from 'ish-shared/forms/utils/forms.service';

import {
RegistrationConfigType,
Expand All @@ -20,7 +21,10 @@ describe('Registration Form Configuration Service', () => {
accountFacade = mock(AccountFacade);
TestBed.configureTestingModule({
imports: [FeatureToggleModule.forTesting(), RouterTestingModule],
providers: [{ provide: AccountFacade, useFactory: () => instance(accountFacade) }],
providers: [
{ provide: AccountFacade, useFactory: () => instance(accountFacade) },
{ provide: FormsService, useFactory: () => instance(mock(FormsService)) },
],
});
registrationConfigurationService = TestBed.inject(RegistrationFormConfigurationService);
});
Expand All @@ -38,6 +42,7 @@ describe('Registration Form Configuration Service', () => {
"taxationID",
],
Array [
"title",
"firstName",
"lastName",
"phoneHome",
Expand Down Expand Up @@ -70,6 +75,7 @@ describe('Registration Form Configuration Service', () => {
"taxationID",
],
Array [
"title",
"firstName",
"lastName",
"phoneHome",
Expand All @@ -95,6 +101,7 @@ describe('Registration Form Configuration Service', () => {
"passwordConfirmation",
],
Array [
"title",
"firstName",
"lastName",
"phoneHome",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Customer, CustomerRegistrationType } from 'ish-core/models/customer/cus
import { User } from 'ish-core/models/user/user.model';
import { FeatureToggleService } from 'ish-core/utils/feature-toggle/feature-toggle.service';
import { ConfirmLeaveModalComponent } from 'ish-shared/components/registration/confirm-leave-modal/confirm-leave-modal.component';
import { FormsService } from 'ish-shared/forms/utils/forms.service';
import { SpecialValidators } from 'ish-shared/forms/validators/special-validators';

export interface RegistrationConfigType {
Expand All @@ -30,7 +31,8 @@ export class RegistrationFormConfigurationService {
private accountFacade: AccountFacade,
private router: Router,
private modalService: NgbModal,
private featureToggle: FeatureToggleService
private featureToggle: FeatureToggleService,
private formsService: FormsService
) {}

extractConfig(route: ActivatedRouteSnapshot) {
Expand Down Expand Up @@ -301,6 +303,15 @@ export class RegistrationFormConfigurationService {
childClass: 'col-md-10 col-lg-8 col-xl-6',
},
fieldGroup: [
{
key: 'title',
type: 'ish-select-field',
templateOptions: {
label: 'account.default_address.title.label',
placeholder: 'account.option.select.text',
options: this.formsService.getSalutationOptions(),
},
},
{
key: 'firstName',
type: 'ish-text-input-field',
Expand Down

0 comments on commit 3e1d3b0

Please sign in to comment.