diff --git a/frontend/src/components/Inputs/InputPasswordConfirmation.vue b/frontend/src/components/Inputs/InputPasswordConfirmation.vue index 02b1796ef..f47f809c4 100644 --- a/frontend/src/components/Inputs/InputPasswordConfirmation.vue +++ b/frontend/src/components/Inputs/InputPasswordConfirmation.vue @@ -3,7 +3,6 @@ @@ -23,9 +22,8 @@ @@ -57,6 +55,11 @@ export default { passwordRepeat: '', } }, + methods: { + createId(text) { + return text.replace(/ +/g, '-') + }, + }, computed: { passwordObject() { return { password: this.password, passwordRepeat: this.passwordRepeat } diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js index 3d4c93897..581d132c1 100644 --- a/frontend/src/views/Pages/Register.spec.js +++ b/frontend/src/views/Pages/Register.spec.js @@ -65,11 +65,11 @@ describe('Register', () => { }) it('has password input fields', () => { - expect(wrapper.find('#inputPassword').exists()).toBeTruthy() + expect(wrapper.find('input[name="form.password_new"]').exists()).toBeTruthy() }) it('has password repeat input fields', () => { - expect(wrapper.find('#inputPasswordRepeat').exists()).toBeTruthy() + expect(wrapper.find('input[name="form.password_new_repeat"]').exists()).toBeTruthy() }) it('has 1 checkbox input fields', () => { @@ -80,30 +80,31 @@ describe('Register', () => { expect(wrapper.find('button[type="submit"]').exists()).toBe(false) }) - it('shows a warning when no valid Email is entered', async () => { - wrapper.find('#Email-input-field').setValue('no_valid@Email') + it('displays a message that Email is required', async () => { + await wrapper.find('form').trigger('submit') await flushPromises() - await expect(wrapper.find('#Email-input-field b-form-invalid-feedback').text()).toEqual( - 'validations.messages.email', + expect(wrapper.findAll('div.invalid-feedback').at(0).text()).toBe( + 'validations.messages.required', ) }) - it('shows 4 warnings when no password is set', async () => { - const passwords = wrapper.findAll('input[type="password"]') - passwords.at(0).setValue('') - passwords.at(1).setValue('') + it('displays a message that password is required', async () => { + await wrapper.find('form').trigger('submit') await flushPromises() - await expect(wrapper.find('div.hints').text()).toContain( - 'site.signup.lowercase', - 'site.signup.uppercase', - 'site.signup.minimum', - 'site.signup.one_number', + expect(wrapper.findAll('div.invalid-feedback').at(1).text()).toBe( + 'validations.messages.required', ) }) - // TODO test different invalid password combinations + it('displays a message that passwordConfirm is required', async () => { + await wrapper.find('form').trigger('submit') + await flushPromises() + expect(wrapper.findAll('div.invalid-feedback').at(2).text()).toBe( + 'validations.messages.required', + ) + }) }) - // TODO test submit button + // To Do: Test lines 156-197,210-213 }) }) diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index c9a0d8772..170365bdb 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -109,16 +109,7 @@ -
+
{{ $t('form.reset') }} {{ $t('signup') }} @@ -175,12 +166,12 @@ export default { password: '', passwordRepeat: '', }, + agree: false, } this.$nextTick(() => { this.$refs.observer.reset() }) }, - async onSubmit() { const result = await loginAPI.create( this.form.email, @@ -214,12 +205,6 @@ export default { }, }, computed: { - samePasswords() { - return this.form.password.password === this.form.password.passwordRepeat - }, - passwordsFilled() { - return this.form.password.password !== '' && this.form.password.passwordRepeat !== '' - }, namesFilled() { return ( this.form.firstname !== '' &&