From 58a6608cde98a6bb6114df1c5d512214bf2bd801 Mon Sep 17 00:00:00 2001 From: fujianchao Date: Wed, 24 Jul 2024 11:37:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amis/__tests__/renderers/Form/number.test.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/amis/__tests__/renderers/Form/number.test.tsx b/packages/amis/__tests__/renderers/Form/number.test.tsx index 8084c6db5..5a3f95be4 100644 --- a/packages/amis/__tests__/renderers/Form/number.test.tsx +++ b/packages/amis/__tests__/renderers/Form/number.test.tsx @@ -361,20 +361,14 @@ test('Renderer:number with showAsPercent', async () => { const {input} = await setup({ suffix: '%', showAsPercent: true, + value: 1.123, precision: 3 }); - fireEvent.change(input, {target: {value: 1.123}}); - fireEvent.blur(input); - await wait(300); - expect(input.value).toBe('112.3%'); - fireEvent.change(input, {target: {value: 0.2123}}); - fireEvent.blur(input); - await wait(300); - expect(input.value).toBe('21.2%'); + expect(input.value).toEqual('112.3%'); - fireEvent.change(input, {target: {value: '1.2'}}); + fireEvent.change(input, {target: {value: 23.1234}}); fireEvent.blur(input); await wait(300); - expect(input.value).toBe('120%'); + expect(input.value).toEqual('23.123%'); });