Skip to content

Commit

Permalink
refactor: remove some api
Browse files Browse the repository at this point in the history
  • Loading branch information
aojunhao123 committed Oct 31, 2024
1 parent 96f7155 commit f8c1a7b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const inputRef = useRef<InputNumberRef>(null);
useEffect(() => {
inputRef.current.focus(); // the input will get focus
inputRef.current.blur(); // the input will lose focus
console.log(inputRef.current.input); // The origin input element
}, []);
// ....
<InputNumber ref={inputRef} />;
Expand All @@ -207,4 +206,3 @@ useEffect(() => {
| -------- | --------------------------------------- | --------------------------------- |
| focus | `(options?: InputFocusOptions) => void` | The input get focus when called |
| blur | `() => void` | The input loses focus when called |
| input | `HTMLInputElement \| null` | The origin input element |
7 changes: 0 additions & 7 deletions src/InputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ export type { ValueType };
export interface InputNumberRef extends HTMLInputElement {
focus: (options?: InputFocusOptions) => void;
blur: () => void;
setSelectionRange: (
start: number,
end: number,
direction?: 'forward' | 'backward' | 'none',
) => void;
select: () => void;
input: HTMLInputElement | null;
nativeElement: HTMLElement;
}

Expand Down
10 changes: 0 additions & 10 deletions tests/input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,6 @@ describe('InputNumber.Input', () => {
expect(onChange).not.toHaveBeenCalled();
});

it('input should work', () => {
const ref = React.createRef<InputNumberRef>();
const { container } = render(<InputNumber ref={ref} />);
const inputEl = container.querySelector('input')!;
const rootEl = container.querySelector('.rc-input-number')!;

expect(ref.current?.input).toBe(inputEl);
expect(ref.current?.nativeElement).toBe(rootEl);
});

describe('nativeElement', () => {
it('basic', () => {
const ref = React.createRef<InputNumberRef>();
Expand Down

0 comments on commit f8c1a7b

Please sign in to comment.