diff options
Diffstat (limited to 'web-ui/src/account_recovery/forms/new_password_form.spec.js')
-rw-r--r-- | web-ui/src/account_recovery/forms/new_password_form.spec.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web-ui/src/account_recovery/forms/new_password_form.spec.js b/web-ui/src/account_recovery/forms/new_password_form.spec.js index a2986165..f9e54cc8 100644 --- a/web-ui/src/account_recovery/forms/new_password_form.spec.js +++ b/web-ui/src/account_recovery/forms/new_password_form.spec.js @@ -5,11 +5,13 @@ import { NewPasswordForm } from 'src/account_recovery/forms/new_password_form'; describe('NewPasswordForm', () => { let newPasswordForm; + let mockPrevious; beforeEach(() => { const mockTranslations = key => key; + mockPrevious = expect.createSpy(); newPasswordForm = shallow( - <NewPasswordForm t={mockTranslations} /> + <NewPasswordForm t={mockTranslations} previous={mockPrevious} /> ); }); @@ -28,4 +30,14 @@ describe('NewPasswordForm', () => { it('renders submit button', () => { expect(newPasswordForm.find('SubmitButton').props().buttonText).toEqual('account-recovery.new-password-form.button'); }); + + it('returns to previous step on link click', () => { + newPasswordForm.find('BackLink').simulate('click'); + expect(mockPrevious).toHaveBeenCalled(); + }); + + it('returns to previous step on key down', () => { + newPasswordForm.find('BackLink').simulate('keyDown'); + expect(mockPrevious).toHaveBeenCalled(); + }); }); |