From 22b62804d5043a7af51fbc65fa60321b29365f14 Mon Sep 17 00:00:00 2001 From: Soumyajit Chakraborty <51930458+Isoumyajit@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:13:38 +0530 Subject: [PATCH] AAE-35882 Studio modelling forms required dropdown has double asterisk (#10948) * AAE-35882 fixing the double asterix issue on require fields on preview and form-editors and workspace * AAE-35882 altering one unit as the asterisks are now handled by mat-form-fields --- .../src/lib/form/components/widgets/widget.component.ts | 4 ++-- .../widgets/dropdown/dropdown-cloud.widget.html | 3 ++- .../widgets/dropdown/dropdown-cloud.widget.spec.ts | 9 ++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/core/src/lib/form/components/widgets/widget.component.ts b/lib/core/src/lib/form/components/widgets/widget.component.ts index f46dff9494..ee8e7a9a49 100644 --- a/lib/core/src/lib/form/components/widgets/widget.component.ts +++ b/lib/core/src/lib/form/components/widgets/widget.component.ts @@ -70,11 +70,11 @@ export class WidgetComponent implements AfterViewInit { // Note for developers: // returns object to be able binding it to the attribute - isRequired(): any { + isRequired(): boolean { if (this.field?.required) { return true; } - return null; + return false; } isValid(): boolean { diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html index a3209be565..dea0bd26db 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html @@ -12,7 +12,7 @@
- {{ field.name | translate }}* + {{ field.name | translate }} diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts index 20c9fceceb..351e0b3bf4 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts @@ -336,7 +336,13 @@ describe('DropdownCloudWidgetComponent', () => { }); }); - it('should be able to display label with asterisk', () => { + it('should be able to display label with asterisk when left-label is present', () => { + widget.field = new FormFieldModel(new FormModel({ taskId: 'fake-task-id', readOnly: false, leftLabels: true }), { + id: 'dropdown-id', + name: 'option list', + type: FormFieldTypes.DROPDOWN, + options: filterOptionList + }); fixture.detectChanges(); const asterisk: HTMLElement = element.querySelector('.adf-asterisk'); @@ -402,6 +408,7 @@ describe('DropdownCloudWidgetComponent', () => { describe('and NOT visible', () => { beforeEach(() => { widget.field.isVisible = false; + widget.field.required = false; }); it('should be valid with no option selected', () => {