Skip to content

Commit

Permalink
feat: support nativeElement (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored May 18, 2024
1 parent 881151f commit 161c352
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 @@ -45,7 +45,7 @@
"@babel/runtime": "^7.12.5",
"array-tree-filter": "^2.1.0",
"classnames": "^2.3.1",
"rc-select": "~14.13.0",
"rc-select": "~14.14.0",
"rc-tree": "~5.8.1",
"rc-util": "^5.37.0"
},
Expand Down
7 changes: 7 additions & 0 deletions tests/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Cascader from '../src';
import { addressOptions, addressOptionsForUneven, optionsForActiveMenuItems } from './demoOptions';
import { mount } from './enzyme';
import { toRawValues } from '../src/utils/commonUtil';
import { render } from '@testing-library/react';

describe('Cascader.Basic', () => {
let selectedValue: any;
Expand Down Expand Up @@ -1065,4 +1066,10 @@ describe('Cascader.Basic', () => {
it('toRawValues undefined', () => {
expect(toRawValues()).toEqual([]);
});

it('nativeElement', () => {
const cascaderRef = React.createRef<CascaderRef>();
const { container } = render(<Cascader ref={cascaderRef} />);
expect(cascaderRef.current?.nativeElement).toEqual(container.querySelector('.rc-cascader'));
});
});

0 comments on commit 161c352

Please sign in to comment.