fix : DateTime embarque le champ MalioTimePicker au lieu du bloc molette brut (MUI-39)

This commit is contained in:
2026-05-27 10:27:05 +02:00
parent 23769cdf85
commit 4d0c4d9a23
2 changed files with 14 additions and 11 deletions
+8 -7
View File
@@ -2,7 +2,7 @@ import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
import {mount} from '@vue/test-utils'
import type {DefineComponent} from 'vue'
import DateTime_ from './DateTime.vue'
import TimeWheels from '../time/internal/TimeWheels.vue'
import MalioTimePicker from '../time/TimePicker.vue'
type DateTimeProps = {
id?: string
@@ -50,11 +50,12 @@ describe('MalioDateTime', () => {
})
describe('popover', () => {
it('ouvre la grille et les molettes au clic', async () => {
it('ouvre la grille et le champ sélecteur d\'heure au clic', async () => {
const wrapper = mountDateTime()
await wrapper.get('[data-test="date-input"]').trigger('click')
expect(wrapper.find('[data-test="month-grid"]').exists()).toBe(true)
expect(wrapper.find('[data-test="time-wheels"]').exists()).toBe(true)
expect(wrapper.findComponent(MalioTimePicker).exists()).toBe(true)
expect(wrapper.find('[data-test="time-field"]').exists()).toBe(true)
})
})
@@ -70,7 +71,7 @@ describe('MalioDateTime', () => {
it('applique l\'heure réglée avant le clic du jour', async () => {
const wrapper = mountDateTime()
await wrapper.get('[data-test="date-input"]').trigger('click')
wrapper.findComponent(TimeWheels).vm.$emit('update:modelValue', '09:15')
wrapper.findComponent(MalioTimePicker).vm.$emit('update:modelValue', '09:15')
await wrapper.vm.$nextTick()
expect(wrapper.emitted('update:modelValue')).toBeUndefined()
await wrapper.get('[data-test="day"][data-iso="2026-05-19"]').trigger('click')
@@ -80,15 +81,15 @@ describe('MalioDateTime', () => {
it('met à jour l\'heure quand une date est déjà choisie', async () => {
const wrapper = mountDateTime({modelValue: '2026-05-20T14:30:00'})
await wrapper.get('[data-test="date-input"]').trigger('click')
wrapper.findComponent(TimeWheels).vm.$emit('update:modelValue', '08:45')
wrapper.findComponent(MalioTimePicker).vm.$emit('update:modelValue', '08:45')
await wrapper.vm.$nextTick()
expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual(['2026-05-20T08:45:00'])
})
it('initialise les molettes depuis la valeur', async () => {
it('initialise le champ heure depuis la valeur', async () => {
const wrapper = mountDateTime({modelValue: '2026-05-20T14:30:00'})
await wrapper.get('[data-test="date-input"]').trigger('click')
expect(wrapper.findComponent(TimeWheels).props('modelValue')).toBe('14:30')
expect(wrapper.findComponent(MalioTimePicker).props('modelValue')).toBe('14:30')
})
})