From 9e0c32e9f70b6ea3a3bf7de08bc6ea4c262757c7 Mon Sep 17 00:00:00 2001 From: tristan Date: Tue, 9 Jun 2026 11:58:41 +0200 Subject: [PATCH] fix(date) : efface l'erreur de saisie manuelle quand modelValue change --- app/components/malio/date/Date.test.ts | 14 ++++++++++++++ app/components/malio/date/Date.vue | 1 + 2 files changed, 15 insertions(+) diff --git a/app/components/malio/date/Date.test.ts b/app/components/malio/date/Date.test.ts index e10dbb9..5b57d08 100644 --- a/app/components/malio/date/Date.test.ts +++ b/app/components/malio/date/Date.test.ts @@ -18,6 +18,8 @@ type DateProps = { min?: string max?: string clearable?: boolean + editable?: boolean + invalidMessage?: string inputClass?: string labelClass?: string groupClass?: string @@ -258,4 +260,16 @@ describe('MalioDate', () => { expect(msg.classes()).not.toContain('min-h-[1rem]') }) }) + + describe('saisie manuelle (editable)', () => { + it('efface l\'erreur de saisie quand modelValue change de l\'extérieur', async () => { + const wrapper = mountDate({editable: true}) + const input = wrapper.get('[data-test="date-input"]') + await input.setValue('32/13/2026') + await input.trigger('blur') + expect(wrapper.text()).toContain('Date invalide') + await wrapper.setProps({modelValue: '2026-05-19'}) + expect(wrapper.text()).not.toContain('Date invalide') + }) + }) }) diff --git a/app/components/malio/date/Date.vue b/app/components/malio/date/Date.vue index 35f05ef..9fa4d91 100644 --- a/app/components/malio/date/Date.vue +++ b/app/components/malio/date/Date.vue @@ -122,6 +122,7 @@ const onSelect = (iso: string, close: () => void) => { } watch(() => props.modelValue, (val) => { + internalError.value = '' if (val && !isValidIso(val) && import.meta.dev) { console.warn(`[MalioDate] modelValue invalide ignoré : "${val}"`) }