Skip to content

Commit 2ab87e9

Browse files
committed
test(cdk/scrolling): Change test spying on tick
tick is not called by schedulers anymore (they use an internal _tick)
1 parent 43d3403 commit 2ab87e9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cdk/scrolling/virtual-scroll-viewport.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,19 +820,17 @@ describe('CdkVirtualScrollViewport', () => {
820820
appRef = TestBed.inject(ApplicationRef);
821821
});
822822

823-
it('should not run change detection if there are no viewChange listeners', fakeAsync(() => {
823+
it('should not emit viewChange if there are no listeners', fakeAsync(() => {
824+
const viewChangeSpy = spyOn(testComponent.virtualForOf.viewChange, 'next');
824825
finishInit(fixture);
825826
testComponent.items = Array(10).fill(0);
826827
fixture.changeDetectorRef.markForCheck();
827828
fixture.detectChanges();
828829
flush();
829830

830-
spyOn(appRef, 'tick');
831-
832831
viewport.scrollToIndex(5);
833832
triggerScroll(viewport);
834-
835-
expect(appRef.tick).not.toHaveBeenCalled();
833+
expect(viewChangeSpy).not.toHaveBeenCalled();
836834
}));
837835
});
838836
});

0 commit comments

Comments
 (0)