From aa6855434de199fa68e09125d0ea5642db759249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 15:10:57 +0200 Subject: [PATCH] Emit `submitted` from PasswordReset component --- .../PasswordReset/PasswordReset.spec.js | 19 +++---- .../PasswordReset/PasswordReset.vue | 6 ++- .../PasswordReset/VerifyCode.spec.js | 50 +++++++++++++++++++ .../components/PasswordReset/VerifyCode.vue | 9 ++++ webapp/locales/de.json | 5 ++ webapp/locales/en.json | 5 ++ 6 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 webapp/components/PasswordReset/VerifyCode.spec.js create mode 100644 webapp/components/PasswordReset/VerifyCode.vue diff --git a/webapp/components/PasswordReset/PasswordReset.spec.js b/webapp/components/PasswordReset/PasswordReset.spec.js index e55b9273a..6284fed36 100644 --- a/webapp/components/PasswordReset/PasswordReset.spec.js +++ b/webapp/components/PasswordReset/PasswordReset.spec.js @@ -6,7 +6,7 @@ const localVue = createLocalVue() localVue.use(Styleguide) -describe('ProfileSlug', () => { +describe('PasswordReset', () => { let wrapper let Wrapper let mocks @@ -26,6 +26,8 @@ describe('ProfileSlug', () => { }) describe('mount', () => { + beforeEach(jest.useFakeTimers) + Wrapper = () => { return mount(PasswordReset, { mocks, @@ -35,7 +37,7 @@ describe('ProfileSlug', () => { it('renders a password reset form', () => { wrapper = Wrapper() - expect(wrapper.find('.password-reset-card').exists()).toBe(true) + expect(wrapper.find('.password-reset').exists()).toBe(true) }) describe('submit', () => { @@ -62,14 +64,13 @@ describe('ProfileSlug', () => { const expected = ['password-reset.form.submitted', { email: 'mail@example.org' }] expect(mocks.$t).toHaveBeenCalledWith(...expected) }) - }) - describe('given password reset token as URL param', () => { - it.todo('displays a form to update your password') - describe('submitting new password', () => { - it.todo('calls resetPassword graphql mutation') - it.todo('delivers new password to backend') - it.todo('displays success message') + describe('after animation', () => { + beforeEach(jest.runAllTimers) + + it('emits `submitted`', () => { + expect(wrapper.emitted('submitted')).toBeTruthy() + }) }) }) }) diff --git a/webapp/components/PasswordReset/PasswordReset.vue b/webapp/components/PasswordReset/PasswordReset.vue index 7a74bbe31..175207949 100644 --- a/webapp/components/PasswordReset/PasswordReset.vue +++ b/webapp/components/PasswordReset/PasswordReset.vue @@ -1,5 +1,5 @@