@cnamts/synapse 0.0.12-alpha → 0.0.13-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.
Files changed (250) hide show
  1. package/dist/design-system-v3.js +4913 -4021
  2. package/dist/design-system-v3.umd.cjs +1 -1
  3. package/dist/src/components/Amelipro/types/types.d.ts +30 -57
  4. package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +2 -0
  5. package/dist/src/components/DatePicker/DatePicker.d.ts +36 -44
  6. package/dist/src/components/DatePicker/DateTextInput.d.ts +33 -36
  7. package/dist/src/components/FilterInline/AccessibiliteItems.d.ts +30 -0
  8. package/dist/src/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +4 -0
  9. package/dist/src/components/FilterSideBar/AccessibiliteItems.d.ts +29 -0
  10. package/dist/src/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +4 -0
  11. package/dist/src/components/NirField/NirField.d.ts +14 -2
  12. package/dist/src/components/NotificationBar/NotificationBar.d.ts +5 -5
  13. package/dist/src/components/PasswordField/PasswordField.d.ts +2 -0
  14. package/dist/src/components/PeriodField/PeriodField.d.ts +159 -157
  15. package/dist/src/components/PhoneField/PhoneField.d.ts +22 -1
  16. package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
  17. package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
  18. package/dist/src/components/Usages/Usages.d.ts +10 -0
  19. package/dist/src/components/index.d.ts +3 -0
  20. package/dist/src/composables/date/tests/useDatePickerAccessibility.spec.d.ts +1 -0
  21. package/dist/src/composables/date/useDateFormat.d.ts +26 -0
  22. package/dist/src/composables/date/useDateInitialization.d.ts +18 -0
  23. package/dist/src/composables/date/useDatePickerAccessibility.d.ts +8 -0
  24. package/dist/src/composables/useFilterable/useFilterable.d.ts +1 -1
  25. package/dist/src/composables/validation/useValidation.d.ts +1 -0
  26. package/dist/src/main.d.ts +1 -0
  27. package/dist/src/utils/formatDate/index.d.ts +3 -0
  28. package/dist/src/utils/formatDate/tests/formatDate.spec.d.ts +1 -0
  29. package/dist/src/utils/functions/validation/isDateAfter/index.d.ts +2 -0
  30. package/dist/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.d.ts +1 -0
  31. package/dist/src/utils/functions/validation/isDateBefore/index.d.ts +2 -0
  32. package/dist/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.d.ts +1 -0
  33. package/dist/src/utils/functions/validation/isDateInRange/index.d.ts +3 -0
  34. package/dist/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.d.ts +1 -0
  35. package/dist/src/utils/functions/validation/isDateValid/index.d.ts +9 -0
  36. package/dist/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.d.ts +1 -0
  37. package/dist/src/utils/functions/validation/isEmailValid/tests/isEmailValid.spec.d.ts +1 -0
  38. package/dist/src/utils/functions/validation/isWeekend/index.d.ts +3 -0
  39. package/dist/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.d.ts +1 -0
  40. package/dist/src/utils/parseDate/index.d.ts +3 -0
  41. package/dist/src/utils/parseDate/tests/parseDate.spec.d.ts +1 -0
  42. package/dist/src/utils/rules/doMatchPattern/index.d.ts +3 -0
  43. package/dist/src/utils/rules/doMatchPattern/tests/matchPattern.spec.d.ts +1 -0
  44. package/dist/src/utils/rules/index.d.ts +11 -0
  45. package/dist/src/utils/rules/isDateValid/index.d.ts +4 -0
  46. package/dist/src/utils/rules/isDateValid/tests/isDateValid.spec.d.ts +1 -0
  47. package/dist/src/utils/rules/isExactLength/index.d.ts +3 -0
  48. package/dist/src/utils/rules/isExactLength/locales.d.ts +2 -0
  49. package/dist/src/utils/rules/isExactLength/tests/exactLength.spec.d.ts +1 -0
  50. package/dist/src/utils/rules/isMaxLength/index.d.ts +3 -0
  51. package/dist/src/utils/rules/isMaxLength/locales.d.ts +2 -0
  52. package/dist/src/utils/rules/isMaxLength/tests/isMaxLength.spec.d.ts +1 -0
  53. package/dist/src/utils/rules/isMinLength/index.d.ts +3 -0
  54. package/dist/src/utils/rules/isMinLength/locales.d.ts +2 -0
  55. package/dist/src/utils/rules/isMinLength/tests/isMinLength.spec.d.ts +1 -0
  56. package/dist/src/utils/rules/isNotAfterDate/index.d.ts +3 -0
  57. package/dist/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.d.ts +1 -0
  58. package/dist/src/utils/rules/isNotAfterToday/index.d.ts +4 -0
  59. package/dist/src/utils/rules/isNotAfterToday/locales.d.ts +2 -0
  60. package/dist/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.d.ts +1 -0
  61. package/dist/src/utils/rules/isNotBeforeDate/index.d.ts +3 -0
  62. package/dist/src/utils/rules/isNotBeforeDate/locales.d.ts +2 -0
  63. package/dist/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.d.ts +1 -0
  64. package/dist/src/utils/rules/isNotBeforeToday/index.d.ts +4 -0
  65. package/dist/src/utils/rules/isNotBeforeToday/locales.d.ts +2 -0
  66. package/dist/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.d.ts +1 -0
  67. package/dist/src/utils/rules/isRequired/index.d.ts +4 -0
  68. package/dist/src/utils/rules/isRequired/locales.d.ts +2 -0
  69. package/dist/src/utils/rules/isRequired/tests/isRequred.spec.d.ts +1 -0
  70. package/dist/src/utils/rules/isValidEmail/index.d.ts +4 -0
  71. package/dist/src/utils/rules/isValidEmail/locales.d.ts +2 -0
  72. package/dist/src/utils/rules/isValidEmail/tests/isValidEmail.spec.d.ts +1 -0
  73. package/dist/style.css +1 -1
  74. package/package.json +3 -1
  75. package/src/assets/_radius.scss +12 -6
  76. package/src/assets/settings.scss +8 -0
  77. package/src/components/Amelipro/types/types.ts +40 -0
  78. package/src/components/ChipList/ChipList.stories.ts +26 -27
  79. package/src/components/ChipList/ChipList.vue +5 -1
  80. package/src/components/ChipList/config.ts +1 -0
  81. package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -2
  82. package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +1 -1
  83. package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +1 -1
  84. package/src/components/Customs/SySelect/SySelect.mdx +1 -1
  85. package/src/components/Customs/SySelect/SySelect.vue +19 -4
  86. package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
  87. package/src/components/Customs/SyTextField/SyTextField.stories.ts +239 -0
  88. package/src/components/Customs/SyTextField/SyTextField.vue +3 -0
  89. package/src/components/DatePicker/DatePicker.stories.ts +177 -5
  90. package/src/components/DatePicker/DatePicker.vue +148 -347
  91. package/src/components/DatePicker/DateTextInput.vue +91 -251
  92. package/src/components/DatePicker/tests/DatePicker.spec.ts +118 -48
  93. package/src/components/DatePicker/tests/DateTextInput.spec.ts +202 -6
  94. package/src/components/FileList/Accessibilite.stories.ts +1 -1
  95. package/src/components/FileList/AccessibiliteItems.ts +22 -0
  96. package/src/components/FileUpload/FileUpload.stories.ts +9 -7
  97. package/src/components/FilterInline/Accessibilite.mdx +14 -0
  98. package/src/components/FilterInline/Accessibilite.stories.ts +216 -0
  99. package/src/components/FilterInline/AccessibiliteItems.ts +132 -0
  100. package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +4 -0
  101. package/src/components/FilterSideBar/Accessibilite.mdx +14 -0
  102. package/src/components/FilterSideBar/Accessibilite.stories.ts +216 -0
  103. package/src/components/FilterSideBar/AccessibiliteItems.ts +153 -0
  104. package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +4 -0
  105. package/src/components/NirField/NirField.stories.ts +165 -0
  106. package/src/components/NirField/NirField.vue +6 -2
  107. package/src/components/NirField/tests/config.spec.ts +65 -0
  108. package/src/components/NotificationBar/NotificationBar.mdx +2 -2
  109. package/src/components/NotificationBar/NotificationBar.stories.ts +59 -11
  110. package/src/components/NotificationBar/NotificationBar.vue +42 -114
  111. package/src/components/NotificationBar/tests/NotificationBar.spec.ts +28 -33
  112. package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +1 -1
  113. package/src/components/PaginatedTable/PaginatedTable.vue +6 -10
  114. package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +4 -4
  115. package/src/components/PasswordField/PasswordField.stories.ts +191 -4
  116. package/src/components/PasswordField/PasswordField.vue +3 -0
  117. package/src/components/PeriodField/PeriodField.stories.ts +214 -118
  118. package/src/components/PeriodField/PeriodField.vue +195 -148
  119. package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
  120. package/src/components/PhoneField/PhoneField.stories.ts +101 -0
  121. package/src/components/PhoneField/PhoneField.vue +73 -17
  122. package/src/components/PhoneField/tests/PhoneField.spec.ts +40 -0
  123. package/src/components/RatingPicker/RatingPicker.stories.ts +7 -7
  124. package/src/components/SearchListField/SearchListField.stories.ts +1 -1
  125. package/src/components/UploadWorkflow/Accessibilite.mdx +14 -0
  126. package/src/components/UploadWorkflow/Accessibilite.stories.ts +216 -0
  127. package/src/components/UploadWorkflow/AccessibiliteItems.ts +192 -0
  128. package/src/components/UploadWorkflow/UploadWorkflow.vue +2 -2
  129. package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
  130. package/src/components/Usages/tests/Usages.spec.ts +183 -0
  131. package/src/components/index.ts +3 -0
  132. package/src/composables/date/tests/useDateFormat.spec.ts +67 -0
  133. package/src/composables/date/tests/useDateInitialization.spec.ts +89 -0
  134. package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +102 -0
  135. package/src/composables/date/useDateFormat.ts +94 -0
  136. package/src/composables/date/useDateInitialization.ts +92 -0
  137. package/src/composables/date/useDatePickerAccessibility.ts +78 -0
  138. package/src/composables/rules/tests/useFieldValidation.spec.ts +385 -4
  139. package/src/composables/useFilterable/useFilterable.ts +5 -4
  140. package/src/composables/validation/useValidation.ts +15 -0
  141. package/src/main.ts +1 -0
  142. package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +28 -0
  143. package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +2 -2
  144. package/src/stories/Accessibilite/Audit/RGAA.mdx +6 -6
  145. package/src/stories/Accessibilite/Introduction.mdx +2 -1
  146. package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +1 -1
  147. package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +1 -1
  148. package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +8 -11
  149. package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +77 -0
  150. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +9 -3
  151. package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +2 -2
  152. package/src/stories/Demarrer/Introduction.stories.ts +3 -3
  153. package/src/stories/Demarrer/Releases.mdx +8 -0
  154. package/src/stories/Demarrer/Releases.stories.ts +66 -0
  155. package/src/stories/DesignTokens/Conteneurs.stories.ts +3 -3
  156. package/src/stories/GuideDuDev/LesBreackingChanges.mdx +36 -0
  157. package/src/stories/GuideDuDev/UtiliserLesRules.mdx +2 -2
  158. package/src/utils/formatDate/index.ts +6 -0
  159. package/src/utils/formatDate/tests/formatDate.spec.ts +18 -0
  160. package/src/utils/functions/validation/isDateAfter/index.ts +9 -0
  161. package/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.ts +18 -0
  162. package/src/utils/functions/validation/isDateBefore/index.ts +9 -0
  163. package/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.ts +23 -0
  164. package/src/utils/functions/validation/isDateInRange/index.ts +22 -0
  165. package/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.ts +28 -0
  166. package/src/utils/functions/validation/isDateValid/index.ts +67 -0
  167. package/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.ts +46 -0
  168. package/src/utils/functions/validation/isEmailValid/index.ts +9 -0
  169. package/src/utils/functions/validation/isWeekend/index.ts +10 -0
  170. package/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.ts +16 -0
  171. package/src/utils/parseDate/index.ts +29 -0
  172. package/src/utils/parseDate/tests/parseDate.spec.ts +52 -0
  173. package/src/utils/rules/Rules.mdx +16 -0
  174. package/src/utils/rules/doMatchPattern/DoMachPattern.mdx +66 -0
  175. package/src/utils/rules/doMatchPattern/DoMatchPattern.stories.ts +106 -0
  176. package/src/utils/rules/doMatchPattern/index.ts +28 -0
  177. package/src/utils/rules/doMatchPattern/locales.ts +5 -0
  178. package/src/utils/rules/doMatchPattern/tests/matchPattern.spec.ts +38 -0
  179. package/src/utils/rules/index.ts +11 -0
  180. package/src/utils/rules/isDateValid/IsDateValid.mdx +87 -0
  181. package/src/utils/rules/isDateValid/IsDateValid.stories.ts +113 -0
  182. package/src/utils/rules/isDateValid/index.ts +32 -0
  183. package/src/utils/rules/isDateValid/locales.ts +10 -0
  184. package/src/utils/rules/isDateValid/tests/isDateValid.spec.ts +27 -0
  185. package/src/utils/rules/isExactLength/IsExactLenght.mdx +68 -0
  186. package/src/utils/rules/isExactLength/IsExactLength.stories.ts +151 -0
  187. package/src/utils/rules/{exactLength → isExactLength}/index.ts +2 -4
  188. package/src/utils/rules/isExactLength/tests/exactLength.spec.ts +48 -0
  189. package/src/utils/rules/isMaxLength/IsMaxLength.mdx +68 -0
  190. package/src/utils/rules/isMaxLength/IsMaxLength.stories.ts +152 -0
  191. package/src/utils/rules/isMaxLength/index.ts +30 -0
  192. package/src/utils/rules/isMaxLength/locales.ts +6 -0
  193. package/src/utils/rules/isMaxLength/tests/isMaxLength.spec.ts +42 -0
  194. package/src/utils/rules/isMinLength/IsMinLength.mdx +68 -0
  195. package/src/utils/rules/isMinLength/IsMinLength.stories.ts +152 -0
  196. package/src/utils/rules/isMinLength/index.ts +30 -0
  197. package/src/utils/rules/isMinLength/locales.ts +6 -0
  198. package/src/utils/rules/isMinLength/tests/isMinLength.spec.ts +42 -0
  199. package/src/utils/rules/isNotAfterDate/IsNotAfterDate.mdx +68 -0
  200. package/src/utils/rules/isNotAfterDate/IsNotAfterDate.stories.ts +109 -0
  201. package/src/utils/rules/isNotAfterDate/index.ts +25 -0
  202. package/src/utils/rules/isNotAfterDate/locales.ts +6 -0
  203. package/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.ts +25 -0
  204. package/src/utils/rules/isNotAfterToday/IsNotAfterToday.mdx +83 -0
  205. package/src/utils/rules/isNotAfterToday/IsNotAfterToday.stories.ts +110 -0
  206. package/src/utils/rules/isNotAfterToday/index.ts +28 -0
  207. package/src/utils/rules/isNotAfterToday/locales.ts +5 -0
  208. package/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.ts +30 -0
  209. package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.mdx +68 -0
  210. package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.stories.ts +114 -0
  211. package/src/utils/rules/isNotBeforeDate/index.ts +25 -0
  212. package/src/utils/rules/isNotBeforeDate/locales.ts +6 -0
  213. package/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.ts +25 -0
  214. package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.mdx +83 -0
  215. package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.stories.ts +110 -0
  216. package/src/utils/rules/isNotBeforeToday/index.ts +28 -0
  217. package/src/utils/rules/isNotBeforeToday/locales.ts +5 -0
  218. package/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.ts +36 -0
  219. package/src/utils/rules/isRequired/IsRequired.mdx +81 -0
  220. package/src/utils/rules/isRequired/IsRequired.stories.ts +101 -0
  221. package/src/utils/rules/{required → isRequired}/index.ts +3 -3
  222. package/src/utils/rules/{required/tests/index.spec.ts → isRequired/tests/isRequred.spec.ts} +9 -9
  223. package/src/utils/rules/isValidEmail/IsValidEmail.mdx +81 -0
  224. package/src/utils/rules/isValidEmail/IsValidEmail.stories.ts +101 -0
  225. package/src/utils/rules/{email → isValidEmail}/index.ts +3 -5
  226. package/src/utils/rules/{email/tests/email.spec.ts → isValidEmail/tests/isValidEmail.spec.ts} +5 -5
  227. package/dist/src/components/Amelipro/types/languages.d.ts +0 -6
  228. package/dist/src/utils/rules/email/index.d.ts +0 -4
  229. package/dist/src/utils/rules/exactLength/index.d.ts +0 -4
  230. package/dist/src/utils/rules/required/index.d.ts +0 -4
  231. package/dist/src/utils/rules/required/ruleMessageHelper.d.ts +0 -3
  232. package/src/components/Amelipro/types/languages.d.ts +0 -6
  233. package/src/components/Amelipro/types/types.d.ts +0 -65
  234. package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
  235. package/src/utils/functions/isEmailValid/index.ts +0 -8
  236. package/src/utils/rules/required/ruleMessageHelper.ts +0 -14
  237. package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +0 -22
  238. /package/dist/src/{utils/functions/isEmailValid/tests/isEmailValid.spec.d.ts → components/NirField/tests/config.spec.d.ts} +0 -0
  239. /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
  240. /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → composables/date/tests/useDateFormat.spec.d.ts} +0 -0
  241. /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → composables/date/tests/useDateInitialization.spec.d.ts} +0 -0
  242. /package/dist/src/utils/functions/{isEmailValid → validation/isEmailValid}/index.d.ts +0 -0
  243. /package/dist/src/utils/rules/{exactLength → doMatchPattern}/locales.d.ts +0 -0
  244. /package/dist/src/utils/rules/{email → isDateValid}/locales.d.ts +0 -0
  245. /package/dist/src/utils/rules/{required → isNotAfterDate}/locales.d.ts +0 -0
  246. /package/src/components/NirField/{tests → examples}//342/200/257dataset/342/200/257.md" +0 -0
  247. /package/src/utils/functions/{isEmailValid → validation/isEmailValid}/tests/isEmailValid.spec.ts +0 -0
  248. /package/src/utils/rules/{exactLength → isExactLength}/locales.ts +0 -0
  249. /package/src/utils/rules/{required → isRequired}/locales.ts +0 -0
  250. /package/src/utils/rules/{email → isValidEmail}/locales.ts +0 -0
