Skip to content

Commit

Permalink
Add test for imputToken to check it renders with correct initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
ninokeldishvili committed Dec 27, 2024
1 parent c59e27e commit bbd057f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions packages/ui-components/src/__tests__/InputToken.test.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<div class="flex w-full items-start justify-start space-x-2">
<div class="grow">
<div class="relative flex">
<div class="relative flex" data-testid="token-address-input">
<Input label="Token Address" name="address" required bind:value={address} />
</div>

Expand All @@ -47,7 +47,7 @@

<Helper class="mt-2 text-sm">Token Address</Helper>
</div>
<div class="w-32 grow-0 break-all">
<div class="w-32 grow-0 break-all" data-testid="token-decimals-input">
<input
type="text"
value={decimalsRaw}
Expand Down

0 comments on commit bbd057f

Please sign in to comment.