Commits

Yury Bondarenko authored 0690a201dc2
ESLint: fix indentation
No tags

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Modified
105 105 return createSuccessfulRemoteDataObject$(ePerson);
106 106 },
107 107 getEPersonByEmail(email): Observable<RemoteData<EPerson>> {
108 108 return createSuccessfulRemoteDataObject$(null);
109 109 }
110 110 };
111 111 builderService = Object.assign(getMockFormBuilderService(),{
112 112 createFormGroup(formModel, options = null) {
113 113 const controls = {};
114 114 formModel.forEach( model => {
115 - model.parent = parent;
116 - const controlModel = model;
117 - const controlState = { value: controlModel.value, disabled: controlModel.disabled };
118 - const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
119 - controls[model.id] = new UntypedFormControl(controlState, controlOptions);
115 + model.parent = parent;
116 + const controlModel = model;
117 + const controlState = { value: controlModel.value, disabled: controlModel.disabled };
118 + const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
119 + controls[model.id] = new UntypedFormControl(controlState, controlOptions);
120 120 });
121 121 return new UntypedFormGroup(controls, options);
122 122 },
123 123 createAbstractControlOptions(validatorsConfig = null, asyncValidatorsConfig = null, updateOn = null) {
124 124 return {
125 - validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
125 + validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
126 126 };
127 127 },
128 128 getValidators(validatorsConfig) {
129 - return this.getValidatorFns(validatorsConfig);
129 + return this.getValidatorFns(validatorsConfig);
130 130 },
131 131 getValidatorFns(validatorsConfig, validatorsToken = this._NG_VALIDATORS) {
132 132 let validatorFns = [];
133 133 if (this.isObject(validatorsConfig)) {
134 - validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
135 - const validatorConfigValue = validatorsConfig[validatorConfigKey];
136 - if (this.isValidatorDescriptor(validatorConfigValue)) {
137 - const descriptor = validatorConfigValue;
138 - return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
139 - }
140 - return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
141 - });
134 + validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
135 + const validatorConfigValue = validatorsConfig[validatorConfigKey];
136 + if (this.isValidatorDescriptor(validatorConfigValue)) {
137 + const descriptor = validatorConfigValue;
138 + return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
139 + }
140 + return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
141 + });
142 142 }
143 143 return validatorFns;
144 144 },
145 145 getValidatorFn(validatorName, validatorArgs = null, validatorsToken = this._NG_VALIDATORS) {
146 146 let validatorFn;
147 147 if (Validators.hasOwnProperty(validatorName)) { // Built-in Angular Validators
148 - validatorFn = Validators[validatorName];
148 + validatorFn = Validators[validatorName];
149 149 } else { // Custom Validators
150 - if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
151 - validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
152 - } else if (validatorsToken) {
153 - validatorFn = validatorsToken.find(validator => validator.name === validatorName);
154 - }
150 + if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
151 + validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
152 + } else if (validatorsToken) {
153 + validatorFn = validatorsToken.find(validator => validator.name === validatorName);
154 + }
155 155 }
156 156 if (validatorFn === undefined) { // throw when no validator could be resolved
157 - throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
157 + throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
158 158 }
159 159 if (validatorArgs !== null) {
160 - return validatorFn(validatorArgs);
160 + return validatorFn(validatorArgs);
161 161 }
162 162 return validatorFn;
163 - },
163 + },
164 164 isValidatorDescriptor(value) {
165 - if (this.isObject(value)) {
166 - return value.hasOwnProperty('name') && value.hasOwnProperty('args');
167 - }
168 - return false;
165 + if (this.isObject(value)) {
166 + return value.hasOwnProperty('name') && value.hasOwnProperty('args');
167 + }
168 + return false;
169 169 },
170 170 isObject(value) {
171 171 return typeof value === 'object' && value !== null;
172 172 }
173 173 });
174 174 authService = new AuthServiceStub();
175 175 authorizationService = jasmine.createSpyObj('authorizationService', {
176 176 isAuthorized: observableOf(true),
177 177
178 178 });

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut