mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Fix dropdown should show the value in readonly mode (#2380)
This commit is contained in:
parent
092528db4f
commit
e1573ddbde
@ -9,6 +9,7 @@
|
|||||||
<md-option *ngFor="let opt of field.options"
|
<md-option *ngFor="let opt of field.options"
|
||||||
[value]="getOptionValue(opt, field.value)"
|
[value]="getOptionValue(opt, field.value)"
|
||||||
[id]="opt.id">{{opt.name}}</md-option>
|
[id]="opt.id">{{opt.name}}</md-option>
|
||||||
|
<md-option id="readonlyOption" *ngIf="field.readOnly" [value]="field.value">{{field.value}}</md-option>
|
||||||
</md-select>
|
</md-select>
|
||||||
<error-widget [error]="field.validationSummary" ></error-widget>
|
<error-widget [error]="field.validationSummary" ></error-widget>
|
||||||
<error-widget class="adf-dropdown-required-message" *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
<error-widget class="adf-dropdown-required-message" *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
||||||
|
@ -288,6 +288,26 @@ describe('DropdownWidgetComponent', () => {
|
|||||||
expect(dropDownElement.getAttribute('aria-disabled')).toBe('true');
|
expect(dropDownElement.getAttribute('aria-disabled')).toBe('true');
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should show the option value when the field is readonly', () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel({processDefinitionId: 'fake-process-id'}), {
|
||||||
|
id: 'dropdown-id',
|
||||||
|
name: 'date-name',
|
||||||
|
type: 'dropdown',
|
||||||
|
value: 'FakeValue',
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
const trigger = fixture.debugElement.query(By.css('.mat-select-trigger')).nativeElement;
|
||||||
|
trigger.click();
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable()
|
||||||
|
.then(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(element.querySelector('#dropdown-id')).not.toBeNull();
|
||||||
|
const option = fixture.debugElement.query(By.css('.mat-option')).nativeElement;
|
||||||
|
expect(option.innerText).toEqual('FakeValue');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user