diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-06-29 06:47:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 06:47:44 +0800 |
commit | 9f5ee94b6937c741684de5e70ac0f9fea5f50226 (patch) | |
tree | d8d83db95c24ec1be6a70077e168ac0131d12d22 /ui | |
parent | db548adca78c03ca6d8c9b7fa7c5471c7a46f5f8 (diff) | |
parent | f824a2982acec08241302b84d893e32e5c5f2dce (diff) | |
download | tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar.gz tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar.bz2 tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar.lz tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar.xz tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.tar.zst tangerine-wallet-browser-9f5ee94b6937c741684de5e70ac0f9fea5f50226.zip |
Merge pull request #4678 from MetaMask/e2e-beta-tests-upgrade
E2e beta tests upgrade
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/input-number.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/app/components/input-number.js b/ui/app/components/input-number.js index de5fcca54..59c6842ef 100644 --- a/ui/app/components/input-number.js +++ b/ui/app/components/input-number.js @@ -22,12 +22,16 @@ function isValidInput (text) { return re.test(text) } +function removeLeadingZeroes (str) { + return str.replace(/^0*(?=\d)/, '') +} + InputNumber.prototype.setValue = function (newValue) { + newValue = removeLeadingZeroes(newValue) if (newValue && !isValidInput(newValue)) return const { fixed, min = -1, max = Infinity, onChange } = this.props newValue = fixed ? newValue.toFixed(4) : newValue - const newValueGreaterThanMin = conversionGTE( { value: newValue || '0', fromNumericBase: 'dec' }, { value: min, fromNumericBase: 'hex' }, @@ -47,7 +51,7 @@ InputNumber.prototype.setValue = function (newValue) { } InputNumber.prototype.render = function () { - const { unitLabel, step = 1, placeholder, value = 0 } = this.props + const { unitLabel, step = 1, placeholder, value } = this.props return h('div.customize-gas-input-wrapper', {}, [ h('input', { @@ -63,11 +67,11 @@ InputNumber.prototype.render = function () { h('span.gas-tooltip-input-detail', {}, [unitLabel]), h('div.gas-tooltip-input-arrows', {}, [ h('i.fa.fa-angle-up', { - onClick: () => this.setValue(addCurrencies(value, step)), + onClick: () => this.setValue(addCurrencies(value, step, { toNumericBase: 'dec' })), }), h('i.fa.fa-angle-down', { style: { cursor: 'pointer' }, - onClick: () => this.setValue(subtractCurrencies(value, step)), + onClick: () => this.setValue(subtractCurrencies(value, step, { toNumericBase: 'dec' })), }), ]), ]) |