1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Validate sendToken address when component updates (#9907)

* Validate sendToken address when component updates

On a reproduction of trying to get the error message it seems that if an token address is provided in the address form with ETH selected then changing to a token address, the error message won't show.

This will validate the sendtoken address on prop change to properly update the warning message.

* Update test to include second doesAmountErrorRequireUpdate call when state is updated and component is updated
This commit is contained in:
Thomas Huang 2020-11-19 07:35:42 -08:00 committed by GitHub
parent 75de9086de
commit 44448465ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -154,6 +154,7 @@ export default class SendTransactionScreen extends Component {
if (sendTokenAddress && prevTokenAddress !== sendTokenAddress) {
this.updateSendToken()
this.validate(sendTokenAddress)
updateGas = true
}

View File

@ -138,7 +138,7 @@ describe('Send Component', function () {
balance: '',
},
})
assert(utilsMethodStubs.doesAmountErrorRequireUpdate.calledOnce)
assert(utilsMethodStubs.doesAmountErrorRequireUpdate.calledTwice)
assert.deepEqual(
utilsMethodStubs.doesAmountErrorRequireUpdate.getCall(0).args[0],
{