Skip to content

Commit

Permalink
[#163518643]Add navigation handler
Browse files Browse the repository at this point in the history
  • Loading branch information
abayo-luc committed Apr 16, 2019
1 parent 4aab5cc commit 1340296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/__tests__/__views__/UpdatePassword.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ const [
mockIsMatch
] = new Array(4).fill(jest.fn());
const token = "1234567qwertyu";
const callback = jest.fn();
const props = {
isSubmitting: false,
password: "password",
confirmPassword: "password",
handleInputChange,
handleUpdatePassword,
errors: {},
location: { search: `?token=${token}` }
location: { search: `?token=${token}` },
history: { push: callback }
};
const warper = shallow(<UpdatePassword {...props} />);
const findElement = (element, index) => warper.find(element).at(index);
Expand Down
8 changes: 7 additions & 1 deletion src/views/UpdatePassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export class UpdatePassword extends Component {
});
};

handleNavigation = path => {
const { history } = this.props;
history.push(`/${path}`);
};

render() {
const { password, confirmPassword, isSubmitting } = this.props;
const { errors } = this.state;
Expand Down Expand Up @@ -131,7 +136,8 @@ UpdatePassword.propTypes = {
handleInputChange: PropTypes.func.isRequired,
handleUpdatePassword: PropTypes.func.isRequired,
errors: PropTypes.object.isRequired,
location: PropTypes.object.isRequired
location: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
};
export default connect(
mapStateToProps,
Expand Down

0 comments on commit 1340296

Please sign in to comment.