diff options
author | Dan Miller <danjm.com@gmail.com> | 2018-08-16 20:28:27 +0800 |
---|---|---|
committer | Dan Miller <danjm.com@gmail.com> | 2018-12-04 11:36:04 +0800 |
commit | 0a7dfcd55d02a7204d8f0773ff9d91f325aabea8 (patch) | |
tree | a4c7d3e219ca926f17f26d020fddc78854a23b53 /ui/app/components/send | |
parent | 112d18e316df312a648b8c8ac17c201314fc9ed6 (diff) | |
download | tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar.gz tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar.bz2 tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar.lz tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar.xz tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.tar.zst tangerine-wallet-browser-0a7dfcd55d02a7204d8f0773ff9d91f325aabea8.zip |
Connect the gas-button-group component to redux and a live api.
Diffstat (limited to 'ui/app/components/send')
-rw-r--r-- | ui/app/components/send/send.component.js | 4 | ||||
-rw-r--r-- | ui/app/components/send/send.container.js | 4 | ||||
-rw-r--r-- | ui/app/components/send/tests/send-component.test.js | 12 |
3 files changed, 20 insertions, 0 deletions
diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index a27401f30..a639c24b0 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -162,6 +162,10 @@ export default class SendTransactionScreen extends PersistentForm { } } + componentDidMount () { + this.props.fetchGasEstimates() + } + componentWillMount () { const { from: { address }, diff --git a/ui/app/components/send/send.container.js b/ui/app/components/send/send.container.js index 87056499f..a00fb3545 100644 --- a/ui/app/components/send/send.container.js +++ b/ui/app/components/send/send.container.js @@ -37,6 +37,9 @@ import { updateSendErrors, } from '../../ducks/send.duck' import { + fetchGasEstimates, +} from '../../ducks/gas.duck' +import { calcGasTotal, } from './send.utils.js' @@ -104,5 +107,6 @@ function mapDispatchToProps (dispatch) { scanQrCode: () => dispatch(showQrScanner(SEND_ROUTE)), qrCodeDetected: (data) => dispatch(qrCodeDetected(data)), updateSendTo: (to, nickname) => dispatch(updateSendTo(to, nickname)), + fetchGasEstimates: () => dispatch(fetchGasEstimates()), } } diff --git a/ui/app/components/send/tests/send-component.test.js b/ui/app/components/send/tests/send-component.test.js index bd136a0b8..0f3902c07 100644 --- a/ui/app/components/send/tests/send-component.test.js +++ b/ui/app/components/send/tests/send-component.test.js @@ -13,6 +13,7 @@ const propsMethodSpies = { updateSendErrors: sinon.spy(), updateSendTokenBalance: sinon.spy(), resetSendState: sinon.spy(), + fetchGasEstimates: sinon.spy(), } const utilsMethodStubs = { getAmountErrorObject: sinon.stub().returns({ amount: 'mockAmountError' }), @@ -37,6 +38,7 @@ describe('Send Component', function () { blockGasLimit={'mockBlockGasLimit'} conversionRate={10} editingTransactionId={'mockEditingTransactionId'} + fetchGasEstimates={propsMethodSpies.fetchGasEstimates} from={ { address: 'mockAddress', balance: 'mockBalance' } } gasLimit={'mockGasLimit'} gasPrice={'mockGasPrice'} @@ -63,6 +65,7 @@ describe('Send Component', function () { utilsMethodStubs.doesAmountErrorRequireUpdate.resetHistory() utilsMethodStubs.getAmountErrorObject.resetHistory() utilsMethodStubs.getGasFeeErrorObject.resetHistory() + propsMethodSpies.fetchGasEstimates.resetHistory() propsMethodSpies.updateAndSetGasTotal.resetHistory() propsMethodSpies.updateSendErrors.resetHistory() propsMethodSpies.updateSendTokenBalance.resetHistory() @@ -82,6 +85,15 @@ describe('Send Component', function () { }) }) + describe('componentDidMount', () => { + it('should call props.fetchGasEstimates', () => { + propsMethodSpies.fetchGasEstimates.resetHistory() + assert.equal(propsMethodSpies.fetchGasEstimates.callCount, 0) + wrapper.instance().componentDidMount() + assert.equal(propsMethodSpies.fetchGasEstimates.callCount, 1) + }) + }) + describe('componentWillUnmount', () => { it('should call this.props.resetSendState', () => { propsMethodSpies.resetSendState.resetHistory() |