Skip to content

Commit

Permalink
feat: support nativeElement (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored May 18, 2024
1 parent deff67d commit 90da536
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
7 changes: 7 additions & 0 deletions tests/Select.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -628,4 +629,10 @@ describe('TreeSelect.basic', () => {
wrapper.selectNode(1);
expect(onChange).toHaveBeenCalledWith(['leaf1'], expect.anything(), expect.anything());
});

it('nativeElement', () => {
const treeSelectRef = React.createRef<BaseSelectRef>();
const { container } = render(<TreeSelect ref={treeSelectRef} />);
expect(treeSelectRef.current.nativeElement).toBe(container.querySelector('.rc-tree-select'));
});
});

0 comments on commit 90da536

Please sign in to comment.