From 05ffbb518730001a52833e467df9532ad3aaa067 Mon Sep 17 00:00:00 2001 From: tiltom Date: Wed, 15 May 2024 15:57:25 +0200 Subject: [PATCH] SOV-4157: Fix maximum value in AmountInput (#912) * Fix maximum value in AmountInput * Create nervous-mails-punch.md --- .changeset/nervous-mails-punch.md | 5 +++++ .../2_molecules/AmountInput/AmountInput.test.tsx | 15 +-------------- .../src/2_molecules/AmountInput/AmountInput.tsx | 4 ++-- 3 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 .changeset/nervous-mails-punch.md diff --git a/.changeset/nervous-mails-punch.md b/.changeset/nervous-mails-punch.md new file mode 100644 index 000000000..5639211ee --- /dev/null +++ b/.changeset/nervous-mails-punch.md @@ -0,0 +1,5 @@ +--- +"@sovryn/ui": patch +--- + +SOV-4157: Fix maximum value in AmountInput diff --git a/packages/ui/src/2_molecules/AmountInput/AmountInput.test.tsx b/packages/ui/src/2_molecules/AmountInput/AmountInput.test.tsx index 42a294e9c..ad9b0673b 100644 --- a/packages/ui/src/2_molecules/AmountInput/AmountInput.test.tsx +++ b/packages/ui/src/2_molecules/AmountInput/AmountInput.test.tsx @@ -1,4 +1,4 @@ -import { render, waitFor } from '@testing-library/react'; +import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; @@ -107,19 +107,6 @@ describe('AmountInput', () => { expect(amountInput).toHaveProperty('lang', 'sk-SK'); }); - test('does not allow to enter more than 9 whole numbers', async () => { - const { getByTestId } = render( - , - ); - - const amountInput = getByTestId('test'); - - userEvent.clear(amountInput); - userEvent.paste(amountInput, '10000000000000'); - - await waitFor(() => expect(amountInput).toHaveValue('999999999')); - }); - test('trims unnecessary zeros at the end on blur', async () => { const { getByTestId } = render( ( unformattedNumberValue = String(maxAmount); } - if (Number(unformattedNumberValue) >= MAX_VALUE + 1) { + if (Number(unformattedNumberValue) >= MAX_VALUE) { unformattedNumberValue = String(MAX_VALUE); }