import React from 'react'; import { mount, render } from 'enzyme'; import RcTimePicker from 'rc-time-picker/lib/TimePicker'; import moment from 'moment'; import TimePicker from '..'; import focusTest from '../../../tests/shared/focusTest'; describe('TimePicker', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); afterEach(() => { errorSpy.mockReset(); }); afterAll(() => { errorSpy.mockRestore(); }); focusTest(TimePicker); it('renders addon correctly', () => { const addon = () => ; const wrapper = mount(); const rcTimePicker = wrapper.find(RcTimePicker); const addonWrapper = render(rcTimePicker.props().addon()); expect(addonWrapper).toMatchSnapshot(); }); it('allowEmpty deprecated', () => { mount(); expect(errorSpy).toBeCalledWith( 'Warning: `allowEmpty` in TimePicker is deprecated. Please use `allowClear` instead.', ); }); it('not render clean icon when allowClear is false', () => { const wrapper = mount( , ); expect(wrapper.render()).toMatchSnapshot(); }); });