Skip to content

Commit

Permalink
Merge pull request #856 from poanetwork/stop-countdown-timer-after-fi…
Browse files Browse the repository at this point in the history
…nalize-#850

(Fix) Stop countdown timer after finalize
  • Loading branch information
vbaranov authored May 8, 2018
2 parents 3dd13a0 + 73d1175 commit 559d364
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/invest/CountdownTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const CountdownTimer = ({

if (isFinalized) {
message = 'crowdsale has been finalized'
msToNextTick = 0
} else {
if (nextTick.type) {
if (nextTick.type === 'start') {
Expand Down
19 changes: 19 additions & 0 deletions src/components/invest/CountdownTimer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,23 @@ describe('CountdownTimer', () => {

expect(wrapper).toMatchSnapshot()
})

it(`Should stop countdown if crowdsale was finalized`, () => {
const wrapper = shallow(
<CountdownTimer
displaySeconds={false}
nextTick={{ type: 'start', order: 1 }}
tiersLength={2}
days={1}
hours={4}
minutes={45}
seconds={30}
msToNextTick={30445000}
onComplete={jest.fn()}
isFinalized={true}
/>
)

expect(wrapper.find('ReactCountdownClock').props().seconds).toBe(0)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ exports[`CountdownTimer Should render the component when the crowdsale was final
fontSize="auto"
onComplete={[Function]}
paused={false}
seconds={30.445}
seconds={0}
showMilliseconds={false}
size={270}
timeFormat="hms"
Expand Down

0 comments on commit 559d364

Please sign in to comment.