From 263121568d8d92c45c4dd6bb5925b792d0f0879d Mon Sep 17 00:00:00 2001 From: aojunhao123 <1844749591@qq.com> Date: Thu, 10 Sep 2026 16:55:04 +0800 Subject: [PATCH 1/2] chore(deps): upgrade @rc-component/tree to 1.5.3 --- package.json | 2 +- tests/__snapshots__/Select.spec.tsx.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f5f7b7e0..3a6ed9b7 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "dependencies": { "@rc-component/select": "~1.11.0", - "@rc-component/tree": "~1.5.0", + "@rc-component/tree": "~1.5.3", "@rc-component/util": "^1.11.1", "clsx": "^2.1.1" }, diff --git a/tests/__snapshots__/Select.spec.tsx.snap b/tests/__snapshots__/Select.spec.tsx.snap index ad94bce3..f2c55250 100644 --- a/tests/__snapshots__/Select.spec.tsx.snap +++ b/tests/__snapshots__/Select.spec.tsx.snap @@ -693,7 +693,7 @@ exports[`TreeSelect.basic search nodes check tree changed by filter 2`] = `
Date: Thu, 10 Sep 2026 17:13:44 +0800 Subject: [PATCH 2/2] test: cover collapsing search-expanded branches on clear --- tests/Select.spec.tsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/Select.spec.tsx b/tests/Select.spec.tsx index fd22a4e2..e1352b09 100644 --- a/tests/Select.spec.tsx +++ b/tests/Select.spec.tsx @@ -11,6 +11,7 @@ import { getVisibleTreeNodes, keyDown, keyUp, + search, selectNode, triggerOpen, } from './util'; @@ -261,6 +262,36 @@ describe('TreeSelect.basic', () => { expect(container.firstChild).toMatchSnapshot(); }); + it('collapses search-expanded branches when search is cleared', () => { + const { container } = render( + , + ); + const getVisibleTitles = () => getVisibleTreeNodes(container).map(node => node.textContent); + + expect(getVisibleTitles()).toEqual(['Parent', 'Other root']); + + search(container, 'Target'); + expect(getVisibleTitles()).toEqual(['Parent', 'Target']); + + search(container, ''); + expect(getVisibleTitles()).toEqual(['Parent', 'Other root']); + }); + it('search nodes by filterTreeNode', () => { const filter = (value, node) => node.props.value.toLowerCase() === value.toLowerCase(); const { container } = render(createSelect({ filterTreeNode: filter }));