build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('ChangePasswordDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChangePasswordDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ChangePasswordDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { PasswordsUtility } from 'app/core/utils/passwords-utility';
|
||||
styleUrls: ['./change-password-dialog.component.scss']
|
||||
})
|
||||
export class ChangePasswordDialogComponent implements OnInit {
|
||||
|
||||
/** Change Password Form */
|
||||
changePasswordForm: any;
|
||||
|
||||
@@ -22,10 +21,12 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides any data.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ChangePasswordDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private passwordsUtility: PasswordsUtility) { }
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ChangePasswordDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private passwordsUtility: PasswordsUtility
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.createChangePasswordForm();
|
||||
@@ -34,8 +35,16 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
/** Change Password form */
|
||||
createChangePasswordForm() {
|
||||
this.changePasswordForm = this.formBuilder.group({
|
||||
'password': ['', this.passwordsUtility.getPasswordValidators()],
|
||||
'repeatPassword': ['', [Validators.required, this.confirmPassword('password')]]
|
||||
password: [
|
||||
'',
|
||||
this.passwordsUtility.getPasswordValidators()
|
||||
],
|
||||
repeatPassword: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
this.confirmPassword('password')]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,19 +53,18 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
* @param controlNameToCompare Form Control Name to be compared.
|
||||
*/
|
||||
confirmPassword(controlNameToCompare: string): ValidatorFn {
|
||||
return (c: AbstractControl): ValidationErrors|null => {
|
||||
if (c.value == null || c.value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const controlToCompare = c.root.get(controlNameToCompare);
|
||||
if (controlToCompare) {
|
||||
const subscription: Subscription = controlToCompare.valueChanges.subscribe(() => {
|
||||
c.updateValueAndValidity();
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
return controlToCompare && controlToCompare.value !== c.value ? {'notequal': true} : null;
|
||||
return (c: AbstractControl): ValidationErrors | null => {
|
||||
if (c.value == null || c.value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const controlToCompare = c.root.get(controlNameToCompare);
|
||||
if (controlToCompare) {
|
||||
const subscription: Subscription = controlToCompare.valueChanges.subscribe(() => {
|
||||
c.updateValueAndValidity();
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
return controlToCompare && controlToCompare.value !== c.value ? { notequal: true } : null;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user