From 1d63fa6daa60e52071e6b18d972dea00f2877a49 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Thu, 23 May 2024 21:06:40 -0700 Subject: [PATCH] test: Fix flakiness in virtual scroll tests --- src/cdk/scrolling/virtual-scroll-viewport.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts index d8638121f1f9..a93c705c5eb9 100644 --- a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts +++ b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts @@ -25,7 +25,7 @@ import { tick, waitForAsync, } from '@angular/core/testing'; -import {Subject, animationFrameScheduler} from 'rxjs'; +import {Subject} from 'rxjs'; import {dispatchFakeEvent} from '../testing/private'; describe('CdkVirtualScrollViewport', () => { @@ -1245,7 +1245,7 @@ function finishInit(fixture: ComponentFixture) { flush(); // Flush the initial fake scroll event. - animationFrameScheduler.flush(); + tick(16); // flush animation frame; flush(); fixture.changeDetectorRef.markForCheck(); fixture.detectChanges(); @@ -1257,7 +1257,7 @@ function triggerScroll(viewport: CdkVirtualScrollViewport, offset?: number) { viewport.scrollToOffset(offset); } dispatchFakeEvent(viewport.scrollable.getElementRef().nativeElement, 'scroll'); - animationFrameScheduler.flush(); + tick(16); // flush animation frame; } @Component({