From 7be03150100d319c6d373241f614a29b374cb74d Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 30 Mar 2017 17:23:41 -0300 Subject: [#935] Submits user recovery code to new endpoint with @deniscostadsc --- .../user_recovery_code_form/user_recovery_code_form.js | 10 +++++++--- .../user_recovery_code_form/user_recovery_code_form.spec.js | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'web-ui/src/account_recovery/user_recovery_code_form') diff --git a/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.js b/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.js index a4119885..c39c894d 100644 --- a/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.js +++ b/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.js @@ -24,7 +24,7 @@ import BackLink from 'src/common/back_link/back_link'; import './user_recovery_code_form.scss'; -export const UserRecoveryCodeForm = ({ t, previous, next }) => ( +export const UserRecoveryCodeForm = ({ t, previous, next, saveCode }) => (
( />

{t('account-recovery.user-form.description')}

- + @@ -49,7 +52,8 @@ export const UserRecoveryCodeForm = ({ t, previous, next }) => ( UserRecoveryCodeForm.propTypes = { t: React.PropTypes.func.isRequired, previous: React.PropTypes.func.isRequired, - next: React.PropTypes.func.isRequired + next: React.PropTypes.func.isRequired, + saveCode: React.PropTypes.func.isRequired }; export default translate('', { wait: true })(UserRecoveryCodeForm); diff --git a/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.spec.js b/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.spec.js index e47f2e6c..386c3a19 100644 --- a/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.spec.js +++ b/web-ui/src/account_recovery/user_recovery_code_form/user_recovery_code_form.spec.js @@ -7,14 +7,17 @@ describe('UserRecoveryCodeForm', () => { let userRecoveryCodeForm; let mockNext; let mockPrevious; + let mockSaveCode; beforeEach(() => { const mockTranslations = key => key; mockNext = expect.createSpy(); mockPrevious = expect.createSpy(); + mockSaveCode = expect.createSpy(); userRecoveryCodeForm = shallow( ); }); @@ -44,4 +47,9 @@ describe('UserRecoveryCodeForm', () => { userRecoveryCodeForm.find('BackLink').simulate('click'); expect(mockPrevious).toHaveBeenCalled(); }); + + it('saves code on input change', () => { + userRecoveryCodeForm.find('InputField').simulate('change', '123'); + expect(mockSaveCode).toHaveBeenCalledWith('123'); + }); }); -- cgit v1.2.3