diff --git a/src/Input.tsx b/src/Input.tsx index 4ce793f..06d68db 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -305,6 +305,7 @@ const Input = forwardRef((props, ref) => { classes={classes} classNames={classNames} styles={styles} + ref={holderRef} > {getInputElement()} diff --git a/tests/index.test.tsx b/tests/index.test.tsx index 6daf791..2433677 100644 --- a/tests/index.test.tsx +++ b/tests/index.test.tsx @@ -454,6 +454,42 @@ describe('Input ref', () => { expect(errorSpy).not.toHaveBeenCalled(); errorSpy.mockRestore(); }); + + describe('nativeElement', () => { + it('is input', () => { + const ref = React.createRef(); + render(); + expect(ref.current?.nativeElement).toHaveClass('rc-input'); + }); + + it('is affix wrapper', () => { + const ref = React.createRef(); + render( + , + ); + expect(ref.current?.nativeElement).toHaveClass('rc-input-affix-wrapper'); + }); + + it('is group wrapper', () => { + const ref = React.createRef(); + render( + , + ); + expect(ref.current?.nativeElement).toHaveClass('rc-input-group-wrapper'); + }); + }); }); describe('resolveChange should work', () => {