From 678403cde0d94be86c73914cc003c2c754c41d2b Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Tue, 31 Dec 2024 16:48:28 +0800 Subject: [PATCH] fix: tipFormatter should not crash with undefined value (#1053) * fix: tipFormatter should not crash with undefined value * fix * fix: tacks crash * Update tests/Slider.test.js --------- Co-authored-by: afc163 --- src/Tracks/index.tsx | 2 +- tests/Slider.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Tracks/index.tsx b/src/Tracks/index.tsx index 07edb1ffd..44f7c1d8b 100644 --- a/src/Tracks/index.tsx +++ b/src/Tracks/index.tsx @@ -47,7 +47,7 @@ const Tracks: React.FC = (props) => { // ========================== Render ========================== const tracksNode = - classNames.tracks || styles.tracks ? ( + trackList?.length && (classNames.tracks || styles.tracks) ? ( { const { asFragment } = render(); expect(asFragment().firstChild).toMatchSnapshot(); }); + + it('tipFormatter should not crash with undefined value', () => { + [undefined, null].forEach((value) => { + render(); + }); + }); });