How to test angular material date picker?

i created a component using angular material, and i would like to test it.

These are the versions of angular and angular materials:

  • Angular 9.1.4
  • Angular Material 9.2.2

The view has this code to render the datepicker:

<mat-datepicker-toggle matPrefix [for]="datePickerCalendar"></mat-datepicker-toggle>
<mat-datepicker #datePickerCalendar startView="multi-year"> </mat-datepicker>

The controller get the datepicker element in this way:

@ViewChild('datePickerCalendar') public datePickerCalendar: MatDatepicker<Date>;

and this is the method called when dateChange is triggered from the date picker:

public onCalendarChange(e: MatDatepickerInputEvent<Moment>): void {

So my question is, how can i implement an unit test that create the component and, when this method is called, will call the close() method without errors?

I tried to search online but i didn’t find anything to implement datepicker unit test.
The only good tutorial was this one from angular material website (link) but it didn’t explain how to test angular material datepicker.

Thank you

Source: New feed
Source Url How to test angular material date picker?