@cnamts/synapse 0.0.15-alpha → 0.0.16-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CookiesSelection/CookiesSelection.d.ts +26 -26
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +1391 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2810 -16
- package/dist/components/DatePicker/DateTextInput.d.ts +1401 -4
- package/dist/components/LangBtn/LangBtn.d.ts +4 -4
- package/dist/components/NirField/NirField.d.ts +2794 -4
- package/dist/components/PeriodField/PeriodField.d.ts +5636 -48
- package/dist/components/SyAlert/SyAlert.d.ts +72 -1
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +26 -26
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/date/useDateFormat.d.ts +2 -2
- package/dist/composables/date/useDateFormatDayjs.d.ts +23 -0
- package/dist/composables/date/useDateInitializationDayjs.d.ts +18 -0
- package/dist/design-system-v3.js +3953 -3728
- package/dist/design-system-v3.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Customs/SyTextField/Accessibilite.stories.ts +7 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +13 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +82 -17
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +795 -0
- package/src/components/DatePicker/DatePicker.stories.ts +432 -1
- package/src/components/DatePicker/DatePicker.vue +66 -24
- package/src/components/DatePicker/DatePickerValidation.stories.ts +9 -1
- package/src/components/DatePicker/DateTextInput.vue +85 -133
- package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +282 -0
- package/src/components/DatePicker/tests/DatePicker.spec.ts +33 -32
- package/src/components/DatePicker/tests/DateTextInput.spec.ts +81 -33
- package/src/components/SyAlert/Accessibilite.stories.ts +4 -0
- package/src/components/SyAlert/SyAlert.mdx +3 -7
- package/src/components/SyAlert/SyAlert.stories.ts +19 -12
- package/src/components/SyAlert/SyAlert.vue +88 -51
- package/src/components/SyAlert/tests/SyAlert.spec.ts +20 -2
- package/src/components/SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap +83 -75
- package/src/components/index.ts +1 -0
- package/src/composables/date/useDateFormat.ts +17 -1
- package/src/composables/date/useDateFormatDayjs.ts +84 -0
- package/src/composables/date/useDateInitializationDayjs.ts +133 -0
- package/src/stories/Accessibilite/Avancement/Avancement.mdx +12 -0
- package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +134 -0
- /package/src/components/DatePicker/{DatePickerValidationExamples.vue → docExamples/DatePickerValidationExamples.vue} +0 -0
|
@@ -60,12 +60,6 @@ describe('DatePicker.vue', () => {
|
|
|
60
60
|
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['01/01/2023'])
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
-
it('toggles the date picker visibility on focus', async () => {
|
|
64
|
-
const input = wrapper.find('input')
|
|
65
|
-
await input.trigger('focus')
|
|
66
|
-
expect(wrapper.vm.isDatePickerVisible).toBe(true)
|
|
67
|
-
})
|
|
68
|
-
|
|
69
63
|
it('renders the date picker with proper structure', async () => {
|
|
70
64
|
// Ouvrir le DatePicker pour que les éléments soient dans le DOM
|
|
71
65
|
wrapper.vm.isDatePickerVisible = true
|
|
@@ -151,17 +145,15 @@ describe('DatePicker.vue', () => {
|
|
|
151
145
|
plugins: [vuetify],
|
|
152
146
|
},
|
|
153
147
|
props: {
|
|
154
|
-
required: true,
|
|
148
|
+
required: true,
|
|
155
149
|
},
|
|
156
150
|
})
|
|
157
151
|
|
|
158
|
-
// Simule une date valide
|
|
159
152
|
wrapper.vm.selectedDates = [new Date('2023-01-01')]
|
|
160
153
|
await nextTick()
|
|
161
154
|
|
|
162
155
|
const result = wrapper.vm.validateOnSubmit()
|
|
163
156
|
|
|
164
|
-
// Vérifie que validateOnSubmit retourne true et qu'il n'y a pas d'erreurs
|
|
165
157
|
expect(result).toBe(true)
|
|
166
158
|
expect(wrapper.vm.errorMessages).toEqual([])
|
|
167
159
|
})
|
|
@@ -172,34 +164,32 @@ describe('DatePicker.vue', () => {
|
|
|
172
164
|
plugins: [vuetify],
|
|
173
165
|
},
|
|
174
166
|
props: {
|
|
175
|
-
required: true,
|
|
167
|
+
required: true,
|
|
176
168
|
},
|
|
177
169
|
})
|
|
178
170
|
|
|
179
|
-
// Simule l'absence de date sélectionnée
|
|
180
171
|
wrapper.vm.selectedDates = null
|
|
181
172
|
await nextTick()
|
|
182
173
|
|
|
183
174
|
const result = wrapper.vm.validateOnSubmit()
|
|
184
175
|
|
|
185
|
-
// Vérifie que validateOnSubmit retourne false et qu'il y a des erreurs
|
|
186
176
|
expect(result).toBe(false)
|
|
187
177
|
expect(wrapper.vm.errorMessages).toContain('La date est requise.')
|
|
188
178
|
})
|
|
189
179
|
|
|
190
180
|
it('parses a valid date string into a Date instance', () => {
|
|
191
|
-
const modelValue = '15/01/2023'
|
|
181
|
+
const modelValue = '15/01/2023'
|
|
192
182
|
const result = wrapper.vm.initializeSelectedDates(modelValue, 'DD/MM/YYYY')
|
|
193
183
|
|
|
194
|
-
expect(result).toBeInstanceOf(Date)
|
|
195
|
-
expect(result.toISOString().split('T')[0]).toBe('2023-01-15')
|
|
184
|
+
expect(result).toBeInstanceOf(Date)
|
|
185
|
+
expect(result.toISOString().split('T')[0]).toBe('2023-01-15')
|
|
196
186
|
})
|
|
197
187
|
|
|
198
188
|
it('returns null if modelValue is null or undefined', () => {
|
|
199
189
|
const modelValue = null
|
|
200
190
|
const result = wrapper.vm.initializeSelectedDates(modelValue, 'DD/MM/YYYY')
|
|
201
191
|
|
|
202
|
-
expect(result).toBeNull()
|
|
192
|
+
expect(result).toBeNull()
|
|
203
193
|
})
|
|
204
194
|
|
|
205
195
|
it('handles an invalid date string gracefully', () => {
|
|
@@ -210,24 +200,23 @@ describe('DatePicker.vue', () => {
|
|
|
210
200
|
})
|
|
211
201
|
|
|
212
202
|
it('sets selectedDates to null when input is empty', () => {
|
|
213
|
-
wrapper.vm.updateSelectedDates('')
|
|
203
|
+
wrapper.vm.updateSelectedDates('')
|
|
214
204
|
|
|
215
|
-
expect(wrapper.vm.selectedDates).toBeNull()
|
|
205
|
+
expect(wrapper.vm.selectedDates).toBeNull()
|
|
216
206
|
})
|
|
217
207
|
|
|
218
208
|
it('parses a valid date string and updates selectedDates', () => {
|
|
219
209
|
const validInput = '15/01/2023'
|
|
220
|
-
wrapper.vm.updateSelectedDates(validInput)
|
|
210
|
+
wrapper.vm.updateSelectedDates(validInput)
|
|
221
211
|
|
|
222
|
-
expect(wrapper.vm.selectedDates).toBeInstanceOf(Date)
|
|
223
|
-
expect(wrapper.vm.selectedDates.toISOString().split('T')[0]).toBe('2023-01-15')
|
|
212
|
+
expect(wrapper.vm.selectedDates).toBeInstanceOf(Date)
|
|
213
|
+
expect(wrapper.vm.selectedDates.toISOString().split('T')[0]).toBe('2023-01-15')
|
|
224
214
|
})
|
|
225
215
|
|
|
226
216
|
it('does not update selectedDates for invalid date string', () => {
|
|
227
217
|
const invalidInput = 'invalid-date'
|
|
228
|
-
wrapper.vm.updateSelectedDates(invalidInput)
|
|
229
|
-
|
|
230
|
-
expect(wrapper.vm.selectedDates).toBeNull() // Vérifie que selectedDates reste null
|
|
218
|
+
wrapper.vm.updateSelectedDates(invalidInput)
|
|
219
|
+
expect(wrapper.vm.selectedDates).toBeNull()
|
|
231
220
|
})
|
|
232
221
|
|
|
233
222
|
it('toggles date picker visibility correctly', async () => {
|
|
@@ -235,15 +224,12 @@ describe('DatePicker.vue', () => {
|
|
|
235
224
|
global: { plugins: [vuetify] },
|
|
236
225
|
})
|
|
237
226
|
|
|
238
|
-
// État initial : le date picker est caché
|
|
239
227
|
expect(wrapper.vm.isDatePickerVisible).toBe(false)
|
|
240
228
|
|
|
241
|
-
// Ouvrir le date picker
|
|
242
229
|
wrapper.vm.openDatePicker()
|
|
243
230
|
await nextTick()
|
|
244
231
|
expect(wrapper.vm.isDatePickerVisible).toBe(true)
|
|
245
232
|
|
|
246
|
-
// Fermer le date picker
|
|
247
233
|
wrapper.vm.isDatePickerVisible = false
|
|
248
234
|
await nextTick()
|
|
249
235
|
expect(wrapper.vm.isDatePickerVisible).toBe(false)
|
|
@@ -257,7 +243,6 @@ describe('DatePicker.vue', () => {
|
|
|
257
243
|
},
|
|
258
244
|
})
|
|
259
245
|
|
|
260
|
-
// Valider sans date (devrait échouer)
|
|
261
246
|
const result = await wrapper.vm.validateOnSubmit()
|
|
262
247
|
expect(result).toBe(false)
|
|
263
248
|
expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
|
|
@@ -299,11 +284,9 @@ describe('DatePicker.vue', () => {
|
|
|
299
284
|
},
|
|
300
285
|
})
|
|
301
286
|
|
|
302
|
-
// Valider sans date pour générer une erreur
|
|
303
287
|
await wrapper.vm.validateOnSubmit()
|
|
304
288
|
await nextTick()
|
|
305
289
|
|
|
306
|
-
// Vérifier que l'erreur est ajoutée à errorMessages
|
|
307
290
|
expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
|
|
308
291
|
const errorMessage = wrapper.find('.v-messages__message')
|
|
309
292
|
expect(errorMessage.exists()).toBe(true)
|
|
@@ -318,12 +301,30 @@ describe('DatePicker.vue', () => {
|
|
|
318
301
|
},
|
|
319
302
|
})
|
|
320
303
|
|
|
321
|
-
// Vérifier que le mode birth date est appliqué
|
|
322
304
|
expect(wrapper.props('isBirthDate')).toBe(true)
|
|
323
305
|
|
|
324
|
-
// Ouvrir le picker et vérifier qu'il est visible
|
|
325
306
|
wrapper.vm.openDatePicker()
|
|
326
307
|
await nextTick()
|
|
327
308
|
expect(wrapper.vm.isDatePickerVisible).toBe(true)
|
|
328
309
|
})
|
|
310
|
+
|
|
311
|
+
it('takes into account disabled and readonly limitations', async () => {
|
|
312
|
+
const wrapper = mount(DatePicker, {
|
|
313
|
+
global: { plugins: [vuetify] },
|
|
314
|
+
props: {
|
|
315
|
+
disabled: true,
|
|
316
|
+
},
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
wrapper.vm.openDatePicker()
|
|
320
|
+
await nextTick()
|
|
321
|
+
|
|
322
|
+
expect(wrapper.vm.isDatePickerVisible).toBe(false)
|
|
323
|
+
|
|
324
|
+
await wrapper.setProps({ disabled: false, readonly: true })
|
|
325
|
+
wrapper.vm.openDatePicker()
|
|
326
|
+
await nextTick()
|
|
327
|
+
|
|
328
|
+
expect(wrapper.vm.isDatePickerVisible).toBe(false)
|
|
329
|
+
})
|
|
329
330
|
})
|
|
@@ -38,7 +38,7 @@ describe('DateTextInput.vue', () => {
|
|
|
38
38
|
await input.trigger('blur')
|
|
39
39
|
await wrapper.vm.$nextTick()
|
|
40
40
|
const textField = wrapper.findComponent(SyTextField)
|
|
41
|
-
expect(textField.props('errorMessages')).toContain('Format de date invalide')
|
|
41
|
+
expect(textField.props('errorMessages')).toContain('Format de date invalide (DD/MM/YYYY)')
|
|
42
42
|
})
|
|
43
43
|
|
|
44
44
|
it('accepts valid date format', async () => {
|
|
@@ -116,20 +116,20 @@ describe('DateTextInput.vue', () => {
|
|
|
116
116
|
},
|
|
117
117
|
})
|
|
118
118
|
|
|
119
|
-
// Force
|
|
119
|
+
// Force validation by triggering a blur event
|
|
120
120
|
const input = wrapper.find('input')
|
|
121
121
|
await input.trigger('focus')
|
|
122
122
|
await input.trigger('blur')
|
|
123
123
|
await wrapper.vm.$nextTick()
|
|
124
|
-
await wrapper.vm.$nextTick() // Double nextTick
|
|
125
|
-
//
|
|
124
|
+
await wrapper.vm.$nextTick() // Double nextTick to ensure updates are completed
|
|
125
|
+
// We can also force validation manually
|
|
126
126
|
await wrapper.vm.validateOnSubmit()
|
|
127
127
|
await wrapper.vm.$nextTick()
|
|
128
128
|
const textField = wrapper.findComponent(SyTextField)
|
|
129
129
|
const warningMessages = textField.props('warningMessages') || []
|
|
130
|
-
//
|
|
130
|
+
// Check that the warning message is present
|
|
131
131
|
expect(warningMessages.length).toBeGreaterThan(0)
|
|
132
|
-
//
|
|
132
|
+
// The actual message starts with "Attention:"
|
|
133
133
|
expect(warningMessages[0]).toContain('Attention :')
|
|
134
134
|
})
|
|
135
135
|
|
|
@@ -139,7 +139,7 @@ describe('DateTextInput.vue', () => {
|
|
|
139
139
|
await input.trigger('blur')
|
|
140
140
|
await wrapper.vm.$nextTick()
|
|
141
141
|
const textField = wrapper.findComponent(SyTextField)
|
|
142
|
-
expect(textField.props('errorMessages')).toContain('Format de date invalide')
|
|
142
|
+
expect(textField.props('errorMessages')).toContain('Format de date invalide (DD/MM/YYYY)')
|
|
143
143
|
})
|
|
144
144
|
|
|
145
145
|
it('formats input while typing', async () => {
|
|
@@ -169,7 +169,7 @@ describe('DateTextInput.vue', () => {
|
|
|
169
169
|
const input = wrapper.find('input')
|
|
170
170
|
await input.trigger('blur')
|
|
171
171
|
await wrapper.vm.$nextTick()
|
|
172
|
-
expect(textField.props('errorMessages')).toContain('Format de date invalide')
|
|
172
|
+
expect(textField.props('errorMessages')).toContain('Format de date invalide (DD/MM/YYYY)')
|
|
173
173
|
})
|
|
174
174
|
|
|
175
175
|
it('formats date during input', async () => {
|
|
@@ -180,13 +180,13 @@ describe('DateTextInput.vue', () => {
|
|
|
180
180
|
})
|
|
181
181
|
|
|
182
182
|
it('handles date deletion', async () => {
|
|
183
|
-
//
|
|
183
|
+
// First set a valid date
|
|
184
184
|
const input = wrapper.find('input')
|
|
185
185
|
await input.setValue('01/01/2025')
|
|
186
186
|
await input.trigger('blur')
|
|
187
187
|
await wrapper.vm.$nextTick()
|
|
188
188
|
|
|
189
|
-
//
|
|
189
|
+
// Then delete it
|
|
190
190
|
await input.setValue('')
|
|
191
191
|
await input.trigger('input')
|
|
192
192
|
await input.trigger('blur')
|
|
@@ -266,19 +266,61 @@ describe('DateTextInput.vue', () => {
|
|
|
266
266
|
await wrapper.vm.$nextTick()
|
|
267
267
|
expect(input.element.value).toBe('01/__/____')
|
|
268
268
|
|
|
269
|
-
//
|
|
269
|
+
// Simulate cursor position after "01"
|
|
270
270
|
input.element.setSelectionRange(2, 2)
|
|
271
271
|
await input.trigger('input')
|
|
272
272
|
await wrapper.vm.$nextTick()
|
|
273
273
|
|
|
274
|
-
//
|
|
274
|
+
// The cursor position should remain after "01"
|
|
275
275
|
expect(input.element.selectionStart).toBe(2)
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
+
it('handles 2 digits year correctly', async () => {
|
|
279
|
+
const customWrapper = mount(DateTextInput, {
|
|
280
|
+
global: {
|
|
281
|
+
plugins: [vuetify],
|
|
282
|
+
},
|
|
283
|
+
props: {
|
|
284
|
+
modelValue: null,
|
|
285
|
+
format: 'DD/MM/YY',
|
|
286
|
+
dateFormatReturn: 'YYYY-MM-DD',
|
|
287
|
+
},
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
const input = customWrapper.find('input')
|
|
291
|
+
await input.setValue('0')
|
|
292
|
+
expect(input.element.value).toBe('0_/__/__')
|
|
293
|
+
|
|
294
|
+
await input.setValue('01/02/99')
|
|
295
|
+
expect(input.element.value).toBe('01/02/99')
|
|
296
|
+
expect(customWrapper.emitted('update:model-value')?.at(-1)).toEqual(['1999-02-01'])
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
it('handles ISO-8601 date format correctly', async () => {
|
|
300
|
+
const customWrapper = mount(DateTextInput, {
|
|
301
|
+
global: {
|
|
302
|
+
plugins: [vuetify],
|
|
303
|
+
},
|
|
304
|
+
props: {
|
|
305
|
+
modelValue: null,
|
|
306
|
+
format: 'YYYY-MM-DD',
|
|
307
|
+
},
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
const input = customWrapper.find('input')
|
|
311
|
+
await input.setValue('2025-')
|
|
312
|
+
expect(input.element.value).toBe('2025-__-__')
|
|
313
|
+
expect(customWrapper.emitted('update:model-value')).toBeFalsy()
|
|
314
|
+
|
|
315
|
+
await input.setValue('2025-01-01')
|
|
316
|
+
expect(input.element.value).toBe('2025-01-01')
|
|
317
|
+
expect(customWrapper.emitted('update:model-value')?.at(-1)).toEqual(['2025-01-01'])
|
|
318
|
+
})
|
|
319
|
+
|
|
278
320
|
it('handles paste event with valid date', async () => {
|
|
279
321
|
const input = wrapper.find('input')
|
|
280
322
|
|
|
281
|
-
//
|
|
323
|
+
// Create a paste event with data
|
|
282
324
|
const clipboardData = {
|
|
283
325
|
getData: () => '01/01/2025',
|
|
284
326
|
}
|
|
@@ -297,26 +339,26 @@ describe('DateTextInput.vue', () => {
|
|
|
297
339
|
await input.trigger('keydown', {
|
|
298
340
|
key: 'Tab',
|
|
299
341
|
})
|
|
300
|
-
//
|
|
342
|
+
// Check that the component doesn't prevent tab navigation
|
|
301
343
|
expect(wrapper.emitted('update:model-value')).toBeFalsy()
|
|
302
344
|
|
|
303
|
-
//
|
|
345
|
+
// Test behavior with Ctrl+V (paste)
|
|
304
346
|
await input.trigger('keydown', {
|
|
305
347
|
key: 'v',
|
|
306
348
|
ctrlKey: true,
|
|
307
349
|
})
|
|
308
|
-
//
|
|
350
|
+
// Default behavior should be preserved
|
|
309
351
|
expect(wrapper.emitted('update:model-value')).toBeFalsy()
|
|
310
352
|
})
|
|
311
353
|
|
|
312
354
|
it('validates on submit correctly', async () => {
|
|
313
355
|
const input = wrapper.find('input')
|
|
314
356
|
|
|
315
|
-
//
|
|
357
|
+
// Case 1: Empty field with required=true
|
|
316
358
|
const emptyResult = await wrapper.vm.validateOnSubmit()
|
|
317
359
|
expect(emptyResult).toBe(false)
|
|
318
360
|
|
|
319
|
-
//
|
|
361
|
+
// Case 2: Valid date
|
|
320
362
|
await input.setValue('01/01/2025')
|
|
321
363
|
await input.trigger('blur')
|
|
322
364
|
await wrapper.vm.$nextTick()
|
|
@@ -326,23 +368,29 @@ describe('DateTextInput.vue', () => {
|
|
|
326
368
|
})
|
|
327
369
|
|
|
328
370
|
it('handles focus and blur methods correctly', async () => {
|
|
329
|
-
//
|
|
330
|
-
const originalQuerySelector = document.querySelector
|
|
371
|
+
// Create a mock for the input element
|
|
331
372
|
const mockInput = { focus: vi.fn(), blur: vi.fn() }
|
|
332
373
|
|
|
333
|
-
//
|
|
334
|
-
|
|
374
|
+
// Mock the component's querySelector method
|
|
375
|
+
const mockQuerySelector = vi.fn().mockReturnValue(mockInput)
|
|
376
|
+
|
|
377
|
+
// Replace the element reference and its querySelector method
|
|
378
|
+
wrapper.vm.inputRef = {
|
|
379
|
+
$el: {
|
|
380
|
+
querySelector: mockQuerySelector,
|
|
381
|
+
},
|
|
382
|
+
}
|
|
335
383
|
|
|
336
|
-
//
|
|
384
|
+
// Call the exposed methods
|
|
337
385
|
wrapper.vm.focus()
|
|
338
386
|
wrapper.vm.blur()
|
|
339
387
|
|
|
340
|
-
//
|
|
388
|
+
// Check that querySelector was called with the right selector
|
|
389
|
+
expect(mockQuerySelector).toHaveBeenCalledWith('input:not([type="hidden"])')
|
|
390
|
+
|
|
391
|
+
// Check that the methods were called
|
|
341
392
|
expect(mockInput.focus).toHaveBeenCalled()
|
|
342
393
|
expect(mockInput.blur).toHaveBeenCalled()
|
|
343
|
-
|
|
344
|
-
// Restaurer document.querySelector
|
|
345
|
-
document.querySelector = originalQuerySelector
|
|
346
394
|
})
|
|
347
395
|
|
|
348
396
|
it('initializes with model value correctly', async () => {
|
|
@@ -383,17 +431,17 @@ describe('DateTextInput.vue', () => {
|
|
|
383
431
|
it('handles partial date input correctly', async () => {
|
|
384
432
|
const input = wrapper.find('input')
|
|
385
433
|
|
|
386
|
-
//
|
|
434
|
+
// Enter only the day
|
|
387
435
|
await input.setValue('01')
|
|
388
436
|
await wrapper.vm.$nextTick()
|
|
389
437
|
expect(input.element.value).toBe('01/__/____')
|
|
390
438
|
|
|
391
|
-
//
|
|
439
|
+
// Add the month
|
|
392
440
|
await input.setValue('01/02')
|
|
393
441
|
await wrapper.vm.$nextTick()
|
|
394
442
|
expect(input.element.value).toBe('01/02/____')
|
|
395
443
|
|
|
396
|
-
//
|
|
444
|
+
// Complete the date
|
|
397
445
|
await input.setValue('01/02/2025')
|
|
398
446
|
await wrapper.vm.$nextTick()
|
|
399
447
|
expect(input.element.value).toBe('01/02/2025')
|
|
@@ -423,16 +471,16 @@ describe('DateTextInput.vue', () => {
|
|
|
423
471
|
await input.trigger('focus')
|
|
424
472
|
await input.trigger('blur')
|
|
425
473
|
await customWrapper.vm.$nextTick()
|
|
426
|
-
await customWrapper.vm.$nextTick() // Double nextTick
|
|
474
|
+
await customWrapper.vm.$nextTick() // Double nextTick for reliability
|
|
427
475
|
|
|
428
|
-
// Force validation
|
|
476
|
+
// Force manual validation
|
|
429
477
|
await customWrapper.vm.validateOnSubmit()
|
|
430
478
|
await customWrapper.vm.$nextTick()
|
|
431
479
|
|
|
432
480
|
const textField = customWrapper.findComponent(SyTextField)
|
|
433
481
|
const successMessages = textField.props('successMessages') || []
|
|
434
482
|
|
|
435
|
-
//
|
|
483
|
+
// Flexible verification
|
|
436
484
|
expect(successMessages.length).toBeGreaterThan(0)
|
|
437
485
|
expect(successMessages[0]).toContain('valide')
|
|
438
486
|
})
|
|
@@ -159,6 +159,10 @@ export const Legende: StoryObj = {
|
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
</div>
|
|
162
|
+
<div class="mt-4">
|
|
163
|
+
<p>Rapport d’audit manuel : <a href="/audits/SyAlert.xlsx" style="color:#0C41BD;">Voir le rapport</a></p>
|
|
164
|
+
<p style="color: grey; font-size: 14px">Correctifs associés (<a href="https://github.com/assurance-maladie-digital/design-system/issues/4010" target="_blank" style="color:#0C41BD;">issue #4010</a>)</p>
|
|
165
|
+
</div>
|
|
162
166
|
`,
|
|
163
167
|
}
|
|
164
168
|
},
|
|
@@ -25,12 +25,8 @@ const showAlert = ref(true);
|
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<template>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</SyAlert>
|
|
32
|
-
|
|
33
|
-
<VBtn v-if="!showAlert" color="primary" @click="showAlert = true" class="ma-6">Réinitialiser</VBtn>
|
|
34
|
-
</div>
|
|
28
|
+
<SyAlert v-model="showAlert" type="warning" variant="tonal" :closable="true">
|
|
29
|
+
Ceci est une alerte de type "warning".
|
|
30
|
+
</SyAlert>
|
|
35
31
|
</template>
|
|
36
32
|
`} />
|
|
@@ -13,6 +13,13 @@ const meta = {
|
|
|
13
13
|
modelValue: true,
|
|
14
14
|
},
|
|
15
15
|
argTypes: {
|
|
16
|
+
modelValue: {
|
|
17
|
+
control: { type: 'boolean' },
|
|
18
|
+
description: 'Contrôle l\'affichage de l\'alerte',
|
|
19
|
+
table: {
|
|
20
|
+
category: 'props',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
16
23
|
type: {
|
|
17
24
|
options: ['info', 'warning', 'success', 'error'],
|
|
18
25
|
control: { type: 'select' },
|
|
@@ -37,8 +44,8 @@ export const Default: Story = {
|
|
|
37
44
|
name: 'Template',
|
|
38
45
|
code: `<template>
|
|
39
46
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
40
|
-
<SyAlert v-model="showAlert" type="success" variant="tonal" :closable="true">
|
|
41
|
-
<template #default>
|
|
47
|
+
<SyAlert v-model="showAlert" type="success" variant="tonal" :closable="true" style="width: 100%">
|
|
48
|
+
<template #default>Contenu de l'alerte</template>
|
|
42
49
|
</SyAlert>
|
|
43
50
|
|
|
44
51
|
<VBtn v-if="!showAlert" color="primary" @click="showAlert = true">
|
|
@@ -65,7 +72,7 @@ export const Default: Story = {
|
|
|
65
72
|
type: 'success',
|
|
66
73
|
closable: true,
|
|
67
74
|
variant: 'tonal',
|
|
68
|
-
default: '
|
|
75
|
+
default: 'Contenu de l\'alerte',
|
|
69
76
|
},
|
|
70
77
|
render: (args) => {
|
|
71
78
|
return {
|
|
@@ -75,7 +82,7 @@ export const Default: Story = {
|
|
|
75
82
|
},
|
|
76
83
|
template: `
|
|
77
84
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
78
|
-
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable">
|
|
85
|
+
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable" style="width: 100%">
|
|
79
86
|
<template #default>{{ args.default }}</template>
|
|
80
87
|
</SyAlert>
|
|
81
88
|
<VBtn v-if="!args.modelValue" color="primary" @click="args.modelValue = true" class="ma-6">
|
|
@@ -94,8 +101,8 @@ export const Outlined: Story = {
|
|
|
94
101
|
name: 'Template',
|
|
95
102
|
code: `<template>
|
|
96
103
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
97
|
-
<SyAlert v-model="showAlert" type="warning" variant="outlined" :closable="true">
|
|
98
|
-
<template #default>
|
|
104
|
+
<SyAlert v-model="showAlert" type="warning" variant="outlined" :closable="true" style="width: 100%">
|
|
105
|
+
<template #default>Contenu de l'alerte</template>
|
|
99
106
|
</SyAlert>
|
|
100
107
|
|
|
101
108
|
<VBtn v-if="!showAlert" color="primary" @click="showAlert = true">
|
|
@@ -121,7 +128,7 @@ export const Outlined: Story = {
|
|
|
121
128
|
type: 'warning',
|
|
122
129
|
closable: true,
|
|
123
130
|
variant: 'outlined',
|
|
124
|
-
default: '
|
|
131
|
+
default: 'Contenu de l\'alerte',
|
|
125
132
|
},
|
|
126
133
|
render: (args) => {
|
|
127
134
|
return {
|
|
@@ -131,7 +138,7 @@ export const Outlined: Story = {
|
|
|
131
138
|
},
|
|
132
139
|
template: `
|
|
133
140
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
134
|
-
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable">
|
|
141
|
+
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable" style="width: 100%">
|
|
135
142
|
<template #default>{{ args.default }}</template>
|
|
136
143
|
</SyAlert>
|
|
137
144
|
<VBtn v-if="!args.modelValue" color="primary" @click="args.modelValue = true" class="ma-6">
|
|
@@ -150,8 +157,8 @@ export const SlotIcon: Story = {
|
|
|
150
157
|
name: 'Template',
|
|
151
158
|
code: `<template>
|
|
152
159
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
153
|
-
<SyAlert v-model="showAlert" type="success" variant="tonal" :closable="true">
|
|
154
|
-
<template #default>
|
|
160
|
+
<SyAlert v-model="showAlert" type="success" variant="tonal" :closable="true" style="width: 100%">
|
|
161
|
+
<template #default>Contenu de l'alerte</template>
|
|
155
162
|
<template #icon>{{ icon }}</template>
|
|
156
163
|
</SyAlert>
|
|
157
164
|
|
|
@@ -180,7 +187,7 @@ export const SlotIcon: Story = {
|
|
|
180
187
|
type: 'success',
|
|
181
188
|
closable: true,
|
|
182
189
|
variant: 'tonal',
|
|
183
|
-
default: '
|
|
190
|
+
default: 'Contenu de l\'alerte',
|
|
184
191
|
icon: 'M21.1,12.5L22.5,13.91L15.97,20.5L12.5,17L13.9,15.59L15.97,17.67L21.1,12.5M10,17L13,20H3V18C3,15.79 6.58,14 11,14L12.89,14.11L10,17M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4Z',
|
|
185
192
|
},
|
|
186
193
|
render: (args) => {
|
|
@@ -191,7 +198,7 @@ export const SlotIcon: Story = {
|
|
|
191
198
|
},
|
|
192
199
|
template: `
|
|
193
200
|
<div class="d-flex flex-wrap align-center justify-center">
|
|
194
|
-
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable">
|
|
201
|
+
<SyAlert v-model="args.modelValue" :type="args.type" :variant="args.variant" :closable="args.closable" style="width: 100%">
|
|
195
202
|
<template #default>{{ args.default }}</template>
|
|
196
203
|
<template #icon>{{ args.icon }}</template>
|
|
197
204
|
</SyAlert>
|