aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_
diff options
context:
space:
mode:
authorTrejGun <trejgun@gmail.com>2018-07-05 11:34:13 +0800
committerTrejGun <trejgun@gmail.com>2018-07-05 11:34:13 +0800
commit94d1d846fb57932fd1e959f53dbf6444f0789e91 (patch)
tree369276cd66bdcae85cac77b2c9b2458de5b08dd7 /ui/app/components/send_
parentc94f639de55a867ebe8d3599d337a1f7341b1979 (diff)
parentfd218142acb6dab0b2f921b9729f17ff90cffc2d (diff)
downloadtangerine-wallet-browser-94d1d846fb57932fd1e959f53dbf6444f0789e91.tar.gz
tangerine-wallet-browser-94d1d846fb57932fd1e959f53dbf6444f0789e91.tar.zst
tangerine-wallet-browser-94d1d846fb57932fd1e959f53dbf6444f0789e91.zip
Merge branch 'develop' into contextTypes
# Conflicts: # ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
Diffstat (limited to 'ui/app/components/send_')
-rw-r--r--ui/app/components/send_/account-list-item/index.js2
-rw-r--r--ui/app/components/send_/index.js2
-rw-r--r--ui/app/components/send_/send-content/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-dropdown-list/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-from-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-row-wrapper/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-to-row/index.js2
-rw-r--r--ui/app/components/send_/send-footer/index.js2
-rw-r--r--ui/app/components/send_/send-header/index.js2
-rw-r--r--ui/app/components/send_/send.utils.js5
-rw-r--r--ui/app/components/send_/send.utils.test.js30
18 files changed, 51 insertions, 16 deletions
diff --git a/ui/app/components/send_/account-list-item/index.js b/ui/app/components/send_/account-list-item/index.js
index 1fca540be..907485cf7 100644
--- a/ui/app/components/send_/account-list-item/index.js
+++ b/ui/app/components/send_/account-list-item/index.js
@@ -1 +1 @@
-export { default } from './account-list-item.container' \ No newline at end of file
+export { default } from './account-list-item.container'
diff --git a/ui/app/components/send_/index.js b/ui/app/components/send_/index.js
index 9a4dd5727..b5114babc 100644
--- a/ui/app/components/send_/index.js
+++ b/ui/app/components/send_/index.js
@@ -1 +1 @@
-export { default } from './send.container' \ No newline at end of file
+export { default } from './send.container'
diff --git a/ui/app/components/send_/send-content/index.js b/ui/app/components/send_/send-content/index.js
index 10b3c850e..891c17e6a 100644
--- a/ui/app/components/send_/send-content/index.js
+++ b/ui/app/components/send_/send-content/index.js
@@ -1 +1 @@
-export { default } from './send-content.component' \ No newline at end of file
+export { default } from './send-content.component'
diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
index 548b51f33..ee8271494 100644
--- a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
+++ b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
@@ -1 +1 @@
-export { default } from './amount-max-button.container' \ No newline at end of file
+export { default } from './amount-max-button.container'
diff --git a/ui/app/components/send_/send-content/send-amount-row/index.js b/ui/app/components/send_/send-content/send-amount-row/index.js
index 94a7da56f..abc6852fe 100644
--- a/ui/app/components/send_/send-content/send-amount-row/index.js
+++ b/ui/app/components/send_/send-content/send-amount-row/index.js
@@ -1 +1 @@
-export { default } from './send-amount-row.container' \ No newline at end of file
+export { default } from './send-amount-row.container'
diff --git a/ui/app/components/send_/send-content/send-dropdown-list/index.js b/ui/app/components/send_/send-content/send-dropdown-list/index.js
index ee7736376..04af6536c 100644
--- a/ui/app/components/send_/send-content/send-dropdown-list/index.js
+++ b/ui/app/components/send_/send-content/send-dropdown-list/index.js
@@ -1 +1 @@
-export { default } from './send-dropdown-list.component' \ No newline at end of file
+export { default } from './send-dropdown-list.component'
diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js b/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
index 6ab9a157a..2314ef4e3 100644
--- a/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
+++ b/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
@@ -1 +1 @@
-export { default } from './from-dropdown.component' \ No newline at end of file
+export { default } from './from-dropdown.component'
diff --git a/ui/app/components/send_/send-content/send-from-row/index.js b/ui/app/components/send_/send-content/send-from-row/index.js
index 4a0916dba..0a79726b2 100644
--- a/ui/app/components/send_/send-content/send-from-row/index.js
+++ b/ui/app/components/send_/send-content/send-from-row/index.js
@@ -1 +1 @@
-export { default } from './send-from-row.container' \ No newline at end of file
+export { default } from './send-from-row.container'
diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
index 67cd99741..bb9a94428 100644
--- a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
+++ b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
@@ -18,7 +18,7 @@ export default class GasFeeDisplay extends Component {
t: PropTypes.func,
};
- render() {
+ render () {
const {
conversionRate,
gasTotal,
diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
index 66f3a94df..7cbe8d0df 100644
--- a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
@@ -10,7 +10,7 @@ const propsMethodSpies = {
showCustomizeGasModal: sinon.spy(),
}
-describe('SendGasRow Component', function() {
+describe('SendGasRow Component', function () {
let wrapper
beforeEach(() => {
diff --git a/ui/app/components/send_/send-content/send-gas-row/index.js b/ui/app/components/send_/send-content/send-gas-row/index.js
index 060ed7fd3..3c7ff1d5f 100644
--- a/ui/app/components/send_/send-content/send-gas-row/index.js
+++ b/ui/app/components/send_/send-content/send-gas-row/index.js
@@ -1 +1 @@
-export { default } from './send-gas-row.container' \ No newline at end of file
+export { default } from './send-gas-row.container'
diff --git a/ui/app/components/send_/send-content/send-row-wrapper/index.js b/ui/app/components/send_/send-content/send-row-wrapper/index.js
index 5715f55c6..d17545dcc 100644
--- a/ui/app/components/send_/send-content/send-row-wrapper/index.js
+++ b/ui/app/components/send_/send-content/send-row-wrapper/index.js
@@ -1 +1 @@
-export { default } from './send-row-wrapper.component' \ No newline at end of file
+export { default } from './send-row-wrapper.component'
diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
index bf49c55bd..c00617f83 100644
--- a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
+++ b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
@@ -1 +1 @@
-export { default } from './send-row-error-message.container' \ No newline at end of file
+export { default } from './send-row-error-message.container'
diff --git a/ui/app/components/send_/send-content/send-to-row/index.js b/ui/app/components/send_/send-content/send-to-row/index.js
index 4e7aa9747..121f15148 100644
--- a/ui/app/components/send_/send-content/send-to-row/index.js
+++ b/ui/app/components/send_/send-content/send-to-row/index.js
@@ -1 +1 @@
-export { default } from './send-to-row.container' \ No newline at end of file
+export { default } from './send-to-row.container'
diff --git a/ui/app/components/send_/send-footer/index.js b/ui/app/components/send_/send-footer/index.js
index cd1727330..58e91d622 100644
--- a/ui/app/components/send_/send-footer/index.js
+++ b/ui/app/components/send_/send-footer/index.js
@@ -1 +1 @@
-export { default } from './send-footer.container' \ No newline at end of file
+export { default } from './send-footer.container'
diff --git a/ui/app/components/send_/send-header/index.js b/ui/app/components/send_/send-header/index.js
index b808eabbf..0b17f0b7d 100644
--- a/ui/app/components/send_/send-header/index.js
+++ b/ui/app/components/send_/send-header/index.js
@@ -1 +1 @@
-export { default } from './send-header.container' \ No newline at end of file
+export { default } from './send-header.container'
diff --git a/ui/app/components/send_/send.utils.js b/ui/app/components/send_/send.utils.js
index 872df1d2f..34275248f 100644
--- a/ui/app/components/send_/send.utils.js
+++ b/ui/app/components/send_/send.utils.js
@@ -33,6 +33,7 @@ module.exports = {
getToAddressForGasUpdate,
isBalanceSufficient,
isTokenBalanceSufficient,
+ removeLeadingZeroes,
}
function calcGasTotal (gasLimit, gasPrice) {
@@ -276,3 +277,7 @@ function estimateGasPriceFromRecentBlocks (recentBlocks) {
function getToAddressForGasUpdate (...addresses) {
return [...addresses, ''].find(str => str !== undefined && str !== null).toLowerCase()
}
+
+function removeLeadingZeroes (str) {
+ return str.replace(/^0*(?=\d)/, '')
+}
diff --git a/ui/app/components/send_/send.utils.test.js b/ui/app/components/send_/send.utils.test.js
new file mode 100644
index 000000000..36f3a5c10
--- /dev/null
+++ b/ui/app/components/send_/send.utils.test.js
@@ -0,0 +1,30 @@
+import assert from 'assert'
+import { removeLeadingZeroes } from './send.utils'
+
+
+describe('send utils', () => {
+ describe('removeLeadingZeroes()', () => {
+ it('should remove leading zeroes from int when user types', () => {
+ assert.equal(removeLeadingZeroes('0'), '0')
+ assert.equal(removeLeadingZeroes('1'), '1')
+ assert.equal(removeLeadingZeroes('00'), '0')
+ assert.equal(removeLeadingZeroes('01'), '1')
+ })
+
+ it('should remove leading zeroes from int when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('001'), '1')
+ })
+
+ it('should remove leading zeroes from float when user types', () => {
+ assert.equal(removeLeadingZeroes('0.'), '0.')
+ assert.equal(removeLeadingZeroes('0.0'), '0.0')
+ assert.equal(removeLeadingZeroes('0.00'), '0.00')
+ assert.equal(removeLeadingZeroes('0.001'), '0.001')
+ assert.equal(removeLeadingZeroes('0.10'), '0.10')
+ })
+
+ it('should remove leading zeroes from float when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('00.1'), '0.1')
+ })
+ })
+})