From 90da536b9888a163861270cbf404b9d669d8533d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Sat, 18 May 2024 10:17:00 +0800 Subject: [PATCH] feat: support nativeElement (#522) --- package.json | 2 +- tests/Select.spec.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f591de6..d4c16aa6 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dependencies": { "@babel/runtime": "^7.10.1", "classnames": "2.x", - "rc-select": "~14.13.0", + "rc-select": "~14.14.0", "rc-tree": "~5.8.1", "rc-util": "^5.16.1" }, diff --git a/tests/Select.spec.tsx b/tests/Select.spec.tsx index 698dc89e..a7f321e7 100644 --- a/tests/Select.spec.tsx +++ b/tests/Select.spec.tsx @@ -5,6 +5,7 @@ import React from 'react'; import TreeSelect, { TreeNode } from '../src'; import focusTest from './shared/focusTest'; import { selectNode } from './util'; +import type { BaseSelectRef } from 'rc-select'; const mockScrollTo = jest.fn(); @@ -628,4 +629,10 @@ describe('TreeSelect.basic', () => { wrapper.selectNode(1); expect(onChange).toHaveBeenCalledWith(['leaf1'], expect.anything(), expect.anything()); }); + + it('nativeElement', () => { + const treeSelectRef = React.createRef(); + const { container } = render(); + expect(treeSelectRef.current.nativeElement).toBe(container.querySelector('.rc-tree-select')); + }); });