mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
test: migrate part of Tree-Select tests (#37190)
This commit is contained in:
parent
db0344c85f
commit
7f49d221a0
@ -231,7 +231,6 @@ exports[`TreeSelect TreeSelect Custom Icons should support customized icons 1`]
|
||||
aria-hidden="true"
|
||||
class="ant-select-selection-search-mirror"
|
||||
>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
@ -1,5 +1,5 @@
|
||||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { render } from '../../../tests/utils';
|
||||
import TreeSelect, { TreeNode } from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
@ -12,7 +12,7 @@ describe('TreeSelect', () => {
|
||||
|
||||
describe('TreeSelect Custom Icons', () => {
|
||||
it('should support customized icons', () => {
|
||||
const wrapper = mount(
|
||||
const { container } = render(
|
||||
<TreeSelect
|
||||
showSearch
|
||||
clearIcon={<span>clear</span>}
|
||||
@ -32,22 +32,23 @@ describe('TreeSelect', () => {
|
||||
</TreeSelect>,
|
||||
);
|
||||
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should `treeIcon` work', () => {
|
||||
const wrapper = mount(
|
||||
const { container } = render(
|
||||
<TreeSelect treeIcon open>
|
||||
<TreeNode value="parent 1" title="parent 1" icon={<span>Bamboo</span>} />
|
||||
</TreeSelect>,
|
||||
);
|
||||
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it('should support notFoundContent', () => {
|
||||
const wrapper = mount(<TreeSelect treeIcon open notFoundContent="notFoundContent" />);
|
||||
expect(wrapper.text()).toBe('notFoundContent');
|
||||
const content = 'notFoundContent';
|
||||
const { container } = render(<TreeSelect treeIcon open notFoundContent={content} />);
|
||||
expect(container.querySelector('.ant-select-empty')?.innerHTML).toBe(content);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user