import React from 'react'; import { mount } from 'enzyme'; import { render } from '@testing-library/react'; import InputNumber from '..'; import focusTest from '../../../tests/shared/focusTest'; describe('prefix', () => { focusTest( React.forwardRef((props, ref) => ), { refFocus: true }, ); it('should support className when has prefix', () => { const { container } = render(); expect(container.firstChild.className.includes('my-class-name')).toBe(true); expect(container.querySelector('input')?.className.includes('my-class-name')).toBe(false); }); it('should trigger focus when prefix is clicked', () => { const wrapper = mount(123} />); const mockFocus = jest.spyOn(wrapper.find('input').getDOMNode(), 'focus'); wrapper.find('i').simulate('mouseUp'); expect(mockFocus).toBeCalled(); }); });