diff --git a/src/material/datepicker/datepicker-input-base.ts b/src/material/datepicker/datepicker-input-base.ts index e2dbe967f035..e8065b7b1e71 100644 --- a/src/material/datepicker/datepicker-input-base.ts +++ b/src/material/datepicker/datepicker-input-base.ts @@ -304,11 +304,12 @@ export abstract class MatDatepickerInputBase { subscription.unsubscribe(); }), ); + + it('should set the matDatepickerParse error when an invalid value is typed for the first time', () => { + const formControl = fixture.componentInstance.formControl; + + expect(formControl.hasError('matDatepickerParse')).toBe(false); + + typeInElement(fixture.nativeElement.querySelector('input'), 'Today'); + fixture.detectChanges(); + + expect(formControl.hasError('matDatepickerParse')).toBe(true); + }); }); describe('datepicker with mat-datepicker-toggle', () => {