Skip to content

Commit 90da536

Browse files
authored
feat: support nativeElement (#522)
1 parent deff67d commit 90da536

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"@babel/runtime": "^7.10.1",
4545
"classnames": "2.x",
46-
"rc-select": "~14.13.0",
46+
"rc-select": "~14.14.0",
4747
"rc-tree": "~5.8.1",
4848
"rc-util": "^5.16.1"
4949
},

tests/Select.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React from 'react';
55
import TreeSelect, { TreeNode } from '../src';
66
import focusTest from './shared/focusTest';
77
import { selectNode } from './util';
8+
import type { BaseSelectRef } from 'rc-select';
89

910
const mockScrollTo = jest.fn();
1011

@@ -628,4 +629,10 @@ describe('TreeSelect.basic', () => {
628629
wrapper.selectNode(1);
629630
expect(onChange).toHaveBeenCalledWith(['leaf1'], expect.anything(), expect.anything());
630631
});
632+
633+
it('nativeElement', () => {
634+
const treeSelectRef = React.createRef<BaseSelectRef>();
635+
const { container } = render(<TreeSelect ref={treeSelectRef} />);
636+
expect(treeSelectRef.current.nativeElement).toBe(container.querySelector('.rc-tree-select'));
637+
});
631638
});

0 commit comments

Comments
 (0)