From 7cd50a8043928ff4d7845ef9900d6a9d832ed63b Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 7 Jun 2025 09:30:30 +0200 Subject: [PATCH] fix using correct label and placeholder in InputPassword, fix test --- .../src/components/Inputs/InputPassword.spec.js | 4 ++-- frontend/src/components/Inputs/InputPassword.vue | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Inputs/InputPassword.spec.js b/frontend/src/components/Inputs/InputPassword.spec.js index 9d6f5481d..94e50e026 100644 --- a/frontend/src/components/Inputs/InputPassword.spec.js +++ b/frontend/src/components/Inputs/InputPassword.spec.js @@ -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"', () => { diff --git a/frontend/src/components/Inputs/InputPassword.vue b/frontend/src/components/Inputs/InputPassword.vue index b496d09a3..7be2c62ca 100644 --- a/frontend/src/components/Inputs/InputPassword.vue +++ b/frontend/src/components/Inputs/InputPassword.vue @@ -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)