import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { ScrollingModule } from '@angular/cdk/scrolling';
...
it('should render 5 items', fakeAsync(() => {
const fixture: ComponentFixture
// simulate an initial scroll event to trigger CDK's onContentScrolled
const scrollContent: HTMLElement = fixture.nativeElement.querySelector('.cdk-virtual-scroll-content-wrapper');
scrollContent.scrollTop = 10;
scrollContent.dispatchEvent(new Event('scroll'));
tick();
fixture.detectChanges();
const items: NodeListOf