fix using correct label and placeholder in InputPassword, fix test

This commit is contained in:
einhornimmond 2025-06-07 09:30:30 +02:00
parent b76ccd7582
commit 7cd50a8043
2 changed files with 14 additions and 6 deletions

View File

@ -80,7 +80,7 @@ describe('InputPassword', () => {
})
it('has the placeholder "input-field-placeholder"', () => {
expect(wrapper.find('input').attributes('placeholder')).toEqual('form.password')
expect(wrapper.find('input').attributes('placeholder')).toEqual('input-field-placeholder')
})
it('has the value ""', () => {
@ -88,7 +88,7 @@ describe('InputPassword', () => {
})
it('has the label "input-field-label"', () => {
expect(wrapper.find('label').text()).toEqual('form.password')
expect(wrapper.find('label').text()).toEqual('input-field-label')
})
it('has the label for "input-field-name-input-field"', () => {

View File

@ -62,19 +62,27 @@ const props = defineProps({
type: Boolean,
default: false,
},
label: {
type: String,
default: null,
},
placeholder: {
type: String,
default: null,
},
})
const { t } = useI18n()
const name = toRef(props, 'name')
const { value, errorMessage, meta, errors, validate } = useField(name, props.rules, {
bails: !props.allowFullValidation,
validateOnMount: props.immediate,
})
const { t } = useI18n()
const defaultTranslations = computed(() => ({
label: t('form.password'),
placeholder: t('form.password'),
label: props.label || t('form.password'),
placeholder: props.placeholder || t('form.password'),
}))
const showPassword = ref(false)