Skip to content

Commit

Permalink
Merge pull request #855 from LiskHQ/843-close-tx-detail-on-menu-click
Browse files Browse the repository at this point in the history
Close transaction detail on menu click - Closes #843
  • Loading branch information
gina contrino committed May 29, 2018
2 parents 3d6a3ff + 2b301c4 commit 4b29278
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/components/transactions/transactionDetailView.js
Expand Up @@ -22,15 +22,18 @@ class TransactionsDetailView extends React.Component {
const params = new URLSearchParams(search);
const transactionId = params.get('id');

if (props.peers.data &&
transactionId) {
if (props.peers.data && transactionId) {
this.props.loadTransaction({
activePeer: props.peers.data,
id: transactionId,
});
}
}

componentWillReceiveProps(nextProps) {
if (!nextProps.location.search) this.props.prevStep();
}

getVoters(dataName) {
let data = this.props.transaction.votesName && this.props.transaction.votesName[dataName];

Expand Down Expand Up @@ -118,10 +121,8 @@ class TransactionsDetailView extends React.Component {
this.props.prevStep ?
<header>
<h3>
<small className={`${styles.backButton} transaction-details-back-button`} onClick={() => {
this.props.history.push(this.props.history.location.pathname);
this.props.prevStep();
}}>
<small className={`${styles.backButton} transaction-details-back-button`}
onClick={() => this.props.history.push(this.props.history.location.pathname)}>
<FontIcon className={`${styles.arrow}`} value='arrow-left'/>
<span className={`${styles.text}`}>{this.props.t('Back to overview')}</span>
</small>
Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/transactionDetailView.test.js
Expand Up @@ -35,14 +35,14 @@ describe('TransactionDetailView', () => {
id: '',
},
match: { params: {} },
history: { push: () => {}, location: { search: '' } },
history: { push: spy(), location: { search: '' } },
};
const wrapper = mountWithContext(<TransactionDetailView {...props} />, context);
const expectedValue = /flexboxgrid__row/g;
const html = wrapper.html();
expect(html.match(expectedValue)).to.have.lengthOf(6);
wrapper.find('.transaction-details-back-button').simulate('click');
expect(props.prevStep).to.have.been.calledWith();
expect(props.history.push).to.have.been.calledWith();
});

it('should display 2 voter-address Links', () => {
Expand Down

0 comments on commit 4b29278

Please sign in to comment.