From b544ca18f6c1b496e840bfb17d1fb21fc232df65 Mon Sep 17 00:00:00 2001 From: Wanpan Date: Wed, 26 Feb 2025 16:22:58 +0800 Subject: [PATCH 1/3] fix: clearIcon add tabIndex (#111) --- src/Input.tsx | 4 ++-- tests/index.test.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Input.tsx b/src/Input.tsx index 4ce793f..1cb3536 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -1,6 +1,6 @@ import clsx from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import omit from 'rc-util/lib/omit'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import omit from '@rc-component/util/lib/omit'; import React, { forwardRef, useEffect, diff --git a/tests/index.test.tsx b/tests/index.test.tsx index 6daf791..d6c153f 100644 --- a/tests/index.test.tsx +++ b/tests/index.test.tsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import Input from '../src'; import type { InputRef } from '../src/interface'; From bc907264c533b33a9a14fa1daa946622e5ea56d6 Mon Sep 17 00:00:00 2001 From: Fang <112931392+Fang328@users.noreply.github.com> Date: Fri, 11 Apr 2025 10:01:33 +0800 Subject: [PATCH 2/3] fix: fix BaseInput missing ref binding (#102) --- src/Input.tsx | 1 + tests/index.test.tsx | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/Input.tsx b/src/Input.tsx index 1cb3536..619eff8 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 d6c153f..d2107f0 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', () => { From d93fffc14e358827ff486545e52e4532ae66a327 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 11 Apr 2025 10:08:58 +0800 Subject: [PATCH 3/3] fix rc-util --- src/Input.tsx | 4 ++-- tests/index.test.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Input.tsx b/src/Input.tsx index 619eff8..06d68db 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -1,6 +1,6 @@ import clsx from 'classnames'; -import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; -import omit from '@rc-component/util/lib/omit'; +import useMergedState from 'rc-util/lib/hooks/useMergedState'; +import omit from 'rc-util/lib/omit'; import React, { forwardRef, useEffect, diff --git a/tests/index.test.tsx b/tests/index.test.tsx index d2107f0..2433677 100644 --- a/tests/index.test.tsx +++ b/tests/index.test.tsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; +import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import React from 'react'; import Input from '../src'; import type { InputRef } from '../src/interface';