From 5e3c59cb1ce6a800aab8ab7411d350e2465b0c44 Mon Sep 17 00:00:00 2001 From: meerkat Date: Thu, 24 Nov 2022 21:28:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E5=A4=8DinputRef=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF=20(#5806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-ui/src/components/Textarea.tsx | 8 ++++---- .../amis/__tests__/renderers/Form/inputTable.test.tsx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/amis-ui/src/components/Textarea.tsx b/packages/amis-ui/src/components/Textarea.tsx index 7c79c4641..6467ca902 100644 --- a/packages/amis-ui/src/components/Textarea.tsx +++ b/packages/amis-ui/src/components/Textarea.tsx @@ -59,7 +59,7 @@ export interface TextAreaProps extends ThemeProps, LocaleProps { name?: string; disabled?: boolean; - forwardRef?: {current: HTMLInputElement | null}; + forwardRef?: {current: HTMLTextAreaElement | null}; } export interface TextAreaState { @@ -79,9 +79,9 @@ export class Textarea extends React.Component { focused: false }; - input?: HTMLInputElement; - inputRef = (ref: HTMLInputElement) => { - this.input = findDOMNode(ref) as HTMLInputElement; + input?: HTMLTextAreaElement; + inputRef = (ref: HTMLTextAreaElement) => { + this.input = findDOMNode(ref) as HTMLTextAreaElement; if (this.props.forwardRef) { this.props.forwardRef.current = this.input; } diff --git a/packages/amis/__tests__/renderers/Form/inputTable.test.tsx b/packages/amis/__tests__/renderers/Form/inputTable.test.tsx index 4e564bc4e..057b37256 100644 --- a/packages/amis/__tests__/renderers/Form/inputTable.test.tsx +++ b/packages/amis/__tests__/renderers/Form/inputTable.test.tsx @@ -274,13 +274,14 @@ test('Renderer:input-table with combo column', async () => { await wait(300); expect(onSubmit).toBeCalledTimes(2); + expect(onSubmit.mock.calls[1][0]).toEqual({ table: [ { q2: '1', q1: { - score: 99, - comment: 'this is comment msg!' + comment: 'this is comment msg!', + score: 99 } } ]