import { mount } from 'enzyme'; import React from 'react'; import TreeSelect, { TreeNode } from '..'; import focusTest from '../../../tests/shared/focusTest'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; describe('TreeSelect', () => { focusTest(TreeSelect, { refFocus: true }); mountTest(TreeSelect); rtlTest(TreeSelect); describe('TreeSelect Custom Icons', () => { it('should support customized icons', () => { const wrapper = mount( clear} removeIcon={remove} value={['leaf1', 'leaf2']} placeholder="Please select" multiple allowClear treeDefaultExpandAll > , ); expect(wrapper.render()).toMatchSnapshot(); }); it('should `treeIcon` work', () => { const wrapper = mount( Bamboo} /> , ); expect(wrapper.render()).toMatchSnapshot(); }); }); it('should support notFoundContent', () => { const wrapper = mount(); expect(wrapper.text()).toBe('notFoundContent'); }); it('should show warning when use dropdownClassName', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); mount(); expect(errorSpy).toHaveBeenCalledWith( 'Warning: [antd: TreeSelect] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.', ); errorSpy.mockRestore(); }); });