aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-04-16 00:42:20 +0800
committerDan Finlay <dan@danfinlay.com>2016-04-16 00:42:20 +0800
commit33dc68535de39166c92f80c0ffee03ca0424b34e (patch)
tree14e1d8aeb3b3401bc83767482df1c208ff4ab203
parentdac7406ff8dd614b7d4111f3c7fcbd8dc5dda489 (diff)
downloadtangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar.gz
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar.bz2
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar.lz
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar.xz
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.tar.zst
tangerine-wallet-browser-33dc68535de39166c92f80c0ffee03ca0424b34e.zip
Add leading zero to account balances
-rw-r--r--CHANGELOG.md2
-rw-r--r--ui/app/util.js2
-rw-r--r--ui/test/unit/util_test.js2
3 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25b59193b..1c3ed073a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@
- Corrected text above account list. Selected account is visible to all sites, not just the current domain.
- Merged the UI codebase into the main plugin codebase for simpler maintenance.
- Fix Ether display rounding error. Now rendering to four decimal points.
+- Fix some inpage synchronous methods
+- Change account rendering to show four decimals and a leading zero.
## 1.5.0 2016-04-13
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() {