diff --git a/cashtab/package-lock.json b/cashtab/package-lock.json --- a/cashtab/package-lock.json +++ b/cashtab/package-lock.json @@ -1,12 +1,12 @@ { "name": "cashtab", - "version": "2.29.0", + "version": "2.29.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cashtab", - "version": "2.29.0", + "version": "2.29.1", "dependencies": { "@bitgo/utxo-lib": "^9.33.0", "@zxing/browser": "^0.1.4", diff --git a/cashtab/package.json b/cashtab/package.json --- a/cashtab/package.json +++ b/cashtab/package.json @@ -1,6 +1,6 @@ { "name": "cashtab", - "version": "2.29.0", + "version": "2.29.1", "private": true, "scripts": { "start": "node scripts/start.js", diff --git a/cashtab/src/components/Wallets/__tests__/index.test.js b/cashtab/src/components/Wallets/__tests__/index.test.js --- a/cashtab/src/components/Wallets/__tests__/index.test.js +++ b/cashtab/src/components/Wallets/__tests__/index.test.js @@ -385,6 +385,9 @@ ); // We see import modal + expect( + screen.getByPlaceholderText('mnemonic (seed phrase)'), + ).toBeInTheDocument(); // Import button is disabled const importBtn = screen.getByRole('button', { @@ -415,13 +418,18 @@ // Click import await user.click(importBtn); - // Wallet imported success modal + // Wallet imported success toast expect( await screen.findByText( `New imported wallet "qzxep" added to your saved wallets`, ), ).toBeInTheDocument(); + // The modal is no longer with us + expect( + screen.queryByPlaceholderText('mnemonic (seed phrase)'), + ).not.toBeInTheDocument(); + // We see the new wallet expect((await screen.findAllByText('qzxep'))[1]).toBeInTheDocument(); @@ -433,11 +441,11 @@ 'qzxep', ); - // Wait for mnemonic input to be cleared + // The modal will be closed after a successful import await waitFor(() => expect( - screen.getByPlaceholderText('mnemonic (seed phrase)'), - ).toHaveValue(''), + screen.queryByPlaceholderText('mnemonic (seed phrase)'), + ).not.toBeInTheDocument(), ); // Bring up the import modal again @@ -453,13 +461,18 @@ 'pioneer waste next tired armed course expand stairs load brick asthma budget', ); + // It is a new import button now + const newImportButton = screen.getByRole('button', { + name: 'OK', + }); + // The button is not disabled - expect(importBtn).toHaveProperty('disabled', false); + expect(newImportButton).toHaveProperty('disabled', false); // Click import - await user.click(importBtn); + await user.click(newImportButton); - // Wallet imported failure modal + // Wallet imported failure toast expect( await screen.findByText( `Cannot import: wallet already exists (name: "qzxep")`, diff --git a/cashtab/src/components/Wallets/index.js b/cashtab/src/components/Wallets/index.js --- a/cashtab/src/components/Wallets/index.js +++ b/cashtab/src/components/Wallets/index.js @@ -244,6 +244,9 @@ // Clear formdata setFormData({ ...formData, mnemonic: '' }); + + // Close the modal + setShowImportWalletModal(false); } /**