fix(date) : efface l'erreur de saisie manuelle quand modelValue change

This commit is contained in:
2026-06-09 11:58:41 +02:00
parent 58f7744326
commit 9e0c32e9f7
2 changed files with 15 additions and 0 deletions
+14
View File
@@ -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')
})
})
})
+1
View File
@@ -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}"`)
}