@@ -66,28 +66,22 @@ describe('DatePicker.vue', () => {
66
66
  expect(wrapper.vm.isDatePickerVisible).toBe(true)
67
67
  })
68
68
 
69
- it('updates aria-labels for date picker navigation buttons', async () => {
69
+ it('renders the date picker with proper structure', async () => {
70
+ // Ouvrir le DatePicker pour que les éléments soient dans le DOM
70
71
  wrapper.vm.isDatePickerVisible = true
71
72
  await nextTick()
72
-
73
- const arrowDown = document.querySelector(
74
- '.v-btn.v-btn--icon.v-theme--light.v-btn--density-comfortable.v-btn--size-default.v-btn--variant-text.v-date-picker-controls__mode-btn',
75
- )
76
- const arrowLeftButtons = document.querySelectorAll(
77
- '.v-btn.v-btn--icon.v-theme--light.v-btn--density-default.v-btn--size-default.v-btn--variant-text',
78
- )
79
-
80
- if (arrowDown) {
81
- expect(arrowDown.getAttribute('aria-label')).toBe('Changer de vue')
82
- }
83
- arrowLeftButtons.forEach((button, index) => {
84
- if (index === 0) {
85
- expect(button.getAttribute('aria-label')).toBe('Mois précédent')
86
- }
87
- else if (index === 1) {
88
- expect(button.getAttribute('aria-label')).toBe('Mois suivant')
89
- }
90
- })
73
+ // Simuler un clic pour s'assurer que le DatePicker est complètement initialisé
74
+ const input = wrapper.find('input')
75
+ await input.trigger('click')
76
+ await nextTick()
77
+ // Attendre un peu pour que le DOM soit mis à jour
78
+ await new Promise(resolve => setTimeout(resolve, 100))
79
+ // Vérifier que le DatePicker est visible
80
+ const datePickerEl = document.querySelector('.v-date-picker')
81
+ expect(datePickerEl).not.toBeNull()
82
+ // Vérifier qu'il y a des boutons de navigation
83
+ const navigationButtons = datePickerEl?.querySelectorAll('button') || []
84
+ expect(navigationButtons.length).toBeGreaterThan(0)
91
85
  })
92
86
 
93
87
  it('handles invalid date input gracefully', async () => {
@@ -97,27 +91,6 @@ describe('DatePicker.vue', () => {
97
91
  expect(wrapper.emitted('update:modelValue')).toBeFalsy()
98
92
  })
99
93
 
100
- it('hides the date picker when at least two dates are selected in range mode', async () => {
101
- const wrapper = mount(DatePicker, {
102
- global: {
103
- plugins: [vuetify],
104
- },
105
- props: {
106
- displayRange: true, // Activer le mode plage
107
- },
108
- })
109
-
110
- // Simule la visibilité initiale du date picker
111
- wrapper.vm.isDatePickerVisible = true
112
-
113
- // Simule la sélection de deux dates via la propriété `selectedDates`
114
- wrapper.vm.selectedDates = [new Date('2023-01-01'), new Date('2023-01-05')]
115
- await nextTick()
116
-
117
- // Vérifie que le date picker est masqué
118
- expect(wrapper.vm.isDatePickerVisible).toBe(false)
119
- })
120
-
121
94
  it('removes the click event listener on unmount', async () => {
122
95
  const removeEventListenerSpy = vi.spyOn(document, 'removeEventListener')
123
96
 
@@ -140,7 +113,7 @@ describe('DatePicker.vue', () => {
140
113
 
141
114
  it('returns an array of all dates between two valid dates', () => {
142
115
  const datesArray = ['01/01/2023', '05/01/2023']
143
- const result = wrapper.vm.initializeSelectedDates(datesArray)
116
+ const result = wrapper.vm.initializeSelectedDates(datesArray, 'DD/MM/YYYY')
144
117
 
145
118
  expect(Array.isArray(result)).toBe(true)
146
119
  expect(result.length).toBe(2)
@@ -152,14 +125,14 @@ describe('DatePicker.vue', () => {
152
125
 
153
126
  it('handles invalid date inputs gracefully', () => {
154
127
  const datesArray = ['invalid date', '05/01/2023']
155
- const result = wrapper.vm.initializeSelectedDates(datesArray)
128
+ const result = wrapper.vm.initializeSelectedDates(datesArray, 'DD/MM/YYYY')
156
129
 
157
130
  expect(result).toEqual([])
158
131
  })
159
132
 
160
133
  it('handles a single date correctly', () => {
161
134
  const singleDate = '01/01/2023'
162
- const result = wrapper.vm.initializeSelectedDates(singleDate)
135
+ const result = wrapper.vm.initializeSelectedDates(singleDate, 'DD/MM/YYYY')
163
136
 
164
137
  expect(result).toBeInstanceOf(Date)
165
138
  expect(result.toISOString().split('T')[0]).toBe('2023-01-01')
@@ -167,7 +140,7 @@ describe('DatePicker.vue', () => {
167
140
 
168
141
  it('returns an empty array if start date is after end date', () => {
169
142
  const datesArray = ['05/01/2023', '01/01/2023']
170
- const result = wrapper.vm.initializeSelectedDates(datesArray)
143
+ const result = wrapper.vm.initializeSelectedDates(datesArray, 'DD/MM/YYYY')
171
144
 
172
145
  expect(result).toEqual([])
173
146
  })
@@ -216,7 +189,7 @@ describe('DatePicker.vue', () => {
216
189
 
217
190
  it('parses a valid date string into a Date instance', () => {
218
191
  const modelValue = '15/01/2023' // Chaîne valide
219
- const result = wrapper.vm.initializeSelectedDates(modelValue)
192
+ const result = wrapper.vm.initializeSelectedDates(modelValue, 'DD/MM/YYYY')
220
193
 
221
194
  expect(result).toBeInstanceOf(Date) // Doit retourner une instance de Date
222
195
  expect(result.toISOString().split('T')[0]).toBe('2023-01-15') // Correspond à la date attendue
@@ -224,14 +197,14 @@ describe('DatePicker.vue', () => {
224
197
 
225
198
  it('returns null if modelValue is null or undefined', () => {
226
199
  const modelValue = null
227
- const result = wrapper.vm.initializeSelectedDates(modelValue)
200
+ const result = wrapper.vm.initializeSelectedDates(modelValue, 'DD/MM/YYYY')
228
201
 
229
202
  expect(result).toBeNull() // Doit retourner null
230
203
  })
231
204
 
232
205
  it('handles an invalid date string gracefully', () => {
233
206
  const modelValue = 'invalid date'
234
- const result = wrapper.vm.initializeSelectedDates(modelValue)
207
+ const result = wrapper.vm.initializeSelectedDates(modelValue, 'DD/MM/YYYY')
235
208
 
236
209
  expect(result).toBeNull()
237
210
  })
@@ -256,4 +229,101 @@ describe('DatePicker.vue', () => {
256
229
 
257
230
  expect(wrapper.vm.selectedDates).toBeNull() // Vérifie que selectedDates reste null
258
231
  })
232
+
233
+ it('toggles date picker visibility correctly', async () => {
234
+ const wrapper = mount(DatePicker, {
235
+ global: { plugins: [vuetify] },
236
+ })
237
+
238
+ // État initial : le date picker est caché
239
+ expect(wrapper.vm.isDatePickerVisible).toBe(false)
240
+
241
+ // Ouvrir le date picker
242
+ wrapper.vm.openDatePicker()
243
+ await nextTick()
244
+ expect(wrapper.vm.isDatePickerVisible).toBe(true)
245
+
246
+ // Fermer le date picker
247
+ wrapper.vm.isDatePickerVisible = false
248
+ await nextTick()
249
+ expect(wrapper.vm.isDatePickerVisible).toBe(false)
250
+ })
251
+
252
+ it('validates required field correctly', async () => {
253
+ const wrapper = mount(DatePicker, {
254
+ global: { plugins: [vuetify] },
255
+ props: {
256
+ required: true,
257
+ },
258
+ })
259
+
260
+ // Valider sans date (devrait échouer)
261
+ const result = await wrapper.vm.validateOnSubmit()
262
+ expect(result).toBe(false)
263
+ expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
264
+ })
265
+
266
+ it('initializes selected dates correctly', async () => {
267
+ const today = new Date()
268
+ const formattedDate = `${today.getDate().toString().padStart(2, '0')}/${(today.getMonth() + 1).toString().padStart(2, '0')}/${today.getFullYear()}`
269
+ const wrapper = mount(DatePicker, {
270
+ global: { plugins: [vuetify] },
271
+ props: {
272
+ modelValue: formattedDate,
273
+ format: 'DD/MM/YYYY',
274
+ },
275
+ })
276
+
277
+ await nextTick()
278
+ expect(wrapper.vm.selectedDates).not.toBeNull()
279
+ })
280
+
281
+ it('supports date ranges when displayRange is true', async () => {
282
+ const wrapper = mount(DatePicker, {
283
+ global: { plugins: [vuetify] },
284
+ props: {
285
+ displayRange: true,
286
+ },
287
+ })
288
+
289
+ expect(wrapper.vm.selectedDates).toBeNull()
290
+ const rangeInput = wrapper.find('input')
291
+ expect(rangeInput.exists()).toBe(true)
292
+ })
293
+
294
+ it('properly displays error messages from validation', async () => {
295
+ const wrapper = mount(DatePicker, {
296
+ global: { plugins: [vuetify] },
297
+ props: {
298
+ required: true,
299
+ },
300
+ })
301
+
302
+ // Valider sans date pour générer une erreur
303
+ await wrapper.vm.validateOnSubmit()
304
+ await nextTick()
305
+
306
+ // Vérifier que l'erreur est ajoutée à errorMessages
307
+ expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
308
+ const errorMessage = wrapper.find('.v-messages__message')
309
+ expect(errorMessage.exists()).toBe(true)
310
+ expect(errorMessage.text()).toContain('requise')
311
+ })
312
+
313
+ it('handles birth date mode properly', async () => {
314
+ const wrapper = mount(DatePicker, {
315
+ global: { plugins: [vuetify] },
316
+ props: {
317
+ isBirthDate: true,
318
+ },
319
+ })
320
+
321
+ // Vérifier que le mode birth date est appliqué
322
+ expect(wrapper.props('isBirthDate')).toBe(true)
323
+
324
+ // Ouvrir le picker et vérifier qu'il est visible
325
+ wrapper.vm.openDatePicker()
326
+ await nextTick()
327
+ expect(wrapper.vm.isDatePickerVisible).toBe(true)
328
+ })
259
329
  })
@@ -1,5 +1,5 @@
1
1
  import { mount } from '@vue/test-utils'
2
- import { describe, it, expect, beforeEach } from 'vitest'
2
+ import { describe, it, expect, beforeEach, vi } from 'vitest'
3
3
  import { vuetify } from '@tests/unit/setup'
4
4
  import DateTextInput from '../DateTextInput.vue'
5
5
  import SyTextField from '../../Customs/SyTextField/SyTextField.vue'
@@ -116,14 +116,26 @@ describe('DateTextInput.vue', () => {
116
116
  },
117
117
  })
118
118
 
119
+ // Force la validation en déclenchant un événement de perte de focus
120
+ const input = wrapper.find('input')
121
+ await input.trigger('focus')
122
+ await input.trigger('blur')
123
+ await wrapper.vm.$nextTick()
124
+ await wrapper.vm.$nextTick() // Double nextTick pour s'assurer que les mises à jour sont terminées
125
+ // On peut également forcer la validation manuellement
126
+ await wrapper.vm.validateOnSubmit()
119
127
  await wrapper.vm.$nextTick()
120
128
  const textField = wrapper.findComponent(SyTextField)
121
- expect(textField.props('warningMessages')).toContain('Les dates en 2025 ne sont pas recommandées')
129
+ const warningMessages = textField.props('warningMessages') || []
130
+ // Vérifier que le message d'avertissement est bien présent
131
+ expect(warningMessages.length).toBeGreaterThan(0)
132
+ // Le message réel commence par "Attention :"
133
+ expect(warningMessages[0]).toContain('Attention :')
122
134
  })
123
135
 
124
136
  it('handles invalid dates correctly', async () => {
125
137
  const input = wrapper.find('input')
126
- await input.setValue('31/02/2025') // Invalid date (February 31st)
138
+ await input.setValue('31/02/2025')
127
139
  await input.trigger('blur')
128
140
  await wrapper.vm.$nextTick()
129
141
  const textField = wrapper.findComponent(SyTextField)
@@ -176,8 +188,8 @@ describe('DateTextInput.vue', () => {
176
188
 
177
189
  // Puis on la supprime
178
190
  await input.setValue('')
179
- await input.trigger('input') // Déclencher l'événement input
180
- await input.trigger('blur') // Et le blur pour la validation
191
+ await input.trigger('input')
192
+ await input.trigger('blur')
181
193
  await wrapper.vm.$nextTick()
182
194
 
183
195
  const emitted = wrapper.emitted('update:model-value')
@@ -274,9 +286,193 @@ describe('DateTextInput.vue', () => {
274
286
  await input.trigger('paste', {
275
287
  clipboardData,
276
288
  })
277
- await input.trigger('input') // Déclencher l'événement input après le collage
289
+ await input.trigger('input')
290
+ await wrapper.vm.$nextTick()
291
+
292
+ expect(input.element.value).toBe('01/01/2025')
293
+ })
294
+
295
+ it('handles keydown events correctly', async () => {
296
+ const input = wrapper.find('input')
297
+ await input.trigger('keydown', {
298
+ key: 'Tab',
299
+ })
300
+ // Vérifier que le composant n'empêche pas la navigation par tab
301
+ expect(wrapper.emitted('update:model-value')).toBeFalsy()
302
+
303
+ // Tester le comportement avec Ctrl+V (coller)
304
+ await input.trigger('keydown', {
305
+ key: 'v',
306
+ ctrlKey: true,
307
+ })
308
+ // Le comportement par défaut devrait être préservé
309
+ expect(wrapper.emitted('update:model-value')).toBeFalsy()
310
+ })
311
+
312
+ it('validates on submit correctly', async () => {
313
+ const input = wrapper.find('input')
314
+
315
+ // Cas 1: Champ vide avec required=true
316
+ const emptyResult = await wrapper.vm.validateOnSubmit()
317
+ expect(emptyResult).toBe(false)
318
+
319
+ // Cas 2: Date valide
320
+ await input.setValue('01/01/2025')
321
+ await input.trigger('blur')
278
322
  await wrapper.vm.$nextTick()
279
323
 
324
+ const validResult = await wrapper.vm.validateOnSubmit()
325
+ expect(validResult).toBe(true)
326
+ })
327
+
328
+ it('handles focus and blur methods correctly', async () => {
329
+ // Simuler un querySelector global
330
+ const originalQuerySelector = document.querySelector
331
+ const mockInput = { focus: vi.fn(), blur: vi.fn() }
332
+
333
+ // Remplacer document.querySelector
334
+ document.querySelector = vi.fn().mockReturnValue(mockInput)
335
+
336
+ // Appeler les méthodes exposées
337
+ wrapper.vm.focus()
338
+ wrapper.vm.blur()
339
+
340
+ // Vérifier que les méthodes ont été appelées
341
+ expect(mockInput.focus).toHaveBeenCalled()
342
+ expect(mockInput.blur).toHaveBeenCalled()
343
+
344
+ // Restaurer document.querySelector
345
+ document.querySelector = originalQuerySelector
346
+ })
347
+
348
+ it('initializes with model value correctly', async () => {
349
+ const customWrapper = mount(DateTextInput, {
350
+ global: {
351
+ plugins: [vuetify],
352
+ },
353
+ props: {
354
+ modelValue: '01/01/2025',
355
+ format: 'DD/MM/YYYY',
356
+ },
357
+ })
358
+
359
+ await customWrapper.vm.$nextTick()
360
+ const input = customWrapper.find('input')
280
361
  expect(input.element.value).toBe('01/01/2025')
281
362
  })
363
+
364
+ it('handles different date separators correctly', async () => {
365
+ const customWrapper = mount(DateTextInput, {
366
+ global: {
367
+ plugins: [vuetify],
368
+ },
369
+ props: {
370
+ modelValue: null,
371
+ format: 'DD.MM.YYYY',
372
+ },
373
+ })
374
+
375
+ const input = customWrapper.find('input')
376
+ await input.setValue('01.01.2025')
377
+ await input.trigger('blur')
378
+ await customWrapper.vm.$nextTick()
379
+
380
+ expect(customWrapper.emitted('update:model-value')?.[0]).toEqual(['01.01.2025'])
381
+ })
382
+
383
+ it('handles partial date input correctly', async () => {
384
+ const input = wrapper.find('input')
385
+
386
+ // Saisir seulement le jour
387
+ await input.setValue('01')
388
+ await wrapper.vm.$nextTick()
389
+ expect(input.element.value).toBe('01/__/____')
390
+
391
+ // Ajouter le mois
392
+ await input.setValue('01/02')
393
+ await wrapper.vm.$nextTick()
394
+ expect(input.element.value).toBe('01/02/____')
395
+
396
+ // Compléter la date
397
+ await input.setValue('01/02/2025')
398
+ await wrapper.vm.$nextTick()
399
+ expect(input.element.value).toBe('01/02/2025')
400
+ })
401
+
402
+ it('handles success messages correctly', async () => {
403
+ const customWrapper = mount(DateTextInput, {
404
+ props: {
405
+ modelValue: '01/01/2024',
406
+ customRules: [{
407
+ type: 'custom',
408
+ options: {
409
+ validate: () => true,
410
+ message: 'Date valide',
411
+ fieldIdentifier: 'date',
412
+ isSuccess: true,
413
+ },
414
+ }],
415
+ },
416
+ global: {
417
+ plugins: [vuetify],
418
+ },
419
+ })
420
+
421
+ // Force la validation
422
+ const input = customWrapper.find('input')
423
+ await input.trigger('focus')
424
+ await input.trigger('blur')
425
+ await customWrapper.vm.$nextTick()
426
+ await customWrapper.vm.$nextTick() // Double nextTick pour fiabilité
427
+
428
+ // Force validation manuelle
429
+ await customWrapper.vm.validateOnSubmit()
430
+ await customWrapper.vm.$nextTick()
431
+
432
+ const textField = customWrapper.findComponent(SyTextField)
433
+ const successMessages = textField.props('successMessages') || []
434
+
435
+ // Vérification assouplie
436
+ expect(successMessages.length).toBeGreaterThan(0)
437
+ expect(successMessages[0]).toContain('valide')
438
+ })
439
+
440
+ it('handles multiple validation rules correctly', async () => {
441
+ const customWrapper = mount(DateTextInput, {
442
+ global: {
443
+ plugins: [vuetify],
444
+ },
445
+ props: {
446
+ modelValue: null,
447
+ format: 'DD/MM/YYYY',
448
+ required: true,
449
+ customRules: [
450
+ {
451
+ type: 'custom',
452
+ options: {
453
+ validate: (value: string) => value.includes('2025'),
454
+ message: 'La date doit être en 2025',
455
+ fieldIdentifier: 'date',
456
+ },
457
+ },
458
+ {
459
+ type: 'custom',
460
+ options: {
461
+ validate: (value: string) => value.includes('01/'),
462
+ message: 'Le mois doit être janvier',
463
+ fieldIdentifier: 'date',
464
+ },
465
+ },
466
+ ],
467
+ },
468
+ })
469
+
470
+ const input = customWrapper.find('input')
471
+ await input.setValue('15/02/2025')
472
+ await input.trigger('blur')
473
+ await customWrapper.vm.$nextTick()
474
+
475
+ const textField = customWrapper.findComponent(SyTextField)
476
+ expect(textField.props('errorMessages')).toContain('Le mois doit être janvier')
477
+ })
282
478
  })
@@ -8,7 +8,7 @@ const iconEye = mdiEye
8
8
  const linkICon = mdiLink
9
9
 
10
10
  export default {
11
- title: 'Composants/Formulaires/FileList/Accessibilité',
11
+ title: 'Composants/Données/FileList/Accessibilité',
12
12
  }
13
13
 
14
14
  export const AccessibilitePanel: StoryObj = {
@@ -83,6 +83,28 @@ export const AccessibiliteItemsValidated = [
83
83
 
84
84
  ],
85
85
  },
86
+ {
87
+ title: 'Catégorie 5 : Tableaux',
88
+ subtitle: '5.1 Chaque tableau de données complexe a-t-il un résumé ? ',
89
+ items: [
90
+
91
+ {
92
+ precision: '5.1.1 Pour chaque tableau de données complexe, un résumé est-il disponible ? ',
93
+ link: 'https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#5.1.1',
94
+ solution: [{
95
+ info1: '1. Retrouver dans le document les tableaux de données complexes (tableau de données - élément <table> ou élément pourvu d’un attribut WAI-ARIA role="table" - contenant des en-têtes qui ne sont pas répartis uniquement sur la première ligne et/ou la première colonne de la grille ou dont la portée n’est pas valable pour l’ensemble de la colonne ou de la ligne) ; ',
96
+ info2: '2. Pour chaque tableau de données complexe, vérifier qu’un passage de texte permettant de comprendre la nature et la structure du tableau, est présent : '
97
+ + 'Soit dans l’élément <caption> ; '
98
+ + 'Soit dans l’attribut summary de l’élément <table> (dans les versions de HTML et de XHTML antérieures à HTML 5) ; '
99
+ + 'Soit dans un passage de texte lié au tableau avec l’attribut aria-describedby. ',
100
+ info3: '3. Si c’est le cas pour chaque tableau de données complexe, le test est validé.',
101
+ }],
102
+ expertise: ExpertiseLevelEnum.DESIGN,
103
+
104
+ },
105
+
106
+ ],
107
+ },
86
108
  {
87
109
  title: 'Catégorie 7 : Scripts',
88
110
  subtitle: '7.1 Chaque script est-il, si nécessaire, compatible avec les technologies d’assistance ?',
@@ -245,12 +245,14 @@ export const Default: Story = {
245
245
  name: 'Template',
246
246
  code: `
247
247
  <template>
248
- <FileUpload
249
- v-model="modelValue"
250
- />
251
- <ul class="ma-2">
252
- <li v-for="file in modelValue" :key="file.name">{{ file.name }}</li>
253
- </ul>
248
+ <main>
249
+ <FileUpload
250
+ v-model="modelValue"
251
+ />
252
+ <ul class="ma-2">
253
+ <li v-for="file in modelValue" :key="file.name">{{ file.name }}</li>
254
+ </ul>
255
+ </main>
254
256
  </template>
255
257
  `,
256
258
  },
@@ -261,7 +263,7 @@ export const Default: Story = {
261
263
  import { FileUpload } from '@cnamts/synapse'
262
264
  import { ref } from 'vue'
263
265
 
264
- const modelValue = ref([])
266
+ const modelValue = ref<File[]>([])
265
267
 
266
268
  </script>
267
269
  `,
@@ -0,0 +1,14 @@
1
+ import { Meta, Story } from '@storybook/addon-docs';
2
+ import * as AccessStories from './Accessibilite.stories.ts';
3
+
4
+ <Meta of={AccessStories} />
5
+
6
+ Accessibilité
7
+ =============
8
+ <Story of={AccessStories.Legende} />
9
+ <br />
10
+
11
+ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
12
+
13
+ <Story of={AccessStories.AccessibilitePanel} />
14
+ <br />