From a0c1c0d9abfa0badc5890407bee293a30027e932 Mon Sep 17 00:00:00 2001 From: DenysKarmazynDFINITY Date: Tue, 19 Nov 2024 16:16:08 +0100 Subject: [PATCH] feat(frontend): review adjustments --- .../convert/BtcConvertTokenWizard.svelte | 2 +- .../convert/BtcConvertTokenWizard.spec.ts | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/btc/components/convert/BtcConvertTokenWizard.svelte b/src/frontend/src/btc/components/convert/BtcConvertTokenWizard.svelte index 6fcdc6b0d7..6bbfc4fb0d 100644 --- a/src/frontend/src/btc/components/convert/BtcConvertTokenWizard.svelte +++ b/src/frontend/src/btc/components/convert/BtcConvertTokenWizard.svelte @@ -119,7 +119,7 @@ err }); - dispatch('icBack'); + back(); } }; diff --git a/src/frontend/src/tests/btc/components/convert/BtcConvertTokenWizard.spec.ts b/src/frontend/src/tests/btc/components/convert/BtcConvertTokenWizard.spec.ts index 31e75c363a..7921afbe59 100644 --- a/src/frontend/src/tests/btc/components/convert/BtcConvertTokenWizard.spec.ts +++ b/src/frontend/src/tests/btc/components/convert/BtcConvertTokenWizard.spec.ts @@ -12,6 +12,7 @@ import { WizardStepsConvert } from '$lib/enums/wizard-steps'; import { CONVERT_CONTEXT_KEY } from '$lib/stores/convert.store'; import type { Token } from '$lib/types/token'; import { mockBtcAddress, mockUtxosFee } from '$tests/mocks/btc.mock'; +import en from '$tests/mocks/i18n.mock'; import { mockIdentity } from '$tests/mocks/identity.mock'; import { mockPage } from '$tests/mocks/page.store.mock'; import type { Identity } from '@dfinity/agent'; @@ -190,4 +191,34 @@ describe('BtcConvertTokenWizard', () => { expect(spy).not.toHaveBeenCalled(); }); + + it('should render convert form if currentStep is CONVERT', () => { + const { getByTestId } = render(BtcConvertTokenWizard, { + props: { + ...props, + currentStep: { + name: WizardStepsConvert.CONVERT, + title: 'test' + } + }, + context: mockContext() + }); + + expect(getByTestId('convert-form-button-next')).toBeInTheDocument(); + }); + + it('should render convert progress if currentStep is CONVERTING', () => { + const { container } = render(BtcConvertTokenWizard, { + props: { + ...props, + currentStep: { + name: WizardStepsConvert.CONVERTING, + title: 'test' + } + }, + context: mockContext() + }); + + expect(container).toHaveTextContent(en.core.warning.do_not_close); + }); });