aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/app/util.js2
-rw-r--r--ui/test/unit/util_test.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/ui/app/util.js b/ui/app/util.js
index 67b7c8f67..18862fade 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -71,7 +71,7 @@ function formatBalance(balance) {
var padded = wei.toString(10)
var len = padded.length
var nonZeroIndex = padded.match(/[^0]/) && padded.match(/[^0]/).index
- var beforeDecimal = padded.substr(nonZeroIndex ? nonZeroIndex : 0, len - 18)
+ var beforeDecimal = padded.substr(nonZeroIndex ? nonZeroIndex : 0, len - 18) || '0'
var afterDecimal = padded.substr(len - 18, decimalsToKeep)
return `${beforeDecimal}.${afterDecimal} ETH`
}
diff --git a/ui/test/unit/util_test.js b/ui/test/unit/util_test.js
index 7e34bba1c..b35d60812 100644
--- a/ui/test/unit/util_test.js
+++ b/ui/test/unit/util_test.js
@@ -71,7 +71,7 @@ describe('util', function() {
it('should return eth as string followed by ETH', function() {
var input = new ethUtil.BN(ethInWei, 10).div(new ethUtil.BN('2', 10)).toJSON()
var result = util.formatBalance(input)
- assert.equal(result, '.5000 ETH')
+ assert.equal(result, '0.5000 ETH')
})
it('should display four decimal points', function() {