mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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
This commit is contained in:
committed by
GitHub
parent
eda59a1de8
commit
22b62804d5
@@ -70,11 +70,11 @@ export class WidgetComponent implements AfterViewInit {
|
||||
|
||||
// Note for developers:
|
||||
// returns <any> object to be able binding it to the <element required="required"> attribute
|
||||
isRequired(): any {
|
||||
isRequired(): boolean {
|
||||
if (this.field?.required) {
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
isValid(): boolean {
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<mat-label *ngIf="!field.leftLabels" class="adf-label" [attr.for]="field.id">
|
||||
{{ field.name | translate }}<span class="adf-asterisk" [style.visibility]="isRequired() ? 'visible' : 'hidden'">*</span>
|
||||
{{ field.name | translate }}
|
||||
</mat-label>
|
||||
<mat-select
|
||||
class="adf-select"
|
||||
@@ -22,6 +22,7 @@
|
||||
[title]="field.tooltip"
|
||||
panelClass="adf-select-filter"
|
||||
[multiple]="field.hasMultipleValues"
|
||||
[required]="isRequired()"
|
||||
>
|
||||
<adf-select-filter-input *ngIf="showInputFilter" (change)="filter$.next($event)" />
|
||||
|
||||
|
@@ -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', () => {
|
||||
|
Reference in New Issue
Block a user