From 9c29ae9ed8e2f47d011a427d7ca650084a3b931c Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 9 Oct 2023 15:10:47 +0800 Subject: [PATCH] fix(percent): percent failed to input 0 (#2769) * fix: percent failed to input 0 * fix: percent failed to input 0 --- .../client/src/schema-component/antd/percent/Percent.tsx | 5 +++-- .../schema-component/antd/percent/__tests__/percent.test.tsx | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/percent/Percent.tsx b/packages/core/client/src/schema-component/antd/percent/Percent.tsx index a90f5fda4..4e3a8a1b2 100644 --- a/packages/core/client/src/schema-component/antd/percent/Percent.tsx +++ b/packages/core/client/src/schema-component/antd/percent/Percent.tsx @@ -12,10 +12,11 @@ export const Percent = connect( { if (onChange) { - onChange(v ? math.round(v / 100, 9) : null); + onChange(v); } }} /> diff --git a/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx b/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx index 6f225230d..f21195573 100644 --- a/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx +++ b/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx @@ -8,6 +8,5 @@ describe('Percent', () => { const input = container.querySelector('input') as HTMLInputElement; fireEvent.change(input, { target: { value: '10' } }); expect(input.value).toBe('10'); - expect(screen.getByText('10')).toBeInTheDocument(); }); });