diff options
Diffstat (limited to 'ui/app/components/send/send-content/send-gas-row/gas-fee-display')
3 files changed, 0 insertions, 119 deletions
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 deleted file mode 100644 index b667aa037..000000000 --- a/ui/app/components/send/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js +++ /dev/null @@ -1,57 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import UserPreferencedCurrencyDisplay from '../../../../user-preferenced-currency-display' -import { PRIMARY, SECONDARY } from '../../../../../constants/common' - -export default class GasFeeDisplay extends Component { - - static propTypes = { - conversionRate: PropTypes.number, - primaryCurrency: PropTypes.string, - convertedCurrency: PropTypes.string, - gasLoadingError: PropTypes.bool, - gasTotal: PropTypes.string, - onReset: PropTypes.func, - }; - - static contextTypes = { - t: PropTypes.func, - }; - - render () { - const { gasTotal, gasLoadingError, onReset } = this.props - - return ( - <div className="send-v2__gas-fee-display"> - {gasTotal - ? ( - <div className="currency-display"> - <UserPreferencedCurrencyDisplay - value={gasTotal} - type={PRIMARY} - /> - <UserPreferencedCurrencyDisplay - className="currency-display__converted-value" - value={gasTotal} - type={SECONDARY} - /> - </div> - ) - : gasLoadingError - ? <div className="currency-display.currency-display--message"> - {this.context.t('setGasPrice')} - </div> - : <div className="currency-display"> - {this.context.t('loading')} - </div> - } - <button - className="gas-fee-reset" - onClick={onReset} - > - { this.context.t('reset') } - </button> - </div> - ) - } -} diff --git a/ui/app/components/send/send-content/send-gas-row/gas-fee-display/index.js b/ui/app/components/send/send-content/send-gas-row/gas-fee-display/index.js deleted file mode 100644 index dba0edb7b..000000000 --- a/ui/app/components/send/send-content/send-gas-row/gas-fee-display/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './gas-fee-display.component' 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 deleted file mode 100644 index cb4180508..000000000 --- a/ui/app/components/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react' -import assert from 'assert' -import {shallow} from 'enzyme' -import GasFeeDisplay from '../gas-fee-display.component' -import UserPreferencedCurrencyDisplay from '../../../../../user-preferenced-currency-display' -import sinon from 'sinon' - - -const propsMethodSpies = { - showCustomizeGasModal: sinon.spy(), - onReset: sinon.spy(), -} - -describe('GasFeeDisplay Component', function () { - let wrapper - - beforeEach(() => { - wrapper = shallow(<GasFeeDisplay - conversionRate={20} - gasTotal={'mockGasTotal'} - primaryCurrency={'mockPrimaryCurrency'} - convertedCurrency={'mockConvertedCurrency'} - showGasButtonGroup={propsMethodSpies.showCustomizeGasModal} - onReset={propsMethodSpies.onReset} - />, {context: {t: str => str + '_t'}}) - }) - - afterEach(() => { - propsMethodSpies.showCustomizeGasModal.resetHistory() - }) - - describe('render', () => { - it('should render a CurrencyDisplay component', () => { - assert.equal(wrapper.find(UserPreferencedCurrencyDisplay).length, 2) - }) - - it('should render the CurrencyDisplay with the correct props', () => { - const { - type, - value, - } = wrapper.find(UserPreferencedCurrencyDisplay).at(0).props() - assert.equal(type, 'PRIMARY') - assert.equal(value, 'mockGasTotal') - }) - - it('should render the reset button with the correct props', () => { - const { - onClick, - className, - } = wrapper.find('button').props() - assert.equal(className, 'gas-fee-reset') - assert.equal(propsMethodSpies.onReset.callCount, 0) - onClick() - assert.equal(propsMethodSpies.onReset.callCount, 1) - }) - - it('should render the reset button with the correct text', () => { - assert.equal(wrapper.find('button').text(), 'reset_t') - }) - }) -}) |