mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch '604-CSS-of-InputPassword-Component' of https://github.com/gradido/gradido into 604-CSS-of-InputPassword-Component
This commit is contained in:
commit
3ec8906ad6
@ -3,7 +3,6 @@
|
||||
<b-row class="mb-2">
|
||||
<b-col>
|
||||
<input-password
|
||||
id="inputPassword"
|
||||
:rules="{
|
||||
required: true,
|
||||
containsLowercaseCharacter: true,
|
||||
@ -13,9 +12,9 @@
|
||||
}"
|
||||
:label="register ? $t('form.password') : $t('form.password_new')"
|
||||
:showAllErrors="true"
|
||||
:immediate="true"
|
||||
:name="register ? $t('form.password') : $t('form.password_new')"
|
||||
:placeholder="register ? $t('form.password') : $t('form.password_new')"
|
||||
:immediate="true"
|
||||
:name="createId(register ? $t('form.password') : $t('form.password_new'))"
|
||||
:placeholder="register ? $t('form.password') : $t('form.password_new')"
|
||||
v-model="password"
|
||||
></input-password>
|
||||
</b-col>
|
||||
@ -23,9 +22,8 @@
|
||||
<b-row class="mb-2">
|
||||
<b-col>
|
||||
<input-password
|
||||
id="inputPasswordRepeat"
|
||||
:rules="{ samePassword: value.password }"
|
||||
:label="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
||||
:name="createId(register ? $t('form.passwordRepeat') : $t('form.password_new_repeat'))"
|
||||
:placeholder="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
||||
v-model="passwordRepeat"
|
||||
></input-password>
|
||||
@ -57,6 +55,11 @@ export default {
|
||||
passwordRepeat: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createId(text) {
|
||||
return text.replace(/ +/g, '-')
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
passwordObject() {
|
||||
return { password: this.password, passwordRepeat: this.passwordRepeat }
|
||||
|
||||
@ -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
|
||||
})
|
||||
})
|
||||
|
||||
@ -109,16 +109,7 @@
|
||||
</span>
|
||||
</b-alert>
|
||||
|
||||
<div
|
||||
class="text-center"
|
||||
v-if="
|
||||
passwordsFilled &&
|
||||
samePasswords &&
|
||||
namesFilled &&
|
||||
emailFilled &&
|
||||
form.agree
|
||||
"
|
||||
>
|
||||
<div class="text-center" v-if="namesFilled && emailFilled && form.agree">
|
||||
<div class="text-center">
|
||||
<b-button class="ml-2" @click="resetForm()">{{ $t('form.reset') }}</b-button>
|
||||
<b-button type="submit" variant="primary">{{ $t('signup') }}</b-button>
|
||||
@ -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 !== '' &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user