Permalink
Browse files

restart functionality

  • Loading branch information...
teropa committed Sep 6, 2015
1 parent 59a8b52 commit f314bcecd235f1aa374e71252a7e207411daf50c
Showing with 24 additions and 0 deletions.
  1. +7 −0 src/action_creators.js
  2. +4 −0 src/components/Results.jsx
  3. +13 −0 test/components/Results_spec.js
View
@@ -26,3 +26,10 @@ export function next() {
type: 'NEXT'
};
}
export function restart() {
return {
meta: {remote: true},
type: 'RESTART'
};
}
@@ -39,6 +39,10 @@ export const Results = React.createClass({
)}
</div>
<div className="management">
<button ref="restart"
onClick={this.props.restart}>
Restart
</button>
<button ref="next"
className="next"
onClick={this.props.next}>
@@ -39,6 +39,19 @@ describe('Results', () => {
expect(nextInvoked).to.equal(true);
});
it('invokes action callback when restart button is clicked', () => {
let restartInvoked = false;
const pair = List.of('Trainspotting', '28 Days Later');
const component = renderIntoDocument(
<Results pair={pair}
tally={Map()}
restart={() => restartInvoked = true}/>
);
Simulate.click(React.findDOMNode(component.refs.restart));

This comment has been minimized.

Show comment
Hide comment
@kwhitejr

kwhitejr Jun 4, 2016

Line 50 should be:

Simulate.click(ReactDOM.findDOMNode(component.refs.restart));

React --> ReactDOM

@kwhitejr

kwhitejr Jun 4, 2016

Line 50 should be:

Simulate.click(ReactDOM.findDOMNode(component.refs.restart));

React --> ReactDOM

expect(restartInvoked).to.equal(true);
});
it('renders the winner when there is one', () => {
const component = renderIntoDocument(
<Results winner="Trainspotting"

0 comments on commit f314bce

Please sign in to comment.