From 80a70cf7892ecf812981dbda9d51c6ebbd379f63 Mon Sep 17 00:00:00 2001 From: Ehsan Rezaei Date: Fri, 9 Aug 2024 10:32:33 +0200 Subject: [PATCH] AAE-23830 Label for people component (#10064) * AAE-23830 Label for people component * AAE-23830 Managed to load label conditionally --- .../widgets/people/people-cloud.widget.html | 1 - .../people/components/people-cloud.component.html | 4 ++-- .../components/people-cloud.component.spec.ts | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.html b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.html index 59761fd6bf..dd3226de28 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.html +++ b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.html @@ -7,7 +7,6 @@ - + + {{ title | translate }} { let loader: HarnessLoader; @@ -92,21 +93,21 @@ describe('PeopleCloudComponent', () => { loader = TestbedHarnessEnvironment.loader(fixture); }); - it('should populate placeholder when title is present', () => { + it('should populate label when title is present', async () => { component.title = 'TITLE_KEY'; fixture.detectChanges(); - const inputElement = element.querySelector('[data-automation-id="adf-people-cloud-search-input"]'); + const inputField = await loader.getHarness(MatFormFieldHarness.with({ selector: '.adf-people-cloud' })); - expect(inputElement.placeholder).toEqual('TITLE_KEY'); + expect(await inputField.getLabel()).toEqual('TITLE_KEY'); }); - it('should not populate placeholder when title is not present', () => { + it('should not populate label when title is not present', async () => { fixture.detectChanges(); - const inputElement = element.querySelector('[data-automation-id="adf-people-cloud-search-input"]'); + const inputField = await loader.getHarness(MatFormFieldHarness.with({ selector: '.adf-people-cloud' })); - expect(inputElement.placeholder).toEqual(''); + expect(await inputField.getLabel()).toBeNull(); }); describe('Search user', () => {