mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-21799 replace opening datepicker on focus with opening on enter (#9526)
This commit is contained in:
parent
951b8dbe5a
commit
966a6b7cc0
@ -13,6 +13,7 @@
|
|||||||
[disabled]="field.readOnly"
|
[disabled]="field.readOnly"
|
||||||
(change)="onValueChanged($event)"
|
(change)="onValueChanged($event)"
|
||||||
(dateChange)="onDateChanged($event)"
|
(dateChange)="onDateChanged($event)"
|
||||||
|
(keydown.enter)="datetimePicker.open()"
|
||||||
[placeholder]="field.placeholder"
|
[placeholder]="field.placeholder"
|
||||||
[matTooltip]="field.tooltip"
|
[matTooltip]="field.tooltip"
|
||||||
(blur)="markAsTouched()"
|
(blur)="markAsTouched()"
|
||||||
@ -25,9 +26,9 @@
|
|||||||
<error-widget [error]="field.validationSummary"></error-widget>
|
<error-widget [error]="field.validationSummary"></error-widget>
|
||||||
<error-widget *ngIf="isInvalidFieldRequired() && isTouched()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
<error-widget *ngIf="isInvalidFieldRequired() && isTouched()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
||||||
<mat-datetimepicker #datetimePicker
|
<mat-datetimepicker #datetimePicker
|
||||||
|
data-automation-id="adf-date-time-widget-picker"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
[touchUi]="true"
|
[touchUi]="true"
|
||||||
[openOnFocus]="true"
|
|
||||||
[timeInterval]="5"
|
[timeInterval]="5"
|
||||||
[disabled]="field.readOnly">
|
[disabled]="field.readOnly">
|
||||||
</mat-datetimepicker>
|
</mat-datetimepicker>
|
||||||
|
@ -439,5 +439,23 @@ describe('DateTimeWidgetComponent', () => {
|
|||||||
const adfLeftLabel = element.querySelector('.adf-left-label');
|
const adfLeftLabel = element.querySelector('.adf-left-label');
|
||||||
expect(adfLeftLabel).toBeNull();
|
expect(adfLeftLabel).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should open date-time picker when enter key is pressed', async () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel({ taskId: 'fake-task' }), {
|
||||||
|
id: 'datetime-id',
|
||||||
|
name: 'datetime-name',
|
||||||
|
value: '',
|
||||||
|
type: FormFieldTypes.DATETIME,
|
||||||
|
readOnly: false,
|
||||||
|
required: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const input = await loader.getHarness(MatInputHarness);
|
||||||
|
await input.focus();
|
||||||
|
await (await input.host()).sendKeys('Enter');
|
||||||
|
|
||||||
|
const picker = element.querySelector('[data-automation-id="adf-date-time-widget-picker"]');
|
||||||
|
expect(picker).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user