mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +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"
|
aria-hidden="true"
|
||||||
class="ant-select-selection-search-mirror"
|
class="ant-select-selection-search-mirror"
|
||||||
>
|
>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,5 +1,5 @@
|
|||||||
import { mount } from 'enzyme';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '../../../tests/utils';
|
||||||
import TreeSelect, { TreeNode } from '..';
|
import TreeSelect, { TreeNode } from '..';
|
||||||
import focusTest from '../../../tests/shared/focusTest';
|
import focusTest from '../../../tests/shared/focusTest';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
@ -12,7 +12,7 @@ describe('TreeSelect', () => {
|
|||||||
|
|
||||||
describe('TreeSelect Custom Icons', () => {
|
describe('TreeSelect Custom Icons', () => {
|
||||||
it('should support customized icons', () => {
|
it('should support customized icons', () => {
|
||||||
const wrapper = mount(
|
const { container } = render(
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
showSearch
|
showSearch
|
||||||
clearIcon={<span>clear</span>}
|
clearIcon={<span>clear</span>}
|
||||||
@ -32,22 +32,23 @@ describe('TreeSelect', () => {
|
|||||||
</TreeSelect>,
|
</TreeSelect>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should `treeIcon` work', () => {
|
it('should `treeIcon` work', () => {
|
||||||
const wrapper = mount(
|
const { container } = render(
|
||||||
<TreeSelect treeIcon open>
|
<TreeSelect treeIcon open>
|
||||||
<TreeNode value="parent 1" title="parent 1" icon={<span>Bamboo</span>} />
|
<TreeNode value="parent 1" title="parent 1" icon={<span>Bamboo</span>} />
|
||||||
</TreeSelect>,
|
</TreeSelect>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support notFoundContent', () => {
|
it('should support notFoundContent', () => {
|
||||||
const wrapper = mount(<TreeSelect treeIcon open notFoundContent="notFoundContent" />);
|
const content = 'notFoundContent';
|
||||||
expect(wrapper.text()).toBe('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