@cnamts/synapse 0.0.11-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.
- package/dist/design-system-v3.js +5394 -3813
- package/dist/design-system-v3.umd.cjs +1 -1
- package/dist/src/components/Amelipro/types/types.d.ts +38 -0
- package/dist/src/components/CookieBanner/CookieBanner.d.ts +1 -1
- package/dist/src/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
- package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +31 -23
- package/dist/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +105 -102
- package/dist/src/components/DatePicker/DateTextInput.d.ts +82 -74
- package/dist/src/components/ErrorPage/ErrorPage.d.ts +1 -1
- package/dist/src/components/FileList/FileList.d.ts +1 -0
- package/dist/src/components/FileList/UploadItem/UploadItem.d.ts +1 -1
- package/dist/src/components/FilterInline/AccessibiliteItems.d.ts +30 -0
- package/dist/src/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/FilterSideBar/FilterSideBar.d.ts +31 -0
- package/dist/src/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/locales.d.ts +7 -0
- package/dist/src/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/src/components/NirField/NirField.d.ts +952 -0
- package/dist/src/components/NotificationBar/NotificationBar.d.ts +6 -6
- package/dist/src/components/PasswordField/PasswordField.d.ts +42 -8
- package/dist/src/components/PeriodField/PeriodField.d.ts +259 -235
- package/dist/src/components/PhoneField/PhoneField.d.ts +33 -3
- package/dist/src/components/RatingPicker/EmotionPicker/EmotionPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/NumberPicker/NumberPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/StarsPicker/StarsPicker.d.ts +1 -1
- package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/config.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/UploadWorkflow/locales.d.ts +7 -0
- package/dist/src/components/UploadWorkflow/types.d.ts +19 -0
- package/dist/src/components/UploadWorkflow/useFileList.d.ts +10 -0
- package/dist/src/components/UploadWorkflow/useFileUploadJourney.d.ts +9 -0
- package/dist/src/components/Usages/Usages.d.ts +10 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/composables/date/tests/useDateFormat.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDateInitialization.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDatePickerAccessibility.spec.d.ts +1 -0
- package/dist/src/composables/date/useDateFormat.d.ts +26 -0
- package/dist/src/composables/date/useDateInitialization.d.ts +18 -0
- package/dist/src/composables/date/useDatePickerAccessibility.d.ts +8 -0
- package/dist/src/composables/rules/useFieldValidation.d.ts +1 -0
- package/dist/src/composables/useFilterable/useFilterable.d.ts +1 -1
- package/dist/src/composables/validation/tests/useValidation.spec.d.ts +1 -0
- package/dist/src/composables/validation/useValidation.d.ts +40 -0
- package/dist/src/designTokens/index.d.ts +3 -1
- package/dist/src/main.d.ts +1 -0
- package/dist/src/utils/formatDate/index.d.ts +3 -0
- package/dist/src/utils/formatDate/tests/formatDate.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateAfter/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateBefore/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateInRange/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateValid/index.d.ts +9 -0
- package/dist/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isEmailValid/tests/isEmailValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isWeekend/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.d.ts +1 -0
- package/dist/src/utils/parseDate/index.d.ts +3 -0
- package/dist/src/utils/parseDate/tests/parseDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/doMatchPattern/index.d.ts +3 -0
- package/dist/src/utils/rules/doMatchPattern/tests/matchPattern.spec.d.ts +1 -0
- package/dist/src/utils/rules/index.d.ts +11 -0
- package/dist/src/utils/rules/isDateValid/index.d.ts +4 -0
- package/dist/src/utils/rules/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/rules/isExactLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isExactLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isExactLength/tests/exactLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMaxLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMaxLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMaxLength/tests/isMaxLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMinLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMinLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMinLength/tests/isMinLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotAfterToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotBeforeDate/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotBeforeToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isRequired/index.d.ts +4 -0
- package/dist/src/utils/rules/isRequired/locales.d.ts +2 -0
- package/dist/src/utils/rules/isRequired/tests/isRequred.spec.d.ts +1 -0
- package/dist/src/utils/rules/isValidEmail/index.d.ts +4 -0
- package/dist/src/utils/rules/isValidEmail/locales.d.ts +2 -0
- package/dist/src/utils/rules/isValidEmail/tests/isValidEmail.spec.d.ts +1 -0
- package/dist/src/vuetifyConfig.d.ts +81 -0
- package/dist/style.css +1 -1
- package/package.json +3 -1
- package/src/assets/_elevations.scss +89 -0
- package/src/assets/_fonts.scss +6 -0
- package/src/assets/_radius.scss +92 -0
- package/src/assets/_spacers.scss +149 -0
- package/src/assets/settings.scss +15 -3
- package/src/assets/tokens.scss +32 -29
- package/src/components/Amelipro/types/types.ts +40 -0
- package/src/components/ChipList/ChipList.stories.ts +26 -27
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/config.ts +1 -0
- package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -2
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +65 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +13 -3
- package/src/components/Customs/SySelect/SySelect.mdx +1 -1
- package/src/components/Customs/SySelect/SySelect.stories.ts +88 -5
- package/src/components/Customs/SySelect/SySelect.vue +55 -14
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +135 -2
- package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +809 -79
- package/src/components/Customs/SyTextField/SyTextField.vue +135 -104
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +190 -38
- package/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/src/components/DatePicker/DatePicker.stories.ts +177 -5
- package/src/components/DatePicker/DatePicker.vue +302 -233
- package/src/components/DatePicker/DateTextInput.vue +101 -246
- package/src/components/DatePicker/tests/DatePicker.spec.ts +123 -60
- package/src/components/DatePicker/tests/DateTextInput.spec.ts +202 -6
- package/src/components/FileList/Accessibilite.stories.ts +1 -1
- package/src/components/FileList/AccessibiliteItems.ts +22 -0
- package/src/components/FileList/FileList.vue +2 -1
- package/src/components/FileList/UploadItem/UploadItem.vue +10 -0
- package/src/components/FileUpload/FileUpload.stories.ts +93 -7
- package/src/components/FileUpload/FileUpload.vue +1 -0
- package/src/components/FileUpload/tests/FileUpload.spec.ts +4 -4
- package/src/components/FilterInline/Accessibilite.mdx +14 -0
- package/src/components/FilterInline/Accessibilite.stories.ts +216 -0
- package/src/components/FilterInline/AccessibiliteItems.ts +132 -0
- package/src/components/FilterInline/FilterInline.mdx +180 -34
- package/src/components/FilterInline/FilterInline.stories.ts +363 -6
- package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/Accessibilite.mdx +14 -0
- package/src/components/FilterSideBar/Accessibilite.stories.ts +216 -0
- package/src/components/FilterSideBar/AccessibiliteItems.ts +153 -0
- package/src/components/FilterSideBar/FilterSideBar.mdx +237 -0
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +798 -0
- package/src/components/FilterSideBar/FilterSideBar.vue +193 -0
- package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/locales.ts +8 -0
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +305 -0
- package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +39 -0
- package/src/components/HeaderBar/Usages.mdx +1 -1
- package/src/components/NirField/NirField.stories.ts +738 -29
- package/src/components/NirField/NirField.vue +401 -359
- package/src/components/NirField/examples//342/200/257dataset/342/200/257.md +12 -0
- package/src/components/NirField/tests/NirField.spec.ts +88 -52
- package/src/components/NirField/tests/config.spec.ts +65 -0
- package/src/components/NotificationBar/Accessibilite.stories.ts +4 -0
- package/src/components/NotificationBar/NotificationBar.mdx +2 -2
- package/src/components/NotificationBar/NotificationBar.stories.ts +66 -13
- package/src/components/NotificationBar/NotificationBar.vue +42 -114
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +28 -33
- package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +1 -1
- package/src/components/PaginatedTable/PaginatedTable.vue +6 -10
- package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +4 -4
- package/src/components/PasswordField/PasswordField.mdx +129 -47
- package/src/components/PasswordField/PasswordField.stories.ts +1111 -120
- package/src/components/PasswordField/PasswordField.vue +212 -99
- package/src/components/PasswordField/tests/PasswordField.spec.ts +138 -9
- package/src/components/PeriodField/PeriodField.stories.ts +214 -118
- package/src/components/PeriodField/PeriodField.vue +238 -190
- package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
- package/src/components/PhoneField/PhoneField.stories.ts +170 -0
- package/src/components/PhoneField/PhoneField.vue +76 -17
- package/src/components/PhoneField/indicatifs.ts +1 -1
- package/src/components/PhoneField/tests/PhoneField.spec.ts +40 -0
- package/src/components/RatingPicker/RatingPicker.stories.ts +7 -7
- package/src/components/SearchListField/SearchListField.stories.ts +1 -1
- package/src/components/UploadWorkflow/Accessibilite.mdx +14 -0
- package/src/components/UploadWorkflow/Accessibilite.stories.ts +216 -0
- package/src/components/UploadWorkflow/AccessibiliteItems.ts +192 -0
- package/src/components/UploadWorkflow/UploadWorkflow.mdx +75 -0
- package/src/components/UploadWorkflow/UploadWorkflow.stories.ts +943 -0
- package/src/components/UploadWorkflow/UploadWorkflow.vue +230 -0
- package/src/components/UploadWorkflow/config.ts +29 -0
- package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/UploadWorkflow/locales.ts +8 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +257 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/UploadWorkflow.spec.ts.snap +54 -0
- package/src/components/UploadWorkflow/types.ts +21 -0
- package/src/components/UploadWorkflow/useFileList.ts +84 -0
- package/src/components/UploadWorkflow/useFileUploadJourney.ts +18 -0
- package/src/components/Usages/tests/Usages.spec.ts +183 -0
- package/src/components/index.ts +5 -0
- package/src/composables/date/tests/useDateFormat.spec.ts +67 -0
- package/src/composables/date/tests/useDateInitialization.spec.ts +89 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +102 -0
- package/src/composables/date/useDateFormat.ts +94 -0
- package/src/composables/date/useDateInitialization.ts +92 -0
- package/src/composables/date/useDatePickerAccessibility.ts +78 -0
- package/src/composables/rules/tests/useFieldValidation.spec.ts +385 -4
- package/src/composables/rules/useFieldValidation.ts +5 -2
- package/src/composables/useFilterable/useFilterable.ts +5 -4
- package/src/composables/validation/tests/useValidation.spec.ts +154 -0
- package/src/composables/validation/useValidation.ts +180 -0
- package/src/designTokens/index.ts +4 -0
- package/src/main.ts +1 -0
- package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +28 -0
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +2 -2
- package/src/stories/Accessibilite/Audit/RGAA.mdx +6 -6
- package/src/stories/Accessibilite/Introduction.mdx +2 -1
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +8 -11
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +77 -0
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +9 -3
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +2 -2
- package/src/stories/Demarrer/Accueil.mdx +1 -1
- package/src/stories/Demarrer/Introduction.stories.ts +3 -3
- package/src/stories/Demarrer/Releases.mdx +8 -0
- package/src/stories/Demarrer/Releases.stories.ts +66 -0
- package/src/stories/DesignTokens/Conteneurs.stories.ts +3 -3
- package/src/stories/DesignTokens/ThemePA.mdx +4 -30
- package/src/stories/GuideDuDev/LesBreackingChanges.mdx +36 -0
- package/src/stories/GuideDuDev/UtiliserLesRules.mdx +321 -78
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +1 -1
- package/src/utils/formatDate/index.ts +6 -0
- package/src/utils/formatDate/tests/formatDate.spec.ts +18 -0
- package/src/utils/functions/validation/isDateAfter/index.ts +9 -0
- package/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.ts +18 -0
- package/src/utils/functions/validation/isDateBefore/index.ts +9 -0
- package/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.ts +23 -0
- package/src/utils/functions/validation/isDateInRange/index.ts +22 -0
- package/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.ts +28 -0
- package/src/utils/functions/validation/isDateValid/index.ts +67 -0
- package/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.ts +46 -0
- package/src/utils/functions/validation/isEmailValid/index.ts +9 -0
- package/src/utils/functions/validation/isWeekend/index.ts +10 -0
- package/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.ts +16 -0
- package/src/utils/parseDate/index.ts +29 -0
- package/src/utils/parseDate/tests/parseDate.spec.ts +52 -0
- package/src/utils/rules/Rules.mdx +16 -0
- package/src/utils/rules/doMatchPattern/DoMachPattern.mdx +66 -0
- package/src/utils/rules/doMatchPattern/DoMatchPattern.stories.ts +106 -0
- package/src/utils/rules/doMatchPattern/index.ts +28 -0
- package/src/utils/rules/doMatchPattern/locales.ts +5 -0
- package/src/utils/rules/doMatchPattern/tests/matchPattern.spec.ts +38 -0
- package/src/utils/rules/index.ts +11 -0
- package/src/utils/rules/isDateValid/IsDateValid.mdx +87 -0
- package/src/utils/rules/isDateValid/IsDateValid.stories.ts +113 -0
- package/src/utils/rules/isDateValid/index.ts +32 -0
- package/src/utils/rules/isDateValid/locales.ts +10 -0
- package/src/utils/rules/isDateValid/tests/isDateValid.spec.ts +27 -0
- package/src/utils/rules/isExactLength/IsExactLenght.mdx +68 -0
- package/src/utils/rules/isExactLength/IsExactLength.stories.ts +151 -0
- package/src/utils/rules/{exactLength → isExactLength}/index.ts +2 -4
- package/src/utils/rules/isExactLength/tests/exactLength.spec.ts +48 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.mdx +68 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.stories.ts +152 -0
- package/src/utils/rules/isMaxLength/index.ts +30 -0
- package/src/utils/rules/isMaxLength/locales.ts +6 -0
- package/src/utils/rules/isMaxLength/tests/isMaxLength.spec.ts +42 -0
- package/src/utils/rules/isMinLength/IsMinLength.mdx +68 -0
- package/src/utils/rules/isMinLength/IsMinLength.stories.ts +152 -0
- package/src/utils/rules/isMinLength/index.ts +30 -0
- package/src/utils/rules/isMinLength/locales.ts +6 -0
- package/src/utils/rules/isMinLength/tests/isMinLength.spec.ts +42 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.mdx +68 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.stories.ts +109 -0
- package/src/utils/rules/isNotAfterDate/index.ts +25 -0
- package/src/utils/rules/isNotAfterDate/locales.ts +6 -0
- package/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.ts +25 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.mdx +83 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.stories.ts +110 -0
- package/src/utils/rules/isNotAfterToday/index.ts +28 -0
- package/src/utils/rules/isNotAfterToday/locales.ts +5 -0
- package/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.ts +30 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.mdx +68 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.stories.ts +114 -0
- package/src/utils/rules/isNotBeforeDate/index.ts +25 -0
- package/src/utils/rules/isNotBeforeDate/locales.ts +6 -0
- package/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.ts +25 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.mdx +83 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.stories.ts +110 -0
- package/src/utils/rules/isNotBeforeToday/index.ts +28 -0
- package/src/utils/rules/isNotBeforeToday/locales.ts +5 -0
- package/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.ts +36 -0
- package/src/utils/rules/isRequired/IsRequired.mdx +81 -0
- package/src/utils/rules/isRequired/IsRequired.stories.ts +101 -0
- package/src/utils/rules/{required → isRequired}/index.ts +3 -3
- package/src/utils/rules/{required/tests/index.spec.ts → isRequired/tests/isRequred.spec.ts} +9 -9
- package/src/utils/rules/isValidEmail/IsValidEmail.mdx +81 -0
- package/src/utils/rules/isValidEmail/IsValidEmail.stories.ts +101 -0
- package/src/utils/rules/{email → isValidEmail}/index.ts +3 -5
- package/src/utils/rules/{email/tests/email.spec.ts → isValidEmail/tests/isValidEmail.spec.ts} +5 -5
- package/src/vuetifyConfig.ts +61 -0
- package/dist/src/utils/rules/email/index.d.ts +0 -4
- package/dist/src/utils/rules/exactLength/index.d.ts +0 -4
- package/dist/src/utils/rules/required/index.d.ts +0 -4
- package/dist/src/utils/rules/required/ruleMessageHelper.d.ts +0 -3
- package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
- package/src/composables/useFilterable/__snapshots__/useFilterable.spec.ts.snap +0 -3
- package/src/utils/functions/isEmailValid/index.ts +0 -8
- package/src/utils/rules/required/ruleMessageHelper.ts +0 -14
- package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +0 -22
- /package/dist/src/{utils/functions/isEmailValid/tests/isEmailValid.spec.d.ts → components/FilterSideBar/tests/FilterSideBar.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/NirField/tests/config.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → components/UploadWorkflow/tests/UploadWorkflow.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
- /package/dist/src/utils/functions/{isEmailValid → validation/isEmailValid}/index.d.ts +0 -0
- /package/dist/src/utils/rules/{exactLength → doMatchPattern}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{email → isDateValid}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{required → isNotAfterDate}/locales.d.ts +0 -0
- /package/src/utils/functions/{isEmailValid → validation/isEmailValid}/tests/isEmailValid.spec.ts +0 -0
- /package/src/utils/rules/{exactLength → isExactLength}/locales.ts +0 -0
- /package/src/utils/rules/{required → isRequired}/locales.ts +0 -0
- /package/src/utils/rules/{email → isValidEmail}/locales.ts +0 -0
|
@@ -2,26 +2,56 @@
|
|
|
2
2
|
import { ref, computed, watch } from 'vue'
|
|
3
3
|
import { config } from './config'
|
|
4
4
|
import { locales } from './locales'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { useValidation, type ValidationRule } from '@/composables/validation/useValidation'
|
|
6
|
+
import {
|
|
7
|
+
mdiEye,
|
|
8
|
+
mdiEyeOff,
|
|
9
|
+
mdiAlertCircle,
|
|
10
|
+
mdiAlert,
|
|
11
|
+
mdiCheckCircle,
|
|
12
|
+
} from '@mdi/js'
|
|
8
13
|
import useCustomizableOptions, { type CustomizableOptions } from '@/composables/useCustomizableOptions'
|
|
9
|
-
|
|
10
|
-
type
|
|
14
|
+
import SyTextField from '@/components/Customs/SyTextField/SyTextField.vue'
|
|
15
|
+
import type { ColorType } from '@/components/Customs/SyTextField/types'
|
|
11
16
|
|
|
12
17
|
const props = withDefaults(defineProps<{
|
|
13
18
|
modelValue?: string | null
|
|
14
|
-
|
|
19
|
+
variantStyle?: 'outlined' | 'underlined'
|
|
20
|
+
color?: ColorType
|
|
21
|
+
label?: string
|
|
15
22
|
required?: boolean
|
|
23
|
+
errorMessages?: string[] | null
|
|
24
|
+
warningMessages?: string[] | null
|
|
25
|
+
successMessages?: string[] | null
|
|
26
|
+
isReadOnly?: boolean
|
|
27
|
+
isDisabled?: boolean
|
|
28
|
+
placeholder?: string
|
|
29
|
+
customRules?: ValidationRule[]
|
|
30
|
+
customWarningRules?: ValidationRule[]
|
|
31
|
+
customSuccessRules?: ValidationRule[]
|
|
32
|
+
showSuccessMessages?: boolean
|
|
33
|
+
displayAsterisk?: boolean
|
|
16
34
|
isValidateOnBlur?: boolean
|
|
17
|
-
|
|
18
|
-
customRules?: any
|
|
35
|
+
disableErrorHandling?: boolean
|
|
19
36
|
} & CustomizableOptions>(), {
|
|
20
37
|
modelValue: null,
|
|
21
|
-
|
|
38
|
+
variantStyle: 'outlined',
|
|
39
|
+
color: 'primary',
|
|
40
|
+
label: undefined,
|
|
22
41
|
required: false,
|
|
42
|
+
errorMessages: null,
|
|
43
|
+
warningMessages: null,
|
|
44
|
+
successMessages: null,
|
|
45
|
+
isReadOnly: false,
|
|
46
|
+
isDisabled: false,
|
|
47
|
+
placeholder: undefined,
|
|
48
|
+
customRules: () => [],
|
|
49
|
+
customWarningRules: () => [],
|
|
50
|
+
customSuccessRules: () => [],
|
|
51
|
+
showSuccessMessages: true,
|
|
52
|
+
displayAsterisk: false,
|
|
23
53
|
isValidateOnBlur: true,
|
|
24
|
-
|
|
54
|
+
disableErrorHandling: false,
|
|
25
55
|
})
|
|
26
56
|
|
|
27
57
|
const options = useCustomizableOptions(config, props)
|
|
@@ -43,147 +73,230 @@
|
|
|
43
73
|
},
|
|
44
74
|
)
|
|
45
75
|
|
|
46
|
-
|
|
76
|
+
// Construction des règles de validation
|
|
77
|
+
const defaultRules = computed<ValidationRule[]>(() => {
|
|
78
|
+
const rules: ValidationRule[] = []
|
|
47
79
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
? [{
|
|
80
|
+
if (props.required) {
|
|
81
|
+
rules.push({
|
|
51
82
|
type: 'required',
|
|
52
|
-
options: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const baseRules = (props.required ? defaultRules : [])
|
|
59
|
-
return props.customRules ? generateRules([...baseRules, ...props.customRules]) : generateRules(baseRules)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
const errors = ref<string[]>([])
|
|
63
|
-
const successes = ref<string[]>([])
|
|
83
|
+
options: {
|
|
84
|
+
message: 'Le mot de passe est requis',
|
|
85
|
+
fieldIdentifier: props.label || 'password',
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
}
|
|
64
89
|
|
|
65
|
-
|
|
90
|
+
// Règle pour le message de succès
|
|
91
|
+
rules.push({
|
|
92
|
+
type: 'custom',
|
|
93
|
+
options: {
|
|
94
|
+
validate: (value: string) => value ? true : 'Ce champ est requis',
|
|
95
|
+
successMessage: 'Mot de passe fort',
|
|
96
|
+
fieldIdentifier: props.label || 'password',
|
|
97
|
+
},
|
|
98
|
+
})
|
|
66
99
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, { immediate: true })
|
|
100
|
+
return rules
|
|
101
|
+
})
|
|
70
102
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
// Initialisation du composable de validation
|
|
104
|
+
const { errors, warnings, successes, validateField } = useValidation({
|
|
105
|
+
customRules: defaultRules.value,
|
|
106
|
+
warningRules: props.customWarningRules || [],
|
|
107
|
+
successRules: props.customSuccessRules || [],
|
|
108
|
+
showSuccessMessages: props.showSuccessMessages,
|
|
109
|
+
fieldIdentifier: props.label || 'password',
|
|
110
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
111
|
+
})
|
|
78
112
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
{ immediate: true },
|
|
85
|
-
)
|
|
113
|
+
// Computed pour les états de validation
|
|
114
|
+
const hasError = computed(() => errors.value.length > 0)
|
|
115
|
+
const hasWarning = computed(() => warnings.value.length > 0)
|
|
116
|
+
const hasSuccess = computed(() => successes.value.length > 0 && props.showSuccessMessages)
|
|
86
117
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
118
|
+
const validationIcon = computed(() => {
|
|
119
|
+
if (hasError.value) return mdiAlertCircle
|
|
120
|
+
if (hasWarning.value) return mdiAlert
|
|
121
|
+
if (hasSuccess.value) return mdiCheckCircle
|
|
122
|
+
return undefined
|
|
123
|
+
})
|
|
94
124
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
125
|
+
const validationColor = computed(() => {
|
|
126
|
+
if (hasError.value) return 'error'
|
|
127
|
+
if (hasWarning.value) return 'warning'
|
|
128
|
+
if (hasSuccess.value) return 'success'
|
|
129
|
+
return 'rgb(0 0 0 / 100%)'
|
|
130
|
+
})
|
|
98
131
|
|
|
99
|
-
|
|
132
|
+
// Synchronisation des messages externes
|
|
133
|
+
watch(() => props.errorMessages, (newVal) => {
|
|
134
|
+
if (newVal) {
|
|
135
|
+
errors.value = newVal
|
|
136
|
+
}
|
|
137
|
+
}, { immediate: true })
|
|
100
138
|
|
|
101
|
-
|
|
139
|
+
watch(() => props.warningMessages, (newVal) => {
|
|
140
|
+
if (newVal) {
|
|
141
|
+
warnings.value = newVal
|
|
142
|
+
}
|
|
143
|
+
}, { immediate: true })
|
|
102
144
|
|
|
103
|
-
|
|
104
|
-
|
|
145
|
+
watch(() => props.successMessages, (newVal) => {
|
|
146
|
+
if (newVal) {
|
|
147
|
+
successes.value = newVal
|
|
148
|
+
}
|
|
149
|
+
}, { immediate: true })
|
|
105
150
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
151
|
+
watch(() => password.value, () => {
|
|
152
|
+
validateField(password.value, [...defaultRules.value, ...(props.customRules || [])], props.customWarningRules || [], props.customSuccessRules || [])
|
|
153
|
+
emit('update:modelValue', password.value)
|
|
154
|
+
})
|
|
110
155
|
|
|
111
156
|
function handleKeydown(event: KeyboardEvent): void {
|
|
112
157
|
if (event.key === 'Enter') {
|
|
113
|
-
|
|
158
|
+
validateOnSubmit()
|
|
114
159
|
}
|
|
115
160
|
}
|
|
116
161
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
162
|
+
const validateOnSubmit = () => {
|
|
163
|
+
validateField(password.value, [...defaultRules.value, ...(props.customRules || [])], props.customWarningRules || [], props.customSuccessRules || [])
|
|
164
|
+
const isValid = errors.value.length === 0
|
|
165
|
+
if (isValid) {
|
|
166
|
+
emit('submit')
|
|
167
|
+
}
|
|
168
|
+
return isValid
|
|
121
169
|
}
|
|
122
170
|
|
|
123
171
|
defineExpose({
|
|
172
|
+
showEyeIcon,
|
|
173
|
+
errors,
|
|
174
|
+
warnings,
|
|
175
|
+
successes,
|
|
176
|
+
hasError,
|
|
177
|
+
hasWarning,
|
|
178
|
+
hasSuccess,
|
|
124
179
|
validateOnSubmit,
|
|
125
180
|
})
|
|
126
181
|
</script>
|
|
127
182
|
|
|
128
183
|
<template>
|
|
129
|
-
<
|
|
184
|
+
<SyTextField
|
|
130
185
|
v-model="password"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
186
|
+
v-bind="options"
|
|
187
|
+
:variant-style="props.variantStyle"
|
|
188
|
+
:color="props.color"
|
|
189
|
+
:label="props.label"
|
|
190
|
+
:required="props.required"
|
|
134
191
|
:error-messages="errors"
|
|
135
|
-
:messages="
|
|
192
|
+
:warning-messages="warnings"
|
|
193
|
+
:success-messages="successes"
|
|
194
|
+
:is-read-only="props.isReadOnly"
|
|
195
|
+
:is-disabled="props.isDisabled"
|
|
196
|
+
:placeholder="props.placeholder"
|
|
136
197
|
:type="showEyeIcon ? 'text' : 'password'"
|
|
137
|
-
:
|
|
198
|
+
:display-asterisk="props.displayAsterisk"
|
|
199
|
+
:rules="[...defaultRules, ...props.customRules]"
|
|
138
200
|
class="vd-password"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
validate-on="blur lazy"
|
|
142
|
-
@blur="validateFields(true)"
|
|
201
|
+
:validate-on="props.isValidateOnBlur ? 'blur lazy' : 'lazy'"
|
|
202
|
+
@blur="props.isValidateOnBlur ? validateField(password, [...defaultRules, ...(props.customRules || [])], props.customWarningRules || [], props.customSuccessRules || []) : () => {}"
|
|
143
203
|
@keydown="handleKeydown"
|
|
144
|
-
@update:model-value="emitChangeEvent"
|
|
145
204
|
>
|
|
146
205
|
<template #append-inner>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
class="mx-auto"
|
|
206
|
+
<div
|
|
207
|
+
class="d-flex align-center"
|
|
150
208
|
v-bind="options.btn"
|
|
151
|
-
@click="showEyeIcon = !showEyeIcon"
|
|
152
209
|
>
|
|
153
|
-
<VIcon
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
210
|
+
<VIcon
|
|
211
|
+
:icon="validationIcon"
|
|
212
|
+
:color="validationColor"
|
|
213
|
+
class="mr-2"
|
|
214
|
+
/>
|
|
215
|
+
<VIcon
|
|
216
|
+
:icon="showEyeIcon ? eyeIcon : eyeOffIcon"
|
|
217
|
+
color="rgb(0 0 0 / 70%)"
|
|
218
|
+
:aria-label="btnLabel"
|
|
219
|
+
role="button"
|
|
220
|
+
@click="showEyeIcon = !showEyeIcon"
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
157
223
|
</template>
|
|
158
|
-
</
|
|
224
|
+
</SyTextField>
|
|
159
225
|
</template>
|
|
160
226
|
|
|
161
227
|
<style lang="scss" scoped>
|
|
162
228
|
@use '@/assets/tokens';
|
|
163
229
|
|
|
164
230
|
.vd-password {
|
|
165
|
-
.v-
|
|
166
|
-
|
|
167
|
-
|
|
231
|
+
:deep(.v-field) {
|
|
232
|
+
.v-field__input {
|
|
233
|
+
padding-right: 48px;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.warning-field {
|
|
239
|
+
:deep(.v-input__details > .v-icon),
|
|
240
|
+
:deep(.v-input__prepend > .v-icon),
|
|
241
|
+
:deep(.v-input__append > .v-icon) {
|
|
242
|
+
opacity: 1 !important;
|
|
168
243
|
}
|
|
169
244
|
|
|
170
|
-
:deep(.v-field
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
245
|
+
:deep(.v-field) {
|
|
246
|
+
color: tokens.$colors-border-warning !important;
|
|
247
|
+
|
|
248
|
+
.v-field__outline {
|
|
249
|
+
color: tokens.$colors-border-warning !important;
|
|
250
|
+
}
|
|
175
251
|
}
|
|
176
252
|
|
|
177
|
-
:deep(.v-
|
|
178
|
-
|
|
253
|
+
:deep(.v-messages) {
|
|
254
|
+
opacity: 1 !important;
|
|
255
|
+
|
|
256
|
+
.v-messages__message {
|
|
257
|
+
color: tokens.$colors-border-warning !important;
|
|
258
|
+
}
|
|
179
259
|
}
|
|
180
260
|
}
|
|
181
261
|
|
|
182
|
-
.
|
|
183
|
-
|
|
262
|
+
.error-field {
|
|
263
|
+
:deep(.v-input__control),
|
|
264
|
+
:deep(.v-messages__message) {
|
|
265
|
+
color: tokens.$colors-text-error !important;
|
|
266
|
+
}
|
|
184
267
|
|
|
185
268
|
.v-field--active & {
|
|
269
|
+
color: tokens.$colors-border-error !important;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.success-field {
|
|
274
|
+
:deep(.v-input__details > .v-icon),
|
|
275
|
+
:deep(.v-input__prepend > .v-icon),
|
|
276
|
+
:deep(.v-input__append > .v-icon) {
|
|
277
|
+
opacity: 1 !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:deep(.v-field) {
|
|
186
281
|
color: tokens.$colors-border-success !important;
|
|
282
|
+
|
|
283
|
+
.v-field__outline {
|
|
284
|
+
color: tokens.$colors-border-success !important;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:deep(.v-messages) {
|
|
289
|
+
opacity: 1 !important;
|
|
290
|
+
|
|
291
|
+
.v-messages__message {
|
|
292
|
+
color: tokens.$colors-border-success !important;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.basic-field {
|
|
298
|
+
:deep(.v-icon__svg) {
|
|
299
|
+
fill: rgb(0 0 0 / 70%);
|
|
187
300
|
}
|
|
188
301
|
}
|
|
189
302
|
</style>
|
|
@@ -7,8 +7,12 @@ import { createVuetify } from 'vuetify'
|
|
|
7
7
|
interface PasswordFieldVM {
|
|
8
8
|
showEyeIcon: boolean
|
|
9
9
|
errors: string[]
|
|
10
|
-
isValidating: boolean
|
|
11
10
|
validateOnSubmit: () => boolean
|
|
11
|
+
hasError: boolean
|
|
12
|
+
hasWarning: boolean
|
|
13
|
+
hasSuccess: boolean
|
|
14
|
+
validationIcon: string
|
|
15
|
+
validationIconColor: string
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
describe('PasswordField.vue', () => {
|
|
@@ -36,7 +40,7 @@ describe('PasswordField.vue', () => {
|
|
|
36
40
|
// 2. Cast wrapper.vm as your interface
|
|
37
41
|
const vm = wrapper.vm as unknown as PasswordFieldVM
|
|
38
42
|
|
|
39
|
-
const button = wrapper.find('button')
|
|
43
|
+
const button = wrapper.find('[role="button"]')
|
|
40
44
|
expect(vm.showEyeIcon).toBe(false) // from your interface
|
|
41
45
|
await button.trigger('click')
|
|
42
46
|
expect(vm.showEyeIcon).toBe(true)
|
|
@@ -62,35 +66,160 @@ describe('PasswordField.vue', () => {
|
|
|
62
66
|
},
|
|
63
67
|
props: {
|
|
64
68
|
required: true,
|
|
69
|
+
label: 'Password',
|
|
65
70
|
},
|
|
66
71
|
})
|
|
67
72
|
const vm = wrapper.vm as unknown as PasswordFieldVM
|
|
68
73
|
|
|
69
74
|
const input = wrapper.find('input')
|
|
70
75
|
await input.trigger('blur')
|
|
71
|
-
expect(vm.errors).toContain('Le mot de passe est requis
|
|
76
|
+
expect(vm.errors).toContain('Le mot de passe est requis')
|
|
72
77
|
})
|
|
73
78
|
|
|
74
|
-
it('validates fields on submit
|
|
79
|
+
it('validates fields on submit', async () => {
|
|
75
80
|
const wrapper = mount(PasswordField, {
|
|
76
81
|
global: {
|
|
77
82
|
plugins: [vuetify],
|
|
78
83
|
},
|
|
79
84
|
props: {
|
|
80
85
|
modelValue: '',
|
|
81
|
-
|
|
86
|
+
variantStyle: 'underlined',
|
|
82
87
|
required: true,
|
|
88
|
+
label: 'Password',
|
|
83
89
|
},
|
|
84
90
|
})
|
|
85
91
|
const vm = wrapper.vm as unknown as PasswordFieldVM
|
|
86
92
|
|
|
87
93
|
const result = vm.validateOnSubmit()
|
|
88
|
-
expect(vm.isValidating).toBe(true)
|
|
89
94
|
expect(result).toBe(false)
|
|
95
|
+
expect(vm.errors).toContain('Le mot de passe est requis')
|
|
90
96
|
|
|
91
|
-
//
|
|
92
|
-
await wrapper.
|
|
97
|
+
// Test avec un mot de passe valide
|
|
98
|
+
await wrapper.setProps({ modelValue: 'valid-password' })
|
|
99
|
+
const validResult = vm.validateOnSubmit()
|
|
100
|
+
expect(validResult).toBe(true)
|
|
101
|
+
expect(wrapper.emitted().submit).toBeTruthy()
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('displays warning and success messages', async () => {
|
|
105
|
+
const wrapper = mount(PasswordField, {
|
|
106
|
+
global: {
|
|
107
|
+
plugins: [vuetify],
|
|
108
|
+
},
|
|
109
|
+
props: {
|
|
110
|
+
modelValue: 'test',
|
|
111
|
+
warningMessages: ['Attention: mot de passe court'],
|
|
112
|
+
successMessages: ['Mot de passe valide'],
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const messages = wrapper.findAll('.v-messages__message')
|
|
117
|
+
expect(messages.length).toBe(1) // SyTextField affiche soit les warnings, soit les succès
|
|
118
|
+
expect(messages[0].text()).toBe('Attention: mot de passe court')
|
|
119
|
+
|
|
120
|
+
// Simuler la suppression du warning pour voir le message de succès
|
|
121
|
+
await wrapper.setProps({ warningMessages: [] })
|
|
122
|
+
const successMessages = wrapper.findAll('.v-messages__message')
|
|
123
|
+
expect(successMessages.length).toBe(1)
|
|
124
|
+
expect(successMessages[0].text()).toBe('Mot de passe valide')
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('handles custom validation rules', async () => {
|
|
128
|
+
const wrapper = mount(PasswordField, {
|
|
129
|
+
global: {
|
|
130
|
+
plugins: [vuetify],
|
|
131
|
+
},
|
|
132
|
+
props: {
|
|
133
|
+
modelValue: 'test',
|
|
134
|
+
customRules: [{
|
|
135
|
+
type: 'custom',
|
|
136
|
+
options: {
|
|
137
|
+
message: 'Le mot de passe doit contenir au moins 8 caractères',
|
|
138
|
+
validate: (value: string) => value.length >= 8,
|
|
139
|
+
},
|
|
140
|
+
}],
|
|
141
|
+
customWarningRules: [{
|
|
142
|
+
type: 'custom',
|
|
143
|
+
options: {
|
|
144
|
+
warningMessage: 'Le mot de passe pourrait être plus fort',
|
|
145
|
+
validate: (value: string) => /[A-Z]/.test(value),
|
|
146
|
+
},
|
|
147
|
+
}],
|
|
148
|
+
customSuccessRules: [{
|
|
149
|
+
type: 'custom',
|
|
150
|
+
options: {
|
|
151
|
+
successMessage: 'Mot de passe fort',
|
|
152
|
+
validate: (value: string) => value.length >= 12,
|
|
153
|
+
},
|
|
154
|
+
}],
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const vm = wrapper.vm as unknown as PasswordFieldVM
|
|
159
|
+
|
|
160
|
+
// Forcer la validation initiale
|
|
161
|
+
await wrapper.find('input').trigger('blur')
|
|
162
|
+
expect(vm.errors).toContain('Le mot de passe doit contenir au moins 8 caractères')
|
|
163
|
+
|
|
164
|
+
// Mettons un mot de passe plus long mais sans majuscule -> warning
|
|
165
|
+
await wrapper.setProps({ modelValue: 'testpassword' })
|
|
166
|
+
await wrapper.find('input').trigger('blur')
|
|
167
|
+
const messages = wrapper.findAll('.v-messages__message')
|
|
168
|
+
expect(messages[0].text()).toBe('Le mot de passe pourrait être plus fort')
|
|
169
|
+
|
|
170
|
+
// Mettons un mot de passe fort -> succès
|
|
171
|
+
await wrapper.setProps({ modelValue: 'TestPassword123' })
|
|
172
|
+
await wrapper.find('input').trigger('blur')
|
|
173
|
+
const successMessages = wrapper.findAll('.v-messages__message')
|
|
174
|
+
expect(successMessages[0].text()).toBe('Mot de passe fort')
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it('displays validation states based on validation rules', async () => {
|
|
178
|
+
const wrapper = mount(PasswordField, {
|
|
179
|
+
global: {
|
|
180
|
+
plugins: [vuetify],
|
|
181
|
+
},
|
|
182
|
+
props: {
|
|
183
|
+
modelValue: 'test',
|
|
184
|
+
customRules: [{
|
|
185
|
+
type: 'custom',
|
|
186
|
+
options: {
|
|
187
|
+
message: 'Le mot de passe doit contenir au moins 8 caractères',
|
|
188
|
+
validate: (value: string) => value.length >= 8,
|
|
189
|
+
},
|
|
190
|
+
}],
|
|
191
|
+
customWarningRules: [{
|
|
192
|
+
type: 'custom',
|
|
193
|
+
options: {
|
|
194
|
+
warningMessage: 'Le mot de passe pourrait être plus fort',
|
|
195
|
+
validate: (value: string) => /[A-Z]/.test(value),
|
|
196
|
+
},
|
|
197
|
+
}],
|
|
198
|
+
customSuccessRules: [{
|
|
199
|
+
type: 'custom',
|
|
200
|
+
options: {
|
|
201
|
+
successMessage: 'Mot de passe fort',
|
|
202
|
+
validate: (value: string) => value.length >= 12,
|
|
203
|
+
},
|
|
204
|
+
}],
|
|
205
|
+
},
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
// Forcer la validation initiale
|
|
209
|
+
await wrapper.find('input').trigger('blur')
|
|
210
|
+
|
|
211
|
+
// État d'erreur
|
|
212
|
+
const vm = wrapper.vm as unknown as PasswordFieldVM
|
|
213
|
+
expect(vm.hasError).toBe(true)
|
|
214
|
+
|
|
215
|
+
// État d'avertissement
|
|
216
|
+
await wrapper.setProps({ modelValue: 'testpassword' })
|
|
217
|
+
await wrapper.find('input').trigger('blur')
|
|
218
|
+
expect(vm.hasWarning).toBe(true)
|
|
93
219
|
|
|
94
|
-
|
|
220
|
+
// État de succès
|
|
221
|
+
await wrapper.setProps({ modelValue: 'TestPassword123' })
|
|
222
|
+
await wrapper.find('input').trigger('blur')
|
|
223
|
+
expect(vm.hasSuccess).toBe(true)
|
|
95
224
|
})
|
|
96
225
|
})
|