diff options
author | Dan <danjm.com@gmail.com> | 2018-06-22 00:29:20 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-06-27 21:31:26 +0800 |
commit | f5d43404dc35a849dcb9dc9f5d87f183be0aff0b (patch) | |
tree | 556d967d9eb31f0d2ba4db14645e6184d45fbb96 /ui/app/components | |
parent | bdf9cd8e3ad0ba126f452f0ff2d7f52f25eb249e (diff) | |
download | dexon-wallet-f5d43404dc35a849dcb9dc9f5d87f183be0aff0b.tar.gz dexon-wallet-f5d43404dc35a849dcb9dc9f5d87f183be0aff0b.tar.zst dexon-wallet-f5d43404dc35a849dcb9dc9f5d87f183be0aff0b.zip |
Fix send token tests in beta ui e2e tests.
Diffstat (limited to 'ui/app/components')
-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 de5fcca5..59c6842e 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' })), }), ]), ]) |