From 92f366ee2c6c43a3474f44e6fea85dae94b6ee23 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 13 Sep 2017 13:29:55 +0200 Subject: [PATCH] Don't show pending votes in voting dialog - Closes #741 --- src/components/voteDialog/index.js | 4 ++-- src/components/voteDialog/index.test.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/voteDialog/index.js b/src/components/voteDialog/index.js index 28f3c89eb..4e0551923 100644 --- a/src/components/voteDialog/index.js +++ b/src/components/voteDialog/index.js @@ -3,8 +3,8 @@ import { votePlaced, addedToVoteList, removedFromVoteList } from '../../actions/ import VoteDialog from './voteDialog'; const mapStateToProps = state => ({ - votedList: state.voting.votedList, - unvotedList: state.voting.unvotedList, + votedList: state.voting.votedList.filter(item => !item.pending), + unvotedList: state.voting.unvotedList.filter(item => !item.pending), account: state.account, activePeer: state.peers.data, }); diff --git a/src/components/voteDialog/index.test.js b/src/components/voteDialog/index.test.js index 86e8c8657..b90d575c9 100644 --- a/src/components/voteDialog/index.test.js +++ b/src/components/voteDialog/index.test.js @@ -40,8 +40,8 @@ const unvotedList = [ const store = configureMockStore([])({ account: ordinaryAccount, voting: { - votedList, - unvotedList, + votedList: [...votedList, { pending: true, username: 'pending' }], + unvotedList: [...unvotedList, { pending: true, username: 'pending2' }], }, peers: { data: {} }, }); @@ -59,8 +59,8 @@ describe('VoteDialog HOC', () => { it('should pass appropriate properties to VoteDialog', () => { const confirmVotesProps = wrapper.find('VoteDialog').props(); - expect(confirmVotesProps.votedList).to.be.equal(votedList); - expect(confirmVotesProps.unvotedList).to.be.equal(unvotedList); + expect(confirmVotesProps.votedList).to.be.deep.equal(votedList); + expect(confirmVotesProps.unvotedList).to.be.deep.equal(unvotedList); expect(confirmVotesProps.account).to.be.equal(ordinaryAccount); expect(confirmVotesProps.activePeer).to.deep.equal({}); expect(typeof confirmVotesProps.votePlaced).to.be.equal('function');