From 993364062d933c710b30dd533bcb4caaf0d1ffcc Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 3 Jun 2026 15:35:41 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui)=20:=20garde=20readonly=20d=C3=A9fensive?= =?UTF-8?q?=20isOpen=20+=20test=20readonly=20TimePicker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- app/components/malio/date/internal/CalendarField.vue | 2 +- app/components/malio/time/TimePicker.test.ts | 6 ++++++ app/components/malio/time/TimePicker.vue | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/components/malio/date/internal/CalendarField.vue b/app/components/malio/date/internal/CalendarField.vue index 1a1af93..4f50dfe 100644 --- a/app/components/malio/date/internal/CalendarField.vue +++ b/app/components/malio/date/internal/CalendarField.vue @@ -205,7 +205,7 @@ const mergedInputClass = computed(() => : hasSuccess.value ? 'border-m-success' : isReadonly.value ? '' : 'focus:border-m-primary', - isOpen.value ? 'border-m-primary !py-[9px] !rounded-b-none' : '', + (!isReadonly.value && isOpen.value) ? 'border-m-primary !py-[9px] !rounded-b-none' : '', props.inputClass, ), ) diff --git a/app/components/malio/time/TimePicker.test.ts b/app/components/malio/time/TimePicker.test.ts index ec53da6..76bb390 100644 --- a/app/components/malio/time/TimePicker.test.ts +++ b/app/components/malio/time/TimePicker.test.ts @@ -52,6 +52,12 @@ describe('MalioTimePicker', () => { expect(wrapper.find('[data-test="popover"]').exists()).toBe(false) }) + it('n\'ouvre pas le popover si readonly', async () => { + const wrapper = mountPicker({readonly: true}) + await wrapper.get('[data-test="time-field"]').trigger('click') + expect(wrapper.find('[data-test="popover"]').exists()).toBe(false) + }) + it('émet la valeur réglée depuis les molettes', async () => { const wrapper = mountPicker({modelValue: '09:30'}) await wrapper.get('[data-test="time-field"]').trigger('click') diff --git a/app/components/malio/time/TimePicker.vue b/app/components/malio/time/TimePicker.vue index 4ab484f..c13304c 100644 --- a/app/components/malio/time/TimePicker.vue +++ b/app/components/malio/time/TimePicker.vue @@ -202,7 +202,7 @@ const mergedInputClass = computed(() => : hasSuccess.value ? 'border-m-success' : isReadonly.value ? '' : 'focus:border-m-primary', - isOpen.value ? 'border-m-primary !rounded-b-none !py-[9px]' : '', + (!isReadonly.value && isOpen.value) ? 'border-m-primary !rounded-b-none !py-[9px]' : '', props.inputClass, ), )