From bbd057f5eb0356f6c8a4de738971eefb26c74743 Mon Sep 17 00:00:00 2001 From: nino Date: Fri, 27 Dec 2024 11:18:14 +0400 Subject: [PATCH] Add test for imputToken to check it renders with correct initial value --- .../src/__tests__/InputToken.test.ts | 16 ++++++++++++++++ .../src/lib/components/input/InputToken.svelte | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 packages/ui-components/src/__tests__/InputToken.test.ts diff --git a/packages/ui-components/src/__tests__/InputToken.test.ts b/packages/ui-components/src/__tests__/InputToken.test.ts new file mode 100644 index 000000000..2840a4064 --- /dev/null +++ b/packages/ui-components/src/__tests__/InputToken.test.ts @@ -0,0 +1,16 @@ +import { render } from '@testing-library/svelte'; +import InputToken from '../lib/components/input/InputToken.svelte'; + + +describe('InputToken', () => { + it('renders with initial values', () => { + const address = '0xc0D477556c25C9d67E1f57245C7453DA776B51cf'; + const decimals = 10; + const { getByTestId } = render(InputToken, { props: { address, decimals } }); + + const input = getByTestId('token-address-input').querySelector('input'); + expect(input?.value).toBe('0xc0D477556c25C9d67E1f57245C7453DA776B51cf'); + const decimalsInput = getByTestId('token-decimals-input').querySelector('input'); + expect(decimalsInput?.value).toBe('10'); + }); +}); diff --git a/packages/ui-components/src/lib/components/input/InputToken.svelte b/packages/ui-components/src/lib/components/input/InputToken.svelte index fe16865e4..c661b3db8 100644 --- a/packages/ui-components/src/lib/components/input/InputToken.svelte +++ b/packages/ui-components/src/lib/components/input/InputToken.svelte @@ -37,7 +37,7 @@
-
+
@@ -47,7 +47,7 @@ Token Address
-
+