Skip to content

Commit

Permalink
pr review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Z3RO-O committed Mar 6, 2025
1 parent aa07f7a commit d7609aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('FyUserlistModalComponent', () => {
expect(separatorKeysCodes).toEqual(keyCodeData);
});

it('getSelectedItemDict(): shouls retutn a selected item dictonary', () => {
it('getSelectedItemDict(): shouls return a selected item dictonary', () => {
const selectedItemDict = component.getSelectedItemDict();
fixture.detectChanges();
expect(selectedItemDict).toEqual(selectedItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {

eouc$: Observable<Partial<Employee>[]>;

intialSelectedEmployees: string[] = [];
initialSelectedEmployees: string[] = [];

userListCopy$: Observable<Employee[]>;

Expand Down Expand Up @@ -85,8 +85,8 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
}

ngOnInit(): void {
this.intialSelectedEmployees = cloneDeep(this.currentSelections);
this.intialSelectedEmployees.sort((a, b) => (a < b ? -1 : 1));
this.initialSelectedEmployees = cloneDeep(this.currentSelections);
this.initialSelectedEmployees.sort((a, b) => (a < b ? -1 : 1));
this.selectedItemDict = this.getSelectedItemDict();
}

Expand Down Expand Up @@ -140,7 +140,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
);
}

getUsersList(searchText?: string): Observable<Partial<Employee>[]> {
getUsersList(searchText: string): Observable<Partial<Employee>[]> {
this.isLoading = true;
// run ChangeDetectionRef.detectChanges to avoid
// 'expression has changed after it was checked error'.
Expand Down Expand Up @@ -203,7 +203,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
return of(newEmpList);
}

processNewlyAddedItems(searchText?: string): Observable<Partial<Employee>[]> {
processNewlyAddedItems(searchText: string): Observable<Partial<Employee>[]> {
return from(this.filteredOptions$).pipe(
switchMap((filteredOptions) =>
this.getNewlyAddedUsers(filteredOptions).pipe(
Expand All @@ -218,8 +218,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
newArr.push(newItem);
newlyAddedItems = newArr.concat(newlyAddedItems);
return newlyAddedItems.filter(
(item) =>
item && item.email && item.email.length > 0 && item.email.toLowerCase().includes(searchTextLowerCase)
(item) => item?.email?.length > 0 && item.email.toLowerCase().includes(searchTextLowerCase)
);
}
return newlyAddedItems;
Expand All @@ -237,7 +236,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
startWith(''),
distinctUntilChanged(),
debounceTime(400),
switchMap((searchText?: string) => this.getUsersList(searchText))
switchMap((searchText: string) => this.getUsersList(searchText))
);

if (this.allowCustomValues) {
Expand All @@ -246,7 +245,7 @@ export class FyUserlistModalComponent implements OnInit, AfterViewInit {
startWith(''),
distinctUntilChanged(),
debounceTime(400),
switchMap((searchText?: string) => this.processNewlyAddedItems(searchText))
switchMap((searchText: string) => this.processNewlyAddedItems(searchText))
);
}
this.cdr.detectChanges();
Expand Down

0 comments on commit d7609aa

Please sign in to comment.