mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-14469] added constraint for typed value (#8611)
* [AAE-14469] added constraint for typed value * [AAE-14469] removed obsolete input property
This commit is contained in:
@@ -262,6 +262,12 @@ describe('PeopleCloudComponent', () => {
|
|||||||
const errorIcon = element.querySelector('.adf-error-icon').textContent;
|
const errorIcon = element.querySelector('.adf-error-icon').textContent;
|
||||||
expect(errorIcon).toEqual('error_outline');
|
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', () => {
|
describe('No preselected users', () => {
|
||||||
|
@@ -164,7 +164,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
constructor(
|
constructor(
|
||||||
@Inject(IDENTITY_USER_SERVICE_TOKEN)
|
@Inject(IDENTITY_USER_SERVICE_TOKEN)
|
||||||
private identityUserService: IdentityUserServiceInterface,
|
private identityUserService: IdentityUserServiceInterface,
|
||||||
private logService: LogService) {}
|
private logService: LogService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.initSearch();
|
this.initSearch();
|
||||||
@@ -188,6 +188,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
private initSearch(): void {
|
private initSearch(): void {
|
||||||
this.initializeStream();
|
this.initializeStream();
|
||||||
this.typingUniqueValueNotEmpty$.pipe(
|
this.typingUniqueValueNotEmpty$.pipe(
|
||||||
|
filter((name: string) => name.length >= 1),
|
||||||
switchMap((name: string) =>
|
switchMap((name: string) =>
|
||||||
this.identityUserService.search(name, { roles: this.roles, withinApplication: this.appName, groups: this.groupsRestriction })
|
this.identityUserService.search(name, { roles: this.roles, withinApplication: this.appName, groups: this.groupsRestriction })
|
||||||
),
|
),
|
||||||
@@ -378,8 +379,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
private removeUserFromSelected({ id, username, email }: IdentityUserModel): void {
|
private removeUserFromSelected({ id, username, email }: IdentityUserModel): void {
|
||||||
const indexToRemove = this.selectedUsers.findIndex(user => user.id === id
|
const indexToRemove = this.selectedUsers.findIndex(user => user.id === id
|
||||||
&& user.username === username
|
&& user.username === username
|
||||||
&& user.email === email);
|
&& user.email === email);
|
||||||
|
|
||||||
if (indexToRemove !== -1) {
|
if (indexToRemove !== -1) {
|
||||||
this.selectedUsers.splice(indexToRemove, 1);
|
this.selectedUsers.splice(indexToRemove, 1);
|
||||||
@@ -388,8 +389,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
private removeUserFromValidation({ id, username, email }: IdentityUserModel): void {
|
private removeUserFromValidation({ id, username, email }: IdentityUserModel): void {
|
||||||
const indexToRemove = this.invalidUsers.findIndex(user => user.id === id
|
const indexToRemove = this.invalidUsers.findIndex(user => user.id === id
|
||||||
&& user.username === username
|
&& user.username === username
|
||||||
&& user.email === email);
|
&& user.email === email);
|
||||||
|
|
||||||
if (indexToRemove !== -1) {
|
if (indexToRemove !== -1) {
|
||||||
this.invalidUsers.splice(indexToRemove, 1);
|
this.invalidUsers.splice(indexToRemove, 1);
|
||||||
|
Reference in New Issue
Block a user