Skip to content

Commit

Permalink
Merge pull request #2420 from LiskHQ/2415-fix-send-summary-amount-locale
Browse files Browse the repository at this point in the history
Fix German locale of amount on send summary - Closes #2415
  • Loading branch information
slaweet authored Sep 6, 2019
2 parents 34020ff + 40c7159 commit 3443536
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/components/send/summary/summary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { fromRawLsk, toRawLsk } from '../../../utils/lsk';
import { formatAmountBasedOnLocale } from '../../../utils/formattedNumber';
import { loginType } from '../../../constants/hwConstants';
import { tokenMap } from '../../../constants/tokens';
import AccountVisual from '../../accountVisual/index';
Expand Down Expand Up @@ -74,9 +73,7 @@ class Summary extends React.Component {
const {
fields, t, token, account,
} = this.props;

const amount = formatAmountBasedOnLocale({ value: fields.amount.value });

const amount = fields.amount.value;
const fee = token === tokenMap.LSK.key
? fromRawLsk(fees.send)
: fromRawLsk(fields.processingSpeed.txFee);
Expand Down Expand Up @@ -115,7 +112,7 @@ class Summary extends React.Component {
<label>{t('Amount')}</label>
<label className="amount-summary">
{`${amount} ${token}`}
<Converter className={styles.secondText} value={fields.amount.value} />
<Converter className={styles.secondText} value={amount} />
</label>
</section>
{ fields.reference && fields.reference.value
Expand Down
25 changes: 20 additions & 5 deletions src/components/send/summary/summary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { mount } from 'enzyme';
import PropTypes from 'prop-types';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import i18n from '../../../i18n';
import accounts from '../../../../test/constants/accounts';
import Summary from './summary';
import { tokenMap } from '../../../constants/tokens';
import Summary from './summary';
import accounts from '../../../../test/constants/accounts';
import i18n from '../../../i18n';

describe('Summary', () => {
let wrapper;
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Summary', () => {

beforeEach(() => {
props = {
t: v => v,
t: i18n.t,
account: {
address: accounts.second_passphrase_account.address,
secondPublicKey: accounts.second_passphrase_account.secondPublicKey,
Expand All @@ -70,7 +70,7 @@ describe('Summary', () => {
address: '123123L',
},
amount: {
value: 1,
value: '1.123',
},
reference: {
value: 1,
Expand Down Expand Up @@ -105,6 +105,21 @@ describe('Summary', () => {
expect(wrapper).toContainMatchingElement('.summary-content');
expect(wrapper).toContainMatchingElement('.summary-footer');
expect(wrapper).toContainMatchingElement('.summary-second-passphrase');
expect(wrapper.find('button.confirm-button')).toHaveText('Send 1.123 LSK');
expect(wrapper.find('.amount-summary')).toIncludeText('1.123 LSK');
});

it('should render German decimal point properly', () => {
wrapper.setProps({
fields: {
...props.fields,
amount: {
value: '1,123',
},
},
});
expect(wrapper.find('button.confirm-button')).toHaveText('Send 1,123 LSK');
expect(wrapper.find('.amount-summary')).toIncludeText('1,123 LSK');
});

it('should goind to previous page', () => {
Expand Down

0 comments on commit 3443536

Please sign in to comment.