mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-622] No implicit returns (#5157)
* enable noImplicitReturns rule * type fixes * fix return types * fix return value * fix tests * fix visibility service * update tests * add missing types * fix test
This commit is contained in:
@@ -98,7 +98,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
checkUserAndValidateForm(list, value) {
|
||||
checkUserAndValidateForm(list: UserProcessModel[], value: string): void {
|
||||
const isValidUser = this.isValidUser(list, value);
|
||||
if (isValidUser || value === '') {
|
||||
this.field.validationSummary.message = '';
|
||||
@@ -111,7 +111,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
isValidUser(users: UserProcessModel[], name: string) {
|
||||
isValidUser(users: UserProcessModel[], name: string): boolean {
|
||||
if (users) {
|
||||
return users.find((user) => {
|
||||
const selectedUser = this.getDisplayName(user).toLocaleLowerCase() === name.toLocaleLowerCase();
|
||||
@@ -119,8 +119,9 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
this.peopleSelected.emit(user && user.id || undefined);
|
||||
}
|
||||
return selectedUser;
|
||||
});
|
||||
}) ? true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getDisplayName(model: UserProcessModel) {
|
||||
|
@@ -202,7 +202,7 @@ describe('UploadWidgetComponent', () => {
|
||||
}));
|
||||
|
||||
it('should update the form after deleted a file', async(() => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
|
||||
if (file.name === 'file-fake.png') {
|
||||
return of(fakePngAnswer);
|
||||
}
|
||||
@@ -210,6 +210,8 @@ describe('UploadWidgetComponent', () => {
|
||||
if (file.name === 'file-fake.jpg') {
|
||||
return of(fakeJpgAnswer);
|
||||
}
|
||||
|
||||
return of();
|
||||
});
|
||||
|
||||
uploadWidgetComponent.field.params.multiple = true;
|
||||
@@ -230,7 +232,7 @@ describe('UploadWidgetComponent', () => {
|
||||
}));
|
||||
|
||||
it('should set has field value all the files uploaded', async(() => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
|
||||
if (file.name === 'file-fake.png') {
|
||||
return of(fakePngAnswer);
|
||||
}
|
||||
@@ -238,6 +240,8 @@ describe('UploadWidgetComponent', () => {
|
||||
if (file.name === 'file-fake.jpg') {
|
||||
return of(fakeJpgAnswer);
|
||||
}
|
||||
|
||||
return of();
|
||||
});
|
||||
|
||||
uploadWidgetComponent.field.params.multiple = true;
|
||||
|
Reference in New Issue
Block a user