diff --git a/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html b/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html index 87917d2c49..febd6f6414 100644 --- a/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html +++ b/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html @@ -40,6 +40,7 @@ [appName]="peopleAppName" [roles]="peopleRoles" [appName]="peopleAppName" + [title]="'ADF_TASK_LIST.START_TASK.FORM.LABEL.ASSIGNEE'" [mode]="peopleMode"> diff --git a/docs/process-services-cloud/components/people-cloud.component.md b/docs/process-services-cloud/components/people-cloud.component.md index 9dff8da2e0..f42dce375f 100644 --- a/docs/process-services-cloud/components/people-cloud.component.md +++ b/docs/process-services-cloud/components/people-cloud.component.md @@ -29,6 +29,7 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu | preSelectUsers | [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. Mandatory properties are: id, email, username | | roles | `string[]` | | Role names of the users to be listed. | | validate | `Boolean` | false | This flag enables the validation on the preSelectUsers passed as input. In case the flag is true the components call the identity service to verify the validity of the information passed as input. Otherwise, no check will be done. | +| title | `string` | | Translation key for the input placeholder | ### Events diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.html b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.html index b1845e2311..1ca2dffe2a 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.html @@ -1,6 +1,6 @@
- {{'ADF_TASK_LIST.START_TASK.FORM.LABEL.ASSIGNEE' | translate}} + {{ title | translate }} { expect(errorMessage.textContent).toContain('ADF_CLOUD_START_TASK.ERROR.MESSAGE'); }); })); + + it('should populate placeholder when title is present', async(() => { + component.title = 'TITLE_KEY'; + fixture.detectChanges(); + const matLabel: HTMLInputElement = element.querySelector('mat-label'); + fixture.whenStable().then( () => { + fixture.detectChanges(); + expect(matLabel.textContent).toEqual('TITLE_KEY'); + }); + })); + + it('should not populate placeholder when title is present', async(() => { + const matLabel: HTMLInputElement = element.querySelector('mat-label'); + fixture.detectChanges(); + fixture.whenStable().then( () => { + fixture.detectChanges(); + expect(matLabel.textContent).toEqual(''); + }); + })); }); describe('when application name defined', () => { @@ -543,7 +562,7 @@ describe('PeopleCloudComponent', () => { component.preSelectUsers = [{ id: mockUsers[0].id }, { id: mockUsers[1].id }]; component.ngOnChanges({ 'preSelectUsers': change }); fixture.detectChanges(); - component.filterPreselectUsers().then((result) => { + component.filterPreselectUsers().then((result: any) => { fixture.detectChanges(); expect(findByIdSpy).toHaveBeenCalled(); expect(component.userExists(result[0])).toEqual(true); @@ -636,5 +655,20 @@ describe('PeopleCloudComponent', () => { }); }); })); + + it('should populate placeholder when title is present', () => { + fixture.detectChanges(); + component.title = 'ADF_TASK_LIST.START_TASK.FORM.LABEL.ASSIGNEE'; + const inputHTMLElement: HTMLInputElement = element.querySelector('mat-label'); + fixture.detectChanges(); + expect(inputHTMLElement.textContent).toEqual('ADF_TASK_LIST.START_TASK.FORM.LABEL.ASSIGNEE'); + }); + + it('should not populate placeholder when title is present', () => { + fixture.detectChanges(); + const inputHTMLElement: HTMLInputElement = element.querySelector('mat-label'); + fixture.detectChanges(); + expect(inputHTMLElement.textContent).toEqual(''); + }); }); }); diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts index 4f57e2eb9b..42bc47f2b0 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts @@ -71,6 +71,11 @@ export class PeopleCloudComponent implements OnInit, OnChanges { @Input() preSelectUsers: IdentityUserModel[]; + /** Placeholder translation key + */ + @Input() + title: string; + /** Emitted when a user is selected. */ @Output() selectUser: EventEmitter = new EventEmitter(); diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html index f857c8df87..95e19ac0a8 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html @@ -64,6 +64,7 @@ [appName]="appName" [preSelectUsers]="[currentUser]" (selectUser)="onAssigneeSelect($event)" + [title]="'ADF_TASK_LIST.START_TASK.FORM.LABEL.ASSIGNEE'" (removeUser)="onAssigneeRemove()">