Skip to content

Commit da29986

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 da29986

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ScrollingModule,
88
} from '../scrolling';
99
import {
10-
ApplicationRef,
1110
Component,
1211
Directive,
1312
TrackByFunction,
@@ -814,25 +813,17 @@ describe('CdkVirtualScrollViewport', () => {
814813
}));
815814

816815
describe('viewChange change detection behavior', () => {
817-
let appRef: ApplicationRef;
818-
819-
beforeEach(() => {
820-
appRef = TestBed.inject(ApplicationRef);
821-
});
822-
823-
it('should not run change detection if there are no viewChange listeners', fakeAsync(() => {
816+
it('should not emit viewChange if there are no listeners', fakeAsync(() => {
817+
const viewChangeSpy = spyOn(testComponent.virtualForOf.viewChange, 'next');
824818
finishInit(fixture);
825819
testComponent.items = Array(10).fill(0);
826820
fixture.changeDetectorRef.markForCheck();
827821
fixture.detectChanges();
828822
flush();
829823

830-
spyOn(appRef, 'tick');
831-
832824
viewport.scrollToIndex(5);
833825
triggerScroll(viewport);
834-
835-
expect(appRef.tick).not.toHaveBeenCalled();
826+
expect(viewChangeSpy).not.toHaveBeenCalled();
836827
}));
837828
});
838829
});

0 commit comments

Comments
 (0)