Skip to content

Commit 1f3c3ec

Browse files
committed
test(VariableSizeTree): add test for the fix
1 parent 4075e10 commit 1f3c3ec

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

__tests__/VariableSizeTree.spec.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,5 +686,21 @@ describe('VariableSizeTree', () => {
686686
);
687687
expect(foo3.height).toBe(100);
688688
});
689+
690+
it('properly resets heights after re-computation', async () => {
691+
const listInstance: VariableSizeList = component
692+
.find(VariableSizeList)
693+
.instance() as VariableSizeList;
694+
695+
const resetAfterIndexSpy = jest.spyOn(listInstance, 'resetAfterIndex');
696+
const foo1 = component.state('records')['foo-1']!;
697+
const foo3 = component.state('records')['foo-3']!;
698+
699+
foo3.resize(100, true);
700+
await foo1.toggle();
701+
702+
expect(resetAfterIndexSpy).toHaveBeenCalledWith(0, true);
703+
expect(foo3.height).toBe(30);
704+
});
689705
});
690706
});

0 commit comments

Comments
 (0)