From c93290a2345db0e74cb146f35b025433c11a3141 Mon Sep 17 00:00:00 2001 From: Fatpandac Date: Wed, 27 Dec 2023 21:39:25 +0800 Subject: [PATCH] fix(test): add the test case for scrolling by index and key --- tests/refs.spec.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/refs.spec.tsx b/tests/refs.spec.tsx index 9417b17e3..7b0efec35 100644 --- a/tests/refs.spec.tsx +++ b/tests/refs.spec.tsx @@ -44,5 +44,17 @@ describe('Table.Ref', () => { }); expect(scrollParam.top).toEqual(903); + + // Scroll index + ref.current.scrollTo({ + index: 0, + }); + expect(scrollParam.top).toEqual(0); + + // Scroll key + ref.current.scrollTo({ + key: 'bamboo', + }); + expect(scrollParam.top).toEqual(0); }); });