aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/account-list-item
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-06-20 23:48:23 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-07-16 23:28:32 +0800
commitb3d78ed8a1fbea059344b04416fb21bdb1b73f86 (patch)
tree6a2d8f6dda690961331c9bcbf5e2c6bf7102bced /ui/app/components/send_/account-list-item
parentf31e87dcd5cec09e81c741e311efc3793c9d9b98 (diff)
downloadtangerine-wallet-browser-b3d78ed8a1fbea059344b04416fb21bdb1b73f86.tar.gz
tangerine-wallet-browser-b3d78ed8a1fbea059344b04416fb21bdb1b73f86.tar.zst
tangerine-wallet-browser-b3d78ed8a1fbea059344b04416fb21bdb1b73f86.zip
Remove send_ directory, revert to just having send
Revert accidentally changed constants. Require defaults in ens-input, gas-fee-display and confirm screens.
Diffstat (limited to 'ui/app/components/send_/account-list-item')
-rw-r--r--ui/app/components/send_/account-list-item/account-list-item-README.md0
-rw-r--r--ui/app/components/send_/account-list-item/account-list-item.component.js73
-rw-r--r--ui/app/components/send_/account-list-item/account-list-item.container.js15
-rw-r--r--ui/app/components/send_/account-list-item/account-list-item.scss0
-rw-r--r--ui/app/components/send_/account-list-item/index.js1
-rw-r--r--ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js138
-rw-r--r--ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js32
7 files changed, 0 insertions, 259 deletions
diff --git a/ui/app/components/send_/account-list-item/account-list-item-README.md b/ui/app/components/send_/account-list-item/account-list-item-README.md
deleted file mode 100644
index e69de29bb..000000000
--- a/ui/app/components/send_/account-list-item/account-list-item-README.md
+++ /dev/null
diff --git a/ui/app/components/send_/account-list-item/account-list-item.component.js b/ui/app/components/send_/account-list-item/account-list-item.component.js
deleted file mode 100644
index 322246f61..000000000
--- a/ui/app/components/send_/account-list-item/account-list-item.component.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import React, { Component } from 'react'
-import PropTypes from 'prop-types'
-import { checksumAddress } from '../../../util'
-import Identicon from '../../identicon'
-import CurrencyDisplay from '../../send/currency-display'
-
-export default class AccountListItem extends Component {
-
- static propTypes = {
- account: PropTypes.object,
- className: PropTypes.string,
- conversionRate: PropTypes.number,
- currentCurrency: PropTypes.string,
- displayAddress: PropTypes.bool,
- displayBalance: PropTypes.bool,
- handleClick: PropTypes.func,
- icon: PropTypes.node,
- };
-
- static contextTypes = {
- t: PropTypes.func,
- };
-
- render () {
- const {
- account,
- className,
- conversionRate,
- currentCurrency,
- displayAddress = false,
- displayBalance = true,
- handleClick,
- icon = null,
- } = this.props
-
- const { name, address, balance } = account || {}
-
- return (<div
- className={`account-list-item ${className}`}
- onClick={() => handleClick({ name, address, balance })}
- >
-
- <div className="account-list-item__top-row">
- <Identicon
- address={address}
- className="account-list-item__identicon"
- diameter={18}
- />
-
- <div className="account-list-item__account-name">{ name || address }</div>
-
- {icon && <div className="account-list-item__icon">{ icon }</div>}
-
- </div>
-
- {displayAddress && name && <div className="account-list-item__account-address">
- { checksumAddress(address) }
- </div>}
-
- {displayBalance && <CurrencyDisplay
- className="account-list-item__account-balances"
- conversionRate={conversionRate}
- convertedBalanceClassName="account-list-item__account-secondary-balance"
- convertedCurrency={currentCurrency}
- primaryBalanceClassName="account-list-item__account-primary-balance"
- primaryCurrency="ETH"
- readOnly={true}
- value={balance}
- />}
-
- </div>)
- }
-}
diff --git a/ui/app/components/send_/account-list-item/account-list-item.container.js b/ui/app/components/send_/account-list-item/account-list-item.container.js
deleted file mode 100644
index 4b4519288..000000000
--- a/ui/app/components/send_/account-list-item/account-list-item.container.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { connect } from 'react-redux'
-import {
- getConversionRate,
- getCurrentCurrency,
-} from '../send.selectors.js'
-import AccountListItem from './account-list-item.component'
-
-export default connect(mapStateToProps)(AccountListItem)
-
-function mapStateToProps (state) {
- return {
- conversionRate: getConversionRate(state),
- currentCurrency: getCurrentCurrency(state),
- }
-}
diff --git a/ui/app/components/send_/account-list-item/account-list-item.scss b/ui/app/components/send_/account-list-item/account-list-item.scss
deleted file mode 100644
index e69de29bb..000000000
--- a/ui/app/components/send_/account-list-item/account-list-item.scss
+++ /dev/null
diff --git a/ui/app/components/send_/account-list-item/index.js b/ui/app/components/send_/account-list-item/index.js
deleted file mode 100644
index 907485cf7..000000000
--- a/ui/app/components/send_/account-list-item/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from './account-list-item.container'
diff --git a/ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js b/ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js
deleted file mode 100644
index bb7f3776c..000000000
--- a/ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js
+++ /dev/null
@@ -1,138 +0,0 @@
-import React from 'react'
-import assert from 'assert'
-import { shallow } from 'enzyme'
-import sinon from 'sinon'
-import proxyquire from 'proxyquire'
-import Identicon from '../../../identicon'
-import CurrencyDisplay from '../../../send/currency-display'
-
-const utilsMethodStubs = {
- checksumAddress: sinon.stub().returns('mockCheckSumAddress'),
-}
-
-const AccountListItem = proxyquire('../account-list-item.component.js', {
- '../../../util': utilsMethodStubs,
-}).default
-
-
-const propsMethodSpies = {
- handleClick: sinon.spy(),
-}
-
-describe('AccountListItem Component', function () {
- let wrapper
-
- beforeEach(() => {
- wrapper = shallow(<AccountListItem
- account={ { address: 'mockAddress', name: 'mockName', balance: 'mockBalance' } }
- className={'mockClassName'}
- conversionRate={4}
- currentCurrency={'mockCurrentyCurrency'}
- displayAddress={false}
- displayBalance={false}
- handleClick={propsMethodSpies.handleClick}
- icon={<i className="mockIcon" />}
- />, { context: { t: str => str + '_t' } })
- })
-
- afterEach(() => {
- propsMethodSpies.handleClick.resetHistory()
- })
-
- describe('render', () => {
- it('should render a div with the passed className', () => {
- assert.equal(wrapper.find('.mockClassName').length, 1)
- assert(wrapper.find('.mockClassName').is('div'))
- assert(wrapper.find('.mockClassName').hasClass('account-list-item'))
- })
-
- it('should call handleClick with the expected props when the root div is clicked', () => {
- const { onClick } = wrapper.find('.mockClassName').props()
- assert.equal(propsMethodSpies.handleClick.callCount, 0)
- onClick()
- assert.equal(propsMethodSpies.handleClick.callCount, 1)
- assert.deepEqual(
- propsMethodSpies.handleClick.getCall(0).args,
- [{ address: 'mockAddress', name: 'mockName', balance: 'mockBalance' }]
- )
- })
-
- it('should have a top row div', () => {
- assert.equal(wrapper.find('.mockClassName > .account-list-item__top-row').length, 1)
- assert(wrapper.find('.mockClassName > .account-list-item__top-row').is('div'))
- })
-
- it('should have an identicon, name and icon in the top row', () => {
- const topRow = wrapper.find('.mockClassName > .account-list-item__top-row')
- assert.equal(topRow.find(Identicon).length, 1)
- assert.equal(topRow.find('.account-list-item__account-name').length, 1)
- assert.equal(topRow.find('.account-list-item__icon').length, 1)
- })
-
- it('should show the account name if it exists', () => {
- const topRow = wrapper.find('.mockClassName > .account-list-item__top-row')
- assert.equal(topRow.find('.account-list-item__account-name').text(), 'mockName')
- })
-
- it('should show the account address if there is no name', () => {
- wrapper.setProps({ account: { address: 'addressButNoName' } })
- const topRow = wrapper.find('.mockClassName > .account-list-item__top-row')
- assert.equal(topRow.find('.account-list-item__account-name').text(), 'addressButNoName')
- })
-
- it('should render the passed icon', () => {
- const topRow = wrapper.find('.mockClassName > .account-list-item__top-row')
- assert(topRow.find('.account-list-item__icon').childAt(0).is('i'))
- assert(topRow.find('.account-list-item__icon').childAt(0).hasClass('mockIcon'))
- })
-
- it('should not render an icon if none is passed', () => {
- wrapper.setProps({ icon: null })
- const topRow = wrapper.find('.mockClassName > .account-list-item__top-row')
- assert.equal(topRow.find('.account-list-item__icon').length, 0)
- })
-
- it('should render the account address as a checksumAddress if displayAddress is true and name is provided', () => {
- wrapper.setProps({ displayAddress: true })
- assert.equal(wrapper.find('.account-list-item__account-address').length, 1)
- assert.equal(wrapper.find('.account-list-item__account-address').text(), 'mockCheckSumAddress')
- assert.deepEqual(
- utilsMethodStubs.checksumAddress.getCall(0).args,
- ['mockAddress']
- )
- })
-
- it('should not render the account address as a checksumAddress if displayAddress is false', () => {
- wrapper.setProps({ displayAddress: false })
- assert.equal(wrapper.find('.account-list-item__account-address').length, 0)
- })
-
- it('should not render the account address as a checksumAddress if name is not provided', () => {
- wrapper.setProps({ account: { address: 'someAddressButNoName' } })
- assert.equal(wrapper.find('.account-list-item__account-address').length, 0)
- })
-
- it('should render a CurrencyDisplay with the correct props if displayBalance is true', () => {
- wrapper.setProps({ displayBalance: true })
- assert.equal(wrapper.find(CurrencyDisplay).length, 1)
- assert.deepEqual(
- wrapper.find(CurrencyDisplay).props(),
- {
- className: 'account-list-item__account-balances',
- conversionRate: 4,
- convertedBalanceClassName: 'account-list-item__account-secondary-balance',
- convertedCurrency: 'mockCurrentyCurrency',
- primaryBalanceClassName: 'account-list-item__account-primary-balance',
- primaryCurrency: 'ETH',
- readOnly: true,
- value: 'mockBalance',
- }
- )
- })
-
- it('should not render a CurrencyDisplay if displayBalance is false', () => {
- wrapper.setProps({ displayBalance: false })
- assert.equal(wrapper.find(CurrencyDisplay).length, 0)
- })
- })
-})
diff --git a/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js b/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js
deleted file mode 100644
index af0859117..000000000
--- a/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import assert from 'assert'
-import proxyquire from 'proxyquire'
-
-let mapStateToProps
-
-proxyquire('../account-list-item.container.js', {
- 'react-redux': {
- connect: (ms, md) => {
- mapStateToProps = ms
- return () => ({})
- },
- },
- '../send.selectors.js': {
- getConversionRate: (s) => `mockConversionRate:${s}`,
- getCurrentCurrency: (s) => `mockCurrentCurrency:${s}`,
- },
-})
-
-describe('account-list-item container', () => {
-
- describe('mapStateToProps()', () => {
-
- it('should map the correct properties to props', () => {
- assert.deepEqual(mapStateToProps('mockState'), {
- conversionRate: 'mockConversionRate:mockState',
- currentCurrency: 'mockCurrentCurrency:mockState',
- })
- })
-
- })
-
-})