I have the <mat-paginator>
element working fine, I just want to know how the heck to I test the getPaginatorData
method for the (page)
attribute with the @testing-library/angular library?
<mat-paginator
#billingItemsPaginator
[pageIndex]="paginatorObject.billingItems.pageIndex"
[pageSize]="paginatorObject.billingItems.pageSize"
[pageSizeOptions]="[6, 12]"
(page)="getPaginatorData($event, 'billingItems')"
showFirstLastButtons="true"
>
</mat-paginator>
This is my component
billingItemsSource = new MatTableDataSource<any>();
public billingItemsPaginator: MatPaginator;
@ViewChild('billingItemsPaginator') set matBillingItemsPaginator(
mp: MatPaginator
) {
this.billingItemsPaginator = mp;
this.billingItemsSource.paginator = this.billingItemsPaginator;
}
Thanks in advance.
I figured it out.
I needed to do this in my beforeEach block:
have
let component;
be globally accessible.and then run in my test