Skip to content

Commit

Permalink
save progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Matvejev committed Sep 15, 2017
1 parent 18f3ddb commit 1602749
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/handler/game_results_handler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ export default class GameResultsHandler extends Component {
}
};

// componentWillMount() {
// document.addEventListener("keydown", this.keyDownEventHandler.bind(this));
// }
//
// componentWillUnmount() {
// document.removeEventListener("keydown", this.keyDownEventHandler.bind(this));
// }
componentWillMount() {
document.addEventListener("keydown", this.keyDownEventHandler.bind(this));
}

componentWillUnmount() {
document.removeEventListener("keydown", this.keyDownEventHandler.bind(this));
}

static propTyps = {
label: PropTypes.string,
Expand Down
8 changes: 8 additions & 0 deletions src/handler/game_results_handler.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ describe(`handler:: <GameResultsHandler/>`, () => {

expect(component.state().currentPage).toBe(2);
});

it(` - callback should modify state [currentPage]`, () => {
const component = mount(<GameResultsHandler currrentPage={1} totalPages={2}/>);

component.simulate('keydown', {code: 'ArrowRight'});

expect(component.state().currentPage).toBe(2);
});
});
});

0 comments on commit 1602749

Please sign in to comment.