@@ -226,6 +226,16 @@ describe('VariableSizeTree', () => {
226
226
} ) ;
227
227
228
228
describe ( 'recomputeTree' , ( ) => {
229
+ let resetAfterIndexSpy : jest . SpyInstance ;
230
+
231
+ beforeEach ( ( ) => {
232
+ const listInstance = component
233
+ . find ( VariableSizeList )
234
+ . instance ( ) as VariableSizeList ;
235
+
236
+ resetAfterIndexSpy = jest . spyOn ( listInstance , 'resetAfterIndex' ) ;
237
+ } ) ;
238
+
229
239
it ( 'updates tree order' , async ( ) => {
230
240
tree = {
231
241
children : [
@@ -284,6 +294,8 @@ describe('VariableSizeTree', () => {
284
294
treeData : undefined ,
285
295
} ,
286
296
) ;
297
+
298
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
287
299
} ) ;
288
300
289
301
it ( 'updates tree nodes metadata' , async ( ) => {
@@ -344,6 +356,8 @@ describe('VariableSizeTree', () => {
344
356
treeData : undefined ,
345
357
} ,
346
358
) ;
359
+
360
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
347
361
} ) ;
348
362
349
363
it ( 'resets current openness to default' , async ( ) => {
@@ -408,6 +422,8 @@ describe('VariableSizeTree', () => {
408
422
treeData : undefined ,
409
423
} ,
410
424
) ;
425
+
426
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
411
427
} ) ;
412
428
413
429
it ( 'resets current openness to the new default provided by the node refreshing' , async ( ) => {
@@ -465,6 +481,8 @@ describe('VariableSizeTree', () => {
465
481
treeData : undefined ,
466
482
} ,
467
483
) ;
484
+
485
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
468
486
} ) ;
469
487
470
488
it ( 'provides a toggle function that changes openness state of the specific node' , async ( ) => {
@@ -482,6 +500,8 @@ describe('VariableSizeTree', () => {
482
500
expect ( treeWalkerSpy ) . toHaveBeenCalledWith ( false ) ;
483
501
expect ( foo1 . height ) . toBe ( defaultHeight ) ;
484
502
expect ( foo1 . isOpen ) . toBeFalsy ( ) ;
503
+
504
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
485
505
} ) ;
486
506
487
507
it ( 'resets current height to default' , async ( ) => {
@@ -548,6 +568,8 @@ describe('VariableSizeTree', () => {
548
568
treeData : undefined ,
549
569
} ,
550
570
) ;
571
+
572
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
551
573
} ) ;
552
574
553
575
it ( 'resets current height to the new default provided by the node refreshing' , async ( ) => {
@@ -605,6 +627,8 @@ describe('VariableSizeTree', () => {
605
627
treeData : undefined ,
606
628
} ,
607
629
) ;
630
+
631
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
608
632
} ) ;
609
633
610
634
it ( 'opens and closes nodes as specified in opennessState' , async ( ) => {
@@ -646,6 +670,7 @@ describe('VariableSizeTree', () => {
646
670
expect ( foo1 ! . isOpen ) . toBeTruthy ( ) ;
647
671
expect ( foo2 ! . isOpen ) . toBeTruthy ( ) ;
648
672
expect ( foo3 ! . isOpen ) . not . toBeTruthy ( ) ;
673
+ expect ( resetAfterIndexSpy ) . toHaveBeenCalledWith ( 0 , true ) ;
649
674
} ) ;
650
675
651
676
it ( 'opennessState is overridden by useDefaultOpenness' , async ( ) => {
0 commit comments