Skip to content

Commit

Permalink
[AAE-14469] added constraint for typed value (#8611)
Browse files Browse the repository at this point in the history
* [AAE-14469] added constraint for typed value

* [AAE-14469] removed obsolete input property
  • Loading branch information
tomaszhanaj authored Jun 6, 2023
1 parent 2c5a6e5 commit f549a19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ describe('PeopleCloudComponent', () => {
const errorIcon = element.querySelector('.adf-error-icon').textContent;
expect(errorIcon).toEqual('error_outline');
});

it('should not search user if typed no character', async () => {
await searchUsers('');

expect(searchSpy).not.toHaveBeenCalled();
});
});

describe('No preselected users', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
constructor(
@Inject(IDENTITY_USER_SERVICE_TOKEN)
private identityUserService: IdentityUserServiceInterface,
private logService: LogService) {}
private logService: LogService) { }

ngOnInit(): void {
this.initSearch();
Expand All @@ -188,6 +188,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
private initSearch(): void {
this.initializeStream();
this.typingUniqueValueNotEmpty$.pipe(
filter((name: string) => name.length >= 1),
switchMap((name: string) =>
this.identityUserService.search(name, { roles: this.roles, withinApplication: this.appName, groups: this.groupsRestriction })
),
Expand Down Expand Up @@ -378,8 +379,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {

private removeUserFromSelected({ id, username, email }: IdentityUserModel): void {
const indexToRemove = this.selectedUsers.findIndex(user => user.id === id
&& user.username === username
&& user.email === email);
&& user.username === username
&& user.email === email);

if (indexToRemove !== -1) {
this.selectedUsers.splice(indexToRemove, 1);
Expand All @@ -388,8 +389,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {

private removeUserFromValidation({ id, username, email }: IdentityUserModel): void {
const indexToRemove = this.invalidUsers.findIndex(user => user.id === id
&& user.username === username
&& user.email === email);
&& user.username === username
&& user.email === email);

if (indexToRemove !== -1) {
this.invalidUsers.splice(indexToRemove, 1);
Expand Down

0 comments on commit f549a19

Please sign in to comment.