Skip to content

Commit

Permalink
♻️ Update send files after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Osvaldo Vega committed Mar 12, 2019
1 parent a5d87bf commit 8f48fb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/components/bookmarkV2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,25 @@ class Bookmark extends React.Component {
}

onKeyPressDownOrUp(action) {
const rowHeight = 44;
const { dropdownIndex } = this.state;
const accountsLength = this.getFilterList().length;

// istanbul ignore else
if (action === 'down' && dropdownIndex < accountsLength - 1) {
if (dropdownIndex + 1 >= 4) {
this.listContainerRef.scrollTop = this.listContainerRef.scrollTop + 44;
this.listContainerRef.scrollTop = this.listContainerRef.scrollTop + rowHeight;
}
this.setState({ dropdownIndex: dropdownIndex + 1 });
}

// istanbul ignore else
if (action === 'up' && dropdownIndex > 0) {
this.listContainerRef.scrollTop = this.listContainerRef.scrollTop > 0
&& (dropdownIndex - 1) * 44 < this.listContainerRef.scrollTop
? this.listContainerRef.scrollTop - 44
&& (dropdownIndex - 1) * rowHeight < this.listContainerRef.scrollTop
? this.listContainerRef.scrollTop - rowHeight
: this.listContainerRef.scrollTop;
this.setState({ dropdownIndex: this.state.dropdownIndex - 1 });
this.setState({ dropdownIndex: dropdownIndex - 1 });
}
}

Expand Down Expand Up @@ -105,7 +106,7 @@ class Bookmark extends React.Component {
this.props.validateBookmark();
}, 300);

if (e && e.target.value === '') this.resetListIndex();
if (e && e.target && e.target.value === '') this.resetListIndex();
this.props.onChange(e);
}

Expand Down
8 changes: 2 additions & 6 deletions src/components/sendV2/send.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,11 @@ describe('Form', () => {
});

it('should call finallCallback after submit a transaction', () => {
const bkm = { target: { name: 'recipient', value: '12345L' } };
const amount = { target: { name: 'amount', value: '.1' } };

wrapper.find('input.recipient').simulate('change', bkm);
wrapper.find('input.recipient').simulate('change', { target: { name: 'recipient', value: '12345L' } });
const amountField = wrapper.find('.fieldGroup').at(1);
amountField.find('InputV2').simulate('change', amount);
amountField.find('InputV2').simulate('change', { target: { name: 'amount', value: '.1' } });
jest.advanceTimersByTime(300);
wrapper.update();

wrapper.find('.btn-submit').at(0).simulate('click');
wrapper.update();
expect(wrapper).toContainMatchingElement('Summary');
Expand Down
4 changes: 2 additions & 2 deletions src/components/sendV2/transactionStatus/transactionStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class TransactionStatus extends React.Component {
{
!isTransactionSuccess
? <div className={`${styles.errorReport} transaction-status-error`}>
<span>{this.props.t('Is the problem presisting?')}</span>
<span>{this.props.t('Does the problem still persist?')}</span>
<a
href={this.onErrorReport()}
target='_top'
rel='noopener noreferrer'>
{this.props.t('Report the error via email')}
{this.props.t('Report the error via E-Mail')}
</a>
</div>
: null
Expand Down

0 comments on commit 8f48fb2

Please sign in to comment.