diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-10-05 10:26:41 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-10-05 10:26:41 +0800 |
commit | 50d91f998d0dc228c1d5dac7966df89d6c3fe6c4 (patch) | |
tree | ebef0d63c5010a92b2032c6b9b2c69fcbdfaa4cb /ui/app/helpers | |
parent | b2939e86277a548ea05c83147ca913b8bcf0be65 (diff) | |
download | tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar.gz tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar.bz2 tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar.lz tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar.xz tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.tar.zst tangerine-wallet-browser-50d91f998d0dc228c1d5dac7966df89d6c3fe6c4.zip |
Translate method names in the transaction list only when applicable
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/common.util.js | 5 | ||||
-rw-r--r-- | ui/app/helpers/tests/common.util.test.js | 23 | ||||
-rw-r--r-- | ui/app/helpers/transactions.util.js | 2 |
3 files changed, 28 insertions, 2 deletions
diff --git a/ui/app/helpers/common.util.js b/ui/app/helpers/common.util.js new file mode 100644 index 000000000..d4acb9968 --- /dev/null +++ b/ui/app/helpers/common.util.js @@ -0,0 +1,5 @@ +export function camelCaseToCapitalize (str) { + return str + .replace(/([A-Z])/g, ' $1') + .replace(/^./, str => str.toUpperCase()) +} diff --git a/ui/app/helpers/tests/common.util.test.js b/ui/app/helpers/tests/common.util.test.js new file mode 100644 index 000000000..891e19ef5 --- /dev/null +++ b/ui/app/helpers/tests/common.util.test.js @@ -0,0 +1,23 @@ +import * as utils from '../common.util' +import assert from 'assert' + +describe('Common utils', () => { + describe('camelCaseToCapitalize', () => { + it('should return a capitalized string from a camel-cased string', () => { + const tests = [ + { + test: '', + expected: '', + }, + { + test: 'thisIsATest', + expected: 'This Is A Test', + }, + ] + + tests.forEach(({ test, expected }) => { + assert.equal(utils.camelCaseToCapitalize(test), expected) + }) + }) + }) +}) diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js index 8b87bb538..fdad63a96 100644 --- a/ui/app/helpers/transactions.util.js +++ b/ui/app/helpers/transactions.util.js @@ -80,8 +80,6 @@ export async function getTransactionActionKey (transaction, methodData) { return APPROVE_ACTION_KEY case TOKEN_METHOD_TRANSFER_FROM: return TRANSFER_FROM_ACTION_KEY - default: - return name } } else { return SEND_ETHER_ACTION_KEY |