@@ -393,13 +393,14 @@ describe('CdkVirtualScrollViewport', () => {
393
393
394
394
it ( 'should recycle views when template cache is large enough to accommodate' , fakeAsync ( ( ) => {
395
395
testComponent . trackBy = i => i ;
396
- spyOn ( testComponent . cdkForOfViewContainer , 'createEmbeddedView' ) . and . callThrough ( ) ;
396
+ const spy =
397
+ spyOn ( testComponent . cdkForOfViewContainer , 'createEmbeddedView' ) . and . callThrough ( ) ;
397
398
finishInit ( fixture ) ;
398
399
399
400
// Should create views for the initial rendered items.
400
401
expect ( testComponent . cdkForOfViewContainer . createEmbeddedView ) . toHaveBeenCalledTimes ( 4 ) ;
401
402
402
- ( testComponent . cdkForOfViewContainer . createEmbeddedView as any ) . calls . reset ( ) ;
403
+ spy . calls . reset ( ) ;
403
404
triggerScroll ( viewport , 10 ) ;
404
405
fixture . detectChanges ( ) ;
405
406
@@ -408,7 +409,7 @@ describe('CdkVirtualScrollViewport', () => {
408
409
// item is now partially on the screen at the bottom and so a new view is needed.
409
410
expect ( testComponent . cdkForOfViewContainer . createEmbeddedView ) . toHaveBeenCalledTimes ( 1 ) ;
410
411
411
- ( testComponent . cdkForOfViewContainer . createEmbeddedView as any ) . calls . reset ( ) ;
412
+ spy . calls . reset ( ) ;
412
413
const maxOffset =
413
414
testComponent . itemSize * testComponent . items . length - testComponent . viewportSize ;
414
415
for ( let offset = 10 ; offset <= maxOffset ; offset += 10 ) {
@@ -424,13 +425,14 @@ describe('CdkVirtualScrollViewport', () => {
424
425
it ( 'should not recycle views when template cache is full' , fakeAsync ( ( ) => {
425
426
testComponent . trackBy = i => i ;
426
427
testComponent . templateCacheSize = 0 ;
427
- spyOn ( testComponent . cdkForOfViewContainer , 'createEmbeddedView' ) . and . callThrough ( ) ;
428
+ const spy =
429
+ spyOn ( testComponent . cdkForOfViewContainer , 'createEmbeddedView' ) . and . callThrough ( ) ;
428
430
finishInit ( fixture ) ;
429
431
430
432
// Should create views for the initial rendered items.
431
433
expect ( testComponent . cdkForOfViewContainer . createEmbeddedView ) . toHaveBeenCalledTimes ( 4 ) ;
432
434
433
- ( testComponent . cdkForOfViewContainer . createEmbeddedView as any ) . calls . reset ( ) ;
435
+ spy . calls . reset ( ) ;
434
436
triggerScroll ( viewport , 10 ) ;
435
437
fixture . detectChanges ( ) ;
436
438
@@ -439,7 +441,7 @@ describe('CdkVirtualScrollViewport', () => {
439
441
// item is now partially on the screen at the bottom and so a new view is needed.
440
442
expect ( testComponent . cdkForOfViewContainer . createEmbeddedView ) . toHaveBeenCalledTimes ( 1 ) ;
441
443
442
- ( testComponent . cdkForOfViewContainer . createEmbeddedView as any ) . calls . reset ( ) ;
444
+ spy . calls . reset ( ) ;
443
445
const maxOffset =
444
446
testComponent . itemSize * testComponent . items . length - testComponent . viewportSize ;
445
447
for ( let offset = 10 ; offset <= maxOffset ; offset += 10 ) {
0 commit comments