@cnamts/synapse 1.0.27 → 1.1.1
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/README.md +1 -1
- package/dist/{AutocompleteFilter-C9eLKyW8.js → AutocompleteFilter-CGF33skz.js} +3 -3
- package/dist/{DateFilter-y-GLkAkn.js → DateFilter-D7-MsKtx.js} +8 -8
- package/dist/{NumberFilter-DN6hIBS7.js → NumberFilter-bjQPPfsj.js} +1 -1
- package/dist/{PeriodFilter-MoUUp9qS.js → PeriodFilter-B3wJpK8-.js} +1 -1
- package/dist/{SelectFilter-bCbrdLmu.js → SelectFilter-BN6DbKAV.js} +1 -1
- package/dist/{TextFilter-CvjgEaoM.js → TextFilter-BffP0J2f.js} +4 -4
- package/dist/{apLightTheme2026-ug4Y23ns.js → apLightTheme2026-C4ygwMHC.js} +23 -22
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +10 -10
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +10 -10
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +10 -10
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +4 -4
- package/dist/components/Captcha/Captcha.d.ts +27 -16
- package/dist/components/Captcha/CaptchaForm.d.ts +29 -3
- package/dist/components/Captcha/types.d.ts +14 -0
- package/dist/components/Captcha/useCaptchaValidation.d.ts +37 -0
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +2 -2
- package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +33 -13
- package/dist/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.d.ts +23 -0
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +85 -313
- package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +4 -4
- package/dist/components/Customs/Selects/SyInputSelect/SyInputSelect.d.ts +1 -1
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +9 -11
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +7 -7
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +18 -49
- package/dist/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.d.ts +29 -0
- package/dist/components/Customs/SyCheckBoxGroup/types.d.ts +46 -0
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +19 -54
- package/dist/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.d.ts +27 -0
- package/dist/components/Customs/SyCheckbox/types.d.ts +49 -0
- package/dist/components/Customs/SyIcon/SyIcon.d.ts +77 -1
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +10 -10
- package/dist/components/Customs/SyTextField/FieldState.d.ts +5 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +19 -79
- package/dist/components/Customs/SyTextField/locales.d.ts +7 -0
- package/dist/components/Customs/SyTextField/types.d.ts +67 -4
- package/dist/components/Customs/SyTextField/useNumberField.d.ts +23 -0
- package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +38 -0
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +170 -622
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +85 -311
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +39 -152
- package/dist/components/DialogBox/DialogBox.d.ts +2 -0
- package/dist/components/DialogBox/locales.d.ts +1 -0
- package/dist/components/FilterInline/FilterInline.d.ts +3 -3
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +8 -4
- package/dist/components/LunarCalendar/LunarCalendar.d.ts +43 -14
- package/dist/components/LunarCalendar/types.d.ts +35 -0
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +11 -12
- package/dist/components/MonthPicker/MonthPicker.d.ts +72 -1860
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +21 -1846
- package/dist/components/MonthPicker/MonthPickerText/useTextField.d.ts +5 -0
- package/dist/components/MonthPicker/locales.d.ts +1 -0
- package/dist/components/MonthPicker/types.d.ts +11 -0
- package/dist/components/MonthPicker/useMonthPickerValidation.d.ts +37 -24
- package/dist/components/NirField/NirField.d.ts +96 -325
- package/dist/components/NirField/useNirValidation.d.ts +17 -25
- package/dist/components/PageContainer/PageContainer.d.ts +8 -0
- package/dist/components/PasswordField/PasswordField.d.ts +18 -37
- package/dist/components/PasswordField/locales.d.ts +2 -0
- package/dist/components/PasswordField/types.d.ts +16 -0
- package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +38 -0
- package/dist/components/PeriodField/PeriodField.d.ts +349 -1253
- package/dist/components/PhoneField/PhoneField.d.ts +960 -2051
- package/dist/components/PhoneField/indicatifs.d.ts +715 -8
- package/dist/components/PhoneField/locales.d.ts +7 -0
- package/dist/components/PhoneField/types.d.ts +29 -0
- package/dist/components/PhoneField/usePhoneFieldValidation.d.ts +45 -0
- package/dist/components/PhoneField/usePhoneIndicatifs.d.ts +947 -0
- package/dist/components/SearchListField/SearchListField.d.ts +3 -3
- package/dist/components/SyTextArea/SyTextArea.d.ts +14 -11
- package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +7 -7
- package/dist/components/Tables/common/SyTablePagination.d.ts +19 -20
- package/dist/composables/unifyValidation/documentationValidationProps.d.ts +2 -2
- package/dist/composables/unifyValidation/useValidation.d.ts +4 -13
- package/dist/composables/useFilterable/useFilterable.d.ts +1 -2
- package/dist/design-system-v3.js +19 -19
- package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +11 -10
- package/dist/designTokens/tokens/baseTokens.d.ts +18 -18
- package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +10 -10
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +11 -10
- package/dist/designTokens/tokens/semanticTokens.d.ts +14 -14
- package/dist/{main-CI6Q9nmO.js → main-C4wAktOs.js} +14999 -14025
- package/dist/synapse.css +1 -1
- package/dist/vuetifyConfig.js +27 -25
- package/package.json +12 -11
- package/src/assets/compat/_legacy-tokens.scss +91 -0
- package/src/assets/overrides/_utilities.scss +23 -0
- package/src/components/Accordion/Accordion.stories.ts +121 -1
- package/src/components/Accordion/tests/Accordion.visual.cy.ts +44 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-default.snap.png +0 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-disabled-item.snap.png +0 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-open-first.snap.png +0 -0
- package/src/components/BackBtn/BackBtn.mdx +1 -1
- package/src/components/BackBtn/tests/__snapshots__/back-btn-custom-bg.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-dark-mode.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-default.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-no-icon.snap.png +0 -0
- package/src/components/BackToTopBtn/BackToTopBtn.mdx +0 -1
- package/src/components/BackToTopBtn/tests/BackToTopBtn.visual.cy.ts +34 -0
- package/src/components/BackToTopBtn/tests/__snapshots__/back-to-top-btn-custom-nudge.snap.png +0 -0
- package/src/components/BackToTopBtn/tests/__snapshots__/back-to-top-btn-default.snap.png +0 -0
- package/src/components/Captcha/Captcha.stories.ts +134 -31
- package/src/components/Captcha/Captcha.vue +95 -28
- package/src/components/Captcha/CaptchaForm.vue +51 -22
- package/src/components/Captcha/tests/Captcha.focus.spec.ts +214 -0
- package/src/components/Captcha/tests/Captcha.spec.ts +233 -24
- package/src/components/Captcha/tests/Captcha.visual.cy.ts +45 -0
- package/src/components/Captcha/tests/CaptchaForm.spec.ts +82 -0
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +20 -42
- package/src/components/Captcha/tests/__snapshots__/captcha-audio-type.snap.png +0 -0
- package/src/components/Captcha/tests/__snapshots__/captcha-image-type.snap.png +0 -0
- package/src/components/Captcha/tests/__snapshots__/captcha-no-helpdesk.snap.png +0 -0
- package/src/components/Captcha/types.ts +15 -0
- package/src/components/Captcha/useCaptchaValidation.ts +87 -0
- package/src/components/Captcha/validation/validation.stories.ts +1194 -0
- package/src/components/ChipList/ChipList.mdx +0 -1
- package/src/components/ChipList/tests/ChipList.visual.cy.ts +46 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-default.snap.png +0 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-readonly.snap.png +0 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-state-icons.snap.png +0 -0
- package/src/components/CollapsibleList/CollapsibleList.mdx +0 -1
- package/src/components/CollapsibleList/tests/CollapsibleList.visual.cy.ts +33 -0
- package/src/components/CollapsibleList/tests/__snapshots__/collapsible-list-default.snap.png +0 -0
- package/src/components/CollapsibleList/tests/__snapshots__/collapsible-list-no-title.snap.png +0 -0
- package/src/components/ContextualMenu/tests/ContextualMenu.visual.cy.ts +35 -0
- package/src/components/ContextualMenu/tests/__snapshots__/contextual-menu-default.snap.png +0 -0
- package/src/components/ContextualMenu/tests/__snapshots__/contextual-menu-selected.snap.png +0 -0
- package/src/components/CookieBanner/CookieBanner.mdx +0 -1
- package/src/components/CookieBanner/tests/CookieBanner.visual.cy.ts +29 -0
- package/src/components/CookieBanner/tests/__snapshots__/cookie-banner-default.snap.png +0 -0
- package/src/components/CookieBanner/tests/__snapshots__/cookie-banner-with-items.snap.png +0 -0
- package/src/components/CookiesSelection/tests/CookiesSelection.visual.cy.ts +21 -0
- package/src/components/CookiesSelection/tests/__snapshots__/cookies-selection-default.snap.png +0 -0
- package/src/components/CopyBtn/CopyBtn.mdx +0 -1
- package/src/components/CopyBtn/tests/CopyBtn.visual.cy.ts +24 -0
- package/src/components/CopyBtn/tests/__snapshots__/copy-btn-default.snap.png +0 -0
- package/src/components/CopyBtn/tests/__snapshots__/copy-btn-no-tooltip.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +123 -439
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +147 -41
- package/src/components/Customs/Selects/SelectBtnField/Validation/Validation.stories.ts +600 -0
- package/src/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.ts +87 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +402 -33
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.visual.cy.ts +60 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +52 -38
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-default.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-inline.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-readonly.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-selected.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +1 -1
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +2 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.visual.cy.ts +63 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-default.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-loading.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-multiple.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/validation/Validation.stories.ts +0 -93
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.visual.cy.ts +48 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-default.snap.png +0 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-required.snap.png +0 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/SySelect.vue +22 -47
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +3 -3
- package/src/components/Customs/Selects/SySelect/tests/SySelect.visual.cy.ts +77 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-clearable.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-default.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-multiple-chips.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-required.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/validation/Validation.stories.ts +1 -92
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +342 -162
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +77 -129
- package/src/components/Customs/SyCheckBoxGroup/Validation/Validation.stories.ts +1008 -0
- package/src/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.ts +107 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.spec.ts +180 -7
- package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.visual.cy.ts +55 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-default.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-disabled.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-selected.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-with-label.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/types.ts +49 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +41 -161
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +71 -156
- package/src/components/Customs/SyCheckbox/Validation/Validation.stories.ts +654 -0
- package/src/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.ts +105 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +106 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.visual.cy.ts +61 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-checked.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-disabled.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-indeterminate.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-required.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-unchecked.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/useSyCheckboxValidation.spec.ts +98 -0
- package/src/components/Customs/SyCheckbox/types.ts +51 -0
- package/src/components/Customs/SyIcon/SyIcon.vue +19 -1
- package/src/components/Customs/SyIcon/tests/SyIcon.visual.cy.ts +83 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-color-error.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-decorative.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-informative.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-role-button.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-size-large.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/SyIconButton.visual.cy.ts +55 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-default.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-disabled.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-error.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-large.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/SyPagination.visual.cy.ts +40 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-first-page.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-middle-page.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-with-label.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.stories.ts +0 -1
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +4 -3
- package/src/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.ts +1 -1
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-asterisk.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-comfortable.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-compact.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-default.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-disabled.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-error.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-no-details.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-readonly.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-selected.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-success.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-warning.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/validation/Validation.stories.ts +63 -27
- package/src/components/Customs/SyTabs/tests/SyTabs.visual.cy.ts +30 -0
- package/src/components/Customs/SyTabs/tests/__snapshots__/sy-tabs-default.snap.png +0 -0
- package/src/components/Customs/SyTabs/tests/__snapshots__/sy-tabs-second-active.snap.png +0 -0
- package/src/components/Customs/SyTextField/FieldState.vue +50 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +160 -778
- package/src/components/Customs/SyTextField/SyTextField.vue +178 -160
- package/src/components/Customs/SyTextField/Validation/Validation.stories.ts +1164 -0
- package/src/components/Customs/SyTextField/locales.ts +12 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +174 -8
- package/src/components/Customs/SyTextField/tests/SyTextField.visual.cy.ts +116 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-clearable.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-default.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number-disabled.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number-no-spinner.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-prepend-icon.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-readonly.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-required.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-with-value.snap.png +0 -0
- package/src/components/Customs/SyTextField/types.ts +70 -0
- package/src/components/Customs/SyTextField/useNumberField.ts +93 -0
- package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +95 -0
- package/src/components/DataList/DataList.mdx +0 -1
- package/src/components/DataList/tests/DataList.visual.cy.ts +85 -0
- package/src/components/DataList/tests/__snapshots__/data-list-default.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-loading.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-row.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-with-icons.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-with-title.snap.png +0 -0
- package/src/components/DataListGroup/DataListGroup.mdx +0 -1
- package/src/components/DataListGroup/tests/DataListGroup.visual.cy.ts +51 -0
- package/src/components/DataListGroup/tests/__snapshots__/data-list-group-default.snap.png +0 -0
- package/src/components/DataListGroup/tests/__snapshots__/data-list-group-loading.snap.png +0 -0
- package/src/components/DataListItem/tests/DataListItem.visual.cy.ts +53 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-chip.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-default.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-placeholder.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-row.snap.png +0 -0
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +1 -1
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +7 -7
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1 -1
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +7 -8
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +1 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +2 -2
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +1 -1
- package/src/components/DatePicker/composables/tests/useTodayButton.spec.ts +10 -10
- package/src/components/DatePicker/composables/useCalendarKeyboardNavigation.ts +11 -2
- package/src/components/DeclarationAccessibilityPage/tests/DeclarationAccessibilityPage.visual.cy.ts +35 -0
- package/src/components/DeclarationAccessibilityPage/tests/__snapshots__/declaration-a11y-page-default.snap.png +0 -0
- package/src/components/DeclarationAccessibilityPage/tests/__snapshots__/declaration-a11y-page-full.snap.png +0 -0
- package/src/components/DiacriticPicker/DiacriticPicker.mdx +0 -1
- package/src/components/DiacriticPicker/tests/DiacriticPicker.visual.cy.ts +24 -0
- package/src/components/DiacriticPicker/tests/__snapshots__/diacritic-picker-custom-title.snap.png +0 -0
- package/src/components/DiacriticPicker/tests/__snapshots__/diacritic-picker-default.snap.png +0 -0
- package/src/components/DialogBox/DialogBox.mdx +0 -1
- package/src/components/DialogBox/DialogBox.stories.ts +399 -4
- package/src/components/DialogBox/DialogBox.vue +20 -0
- package/src/components/DialogBox/locales.ts +1 -0
- package/src/components/DialogBox/tests/DialogBox.spec.ts +73 -0
- package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +24 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-custom-texts.snap.png +0 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-default.snap.png +0 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-no-actions.snap.png +0 -0
- package/src/components/DownloadBtn/tests/DownloadBtn.spec.ts +2 -2
- package/src/components/DownloadBtn/tests/DownloadBtn.visual.cy.ts +38 -0
- package/src/components/DownloadBtn/tests/__snapshots__/download-btn-dark.snap.png +0 -0
- package/src/components/DownloadBtn/tests/__snapshots__/download-btn-idle.snap.png +0 -0
- package/src/components/ErrorPage/ErrorPage.mdx +1 -1
- package/src/components/ErrorPage/tests/ErrorPage.visual.cy.ts +32 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-custom.snap.png +0 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-default.snap.png +0 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-no-btn.snap.png +0 -0
- package/src/components/ExternalLinks/ExternalLinks.mdx +0 -1
- package/src/components/ExternalLinks/tests/ExternalLinks.visual.cy.ts +30 -0
- package/src/components/ExternalLinks/tests/__snapshots__/external-links-default.snap.png +0 -0
- package/src/components/ExternalLinks/tests/__snapshots__/external-links-fixed.snap.png +0 -0
- package/src/components/FileList/FileList.mdx +0 -1
- package/src/components/FileList/tests/FileList.visual.cy.ts +31 -0
- package/src/components/FileList/tests/__snapshots__/file-list-default.snap.png +0 -0
- package/src/components/FileList/tests/__snapshots__/file-list-with-delete.snap.png +0 -0
- package/src/components/FilePreview/accessibilite/Accessibility.mdx +86 -8
- package/src/components/FileUpload/tests/FileUpload.visual.cy.ts +36 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-default.snap.png +0 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-disabled.snap.png +0 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-multiple.snap.png +0 -0
- package/src/components/FilterInline/FilterInline.mdx +0 -1
- package/src/components/FilterInline/FilterInline.stories.ts +2 -0
- package/src/components/FilterInline/FilterInline.vue +10 -5
- package/src/components/FilterInline/tests/FilterInline.visual.cy.ts +25 -0
- package/src/components/FilterInline/tests/__snapshots__/filter-inline-default.snap.png +0 -0
- package/src/components/FilterSideBar/FilterSideBar.mdx +8 -1
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +136 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +30 -8
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +55 -0
- package/src/components/FilterSideBar/tests/FilterSideBar.visual.cy.ts +37 -0
- package/src/components/FilterSideBar/tests/__snapshots__/filter-sidebar-default.snap.png +0 -0
- package/src/components/FilterSideBar/tests/__snapshots__/filter-sidebar-modale.snap.png +0 -0
- package/src/components/FooterBar/FooterBar.mdx +0 -1
- package/src/components/FooterBar/tests/FooterBar.visual.cy.ts +37 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-default.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-no-logo.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-no-social.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-version.snap.png +0 -0
- package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +0 -1
- package/src/components/FranceConnectBtn/tests/FranceConnectBtn.visual.cy.ts +38 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-dark.snap.png +0 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-default.snap.png +0 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-plus.snap.png +0 -0
- package/src/components/HeaderBar/HeaderBar.mdx +0 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +4 -4
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated-submenu-open.snap.png +0 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-custom-width.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-default.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-no-sticky.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-prepend.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-side.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-subtitle.snap.png +0 -0
- package/src/components/HeaderLoading/HeaderLoading.mdx +0 -1
- package/src/components/HeaderLoading/tests/HeaderLoading.visual.cy.ts +34 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-custom-size.snap.png +0 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-default.snap.png +0 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-standalone.snap.png +0 -0
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +4 -4
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.visual.cy.ts +34 -0
- package/src/components/HeaderNavigationBar/tests/__snapshots__/header-navigation-bar-default.snap.png +0 -0
- package/src/components/HeaderNavigationBar/tests/__snapshots__/header-navigation-bar-subtitle.snap.png +0 -0
- package/src/components/HeaderToolbar/tests/HeaderToolbar.visual.cy.ts +25 -0
- package/src/components/HeaderToolbar/tests/__snapshots__/header-toolbar-custom.snap.png +0 -0
- package/src/components/HeaderToolbar/tests/__snapshots__/header-toolbar-default.snap.png +0 -0
- package/src/components/LangBtn/LangBtn.mdx +0 -1
- package/src/components/LangBtn/tests/LangBtn.visual.cy.ts +33 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-default.snap.png +0 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-english.snap.png +0 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-no-arrow.snap.png +0 -0
- package/src/components/Logo/Logo.mdx +1 -1
- package/src/components/Logo/tests/__snapshots__/logo-avatar.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-dark.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-default.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-no-organism.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-no-signature.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-risque-pro.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/LogoBrandSection.visual.cy.ts +43 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-default.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-mobile.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-reduced.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-with-title.snap.png +0 -0
- package/src/components/LunarCalendar/LunarCalendar.mdx +6 -9
- package/src/components/LunarCalendar/LunarCalendar.stories.ts +243 -46
- package/src/components/LunarCalendar/LunarCalendar.vue +61 -26
- package/src/components/LunarCalendar/Validation/Validation.stories.ts +717 -0
- package/src/components/LunarCalendar/tests/LunarCalendar.a11y.spec.ts +1 -1
- package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +197 -6
- package/src/components/LunarCalendar/tests/LunarCalendar.visual.cy.ts +36 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-default.snap.png +0 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-required.snap.png +0 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-with-value.snap.png +0 -0
- package/src/components/LunarCalendar/tests/useLunarCalendarValidation.spec.ts +287 -0
- package/src/components/LunarCalendar/types.ts +39 -0
- package/src/components/LunarCalendar/useLunarCalendarValidation.ts +115 -39
- package/src/components/MaintenancePage/tests/MaintenancePage.visual.cy.ts +22 -0
- package/src/components/MaintenancePage/tests/__snapshots__/maintenance-page-custom.snap.png +0 -0
- package/src/components/MaintenancePage/tests/__snapshots__/maintenance-page-default.snap.png +0 -0
- package/src/components/MonthPicker/MonthPicker.stories.ts +38 -281
- package/src/components/MonthPicker/MonthPicker.vue +66 -17
- package/src/components/MonthPicker/MonthPickerText/MonthPickerInput.vue +44 -20
- package/src/components/MonthPicker/MonthPickerText/useTextField.ts +5 -0
- package/src/components/MonthPicker/Validation/Validation.stories.ts +1117 -0
- package/src/components/MonthPicker/locales.ts +1 -0
- package/src/components/MonthPicker/tests/MonthPicker.spec.ts +353 -2
- package/src/components/MonthPicker/tests/MonthPicker.visual.cy.ts +37 -0
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +14 -8
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-default.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-disabled.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-readonly.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-with-value.snap.png +0 -0
- package/src/components/MonthPicker/types.ts +16 -0
- package/src/components/MonthPicker/useMonthPickerValidation.ts +64 -27
- package/src/components/NirField/NirField.mdx +120 -66
- package/src/components/NirField/NirField.stories.ts +256 -682
- package/src/components/NirField/NirField.vue +98 -32
- package/src/components/NirField/tests/NirField.spec.ts +135 -14
- package/src/components/NirField/tests/NirField.visual.cy.ts +28 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-complex.snap.png +0 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-default.snap.png +0 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-with-key.snap.png +0 -0
- package/src/components/NirField/tests/useNirValidation.spec.ts +168 -0
- package/src/components/NirField/useNirValidation.ts +44 -19
- package/src/components/NirField/validation/Validation.stories.ts +866 -0
- package/src/components/NotFoundPage/tests/NotFoundPage.visual.cy.ts +28 -0
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +263 -245
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-custom-btn.snap.png +0 -0
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-default.snap.png +0 -0
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-no-btn.snap.png +0 -0
- package/src/components/NotificationBar/NotificationBar.mdx +0 -1
- package/src/components/NotificationBar/tests/NotificationBar.visual.cy.ts +54 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-bottom.snap.png +0 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-info.snap.png +0 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-multiple.snap.png +0 -0
- package/src/components/PageContainer/PageContainer.mdx +0 -1
- package/src/components/PageContainer/PageContainer.stories.ts +170 -2
- package/src/components/PageContainer/PageContainer.vue +63 -8
- package/src/components/PageContainer/tests/PageContainer.visual.cy.ts +33 -0
- package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +19 -11
- package/src/components/PageContainer/tests/__snapshots__/page-container-color.snap.png +0 -0
- package/src/components/PageContainer/tests/__snapshots__/page-container-default.snap.png +0 -0
- package/src/components/PageContainer/tests/__snapshots__/page-container-md.snap.png +0 -0
- package/src/components/PaginatedTable/PaginatedTable.mdx +0 -1
- package/src/components/PaginatedTable/accessibilite/Accessibility.mdx +99 -7
- package/src/components/PaginatedTable/tests/PaginatedTable.visual.cy.ts +41 -0
- package/src/components/PaginatedTable/tests/__snapshots__/paginated-table-default.snap.png +0 -0
- package/src/components/PaginatedTable/tests/__snapshots__/paginated-table-server.snap.png +0 -0
- package/src/components/PasswordField/PasswordField.mdx +5 -52
- package/src/components/PasswordField/PasswordField.stories.ts +74 -931
- package/src/components/PasswordField/PasswordField.vue +120 -191
- package/src/components/PasswordField/Validation/Validation.stories.ts +1295 -0
- package/src/components/PasswordField/locales.ts +2 -0
- package/src/components/PasswordField/tests/PasswordField.spec.ts +144 -106
- package/src/components/PasswordField/tests/PasswordField.visual.cy.ts +49 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-default.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-disabled.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-required.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-underlined.snap.png +0 -0
- package/src/components/PasswordField/types.ts +17 -0
- package/src/components/PasswordField/usePasswordFieldValidation.ts +100 -0
- package/src/components/PeriodField/PeriodField.mdx +0 -1
- package/src/components/PeriodField/PeriodField.stories.ts +3 -1
- package/src/components/PeriodField/PeriodField.vue +1 -1
- package/src/components/PeriodField/tests/PeriodField.visual.cy.ts +39 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-default.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-no-calendar.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-required.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-with-value.snap.png +0 -0
- package/src/components/PhoneField/PhoneField.mdx +2 -3
- package/src/components/PhoneField/PhoneField.stories.ts +227 -410
- package/src/components/PhoneField/PhoneField.vue +205 -439
- package/src/components/PhoneField/indicatifs.ts +1 -1
- package/src/components/PhoneField/locales.ts +7 -0
- package/src/components/PhoneField/tests/PhoneField.a11y.spec.ts +0 -1
- package/src/components/PhoneField/tests/PhoneField.spec.ts +518 -220
- package/src/components/PhoneField/tests/PhoneField.visual.cy.ts +28 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-default.snap.png +0 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-with-country-code.snap.png +0 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-with-value.snap.png +0 -0
- package/src/components/PhoneField/types.ts +30 -0
- package/src/components/PhoneField/usePhoneFieldValidation.ts +119 -0
- package/src/components/PhoneField/usePhoneIndicatifs.ts +89 -0
- package/src/components/PhoneField/validation/validation.stories.ts +717 -0
- package/src/components/RangeField/RangeField.mdx +0 -1
- package/src/components/RangeField/tests/__snapshots__/range-field-custom-bg.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-custom-range.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-default.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-step.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-with-label.snap.png +0 -0
- package/src/components/RatingPicker/RatingPicker.mdx +0 -1
- package/src/components/RatingPicker/tests/RatingPicker.visual.cy.ts +52 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-emotion.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-number.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-readonly.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-stars.snap.png +0 -0
- package/src/components/SearchListField/SearchListField.mdx +1 -1
- package/src/components/SearchListField/SearchListField.stories.ts +1 -1
- package/src/components/SearchListField/SearchListField.vue +9 -4
- package/src/components/SearchListField/tests/SearchListField.spec.ts +127 -0
- package/src/components/SearchListField/tests/SearchListField.visual.cy.ts +35 -0
- package/src/components/SearchListField/tests/__snapshots__/search-list-field-default.snap.png +0 -0
- package/src/components/SearchListField/tests/__snapshots__/search-list-field-with-selection.snap.png +0 -0
- package/src/components/SkipLink/tests/SkipLink.visual.cy.ts +16 -0
- package/src/components/SkipLink/tests/__snapshots__/skip-link-focused.snap.png +0 -0
- package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +0 -1
- package/src/components/SocialMediaLinks/tests/SocialMediaLinks.visual.cy.ts +33 -0
- package/src/components/SocialMediaLinks/tests/__snapshots__/social-media-links-default.snap.png +0 -0
- package/src/components/SocialMediaLinks/tests/__snapshots__/social-media-links-no-native-heading.snap.png +0 -0
- package/src/components/StatusPage/StatusPage.vue +1 -0
- package/src/components/StatusPage/tests/StatusPage.visual.cy.ts +47 -0
- package/src/components/StatusPage/tests/__snapshots__/StatusPage.spec.ts.snap +248 -230
- package/src/components/StatusPage/tests/__snapshots__/status-page-default.snap.png +0 -0
- package/src/components/StatusPage/tests/__snapshots__/status-page-full.snap.png +0 -0
- package/src/components/StatusPage/tests/__snapshots__/status-page-no-btn.snap.png +0 -0
- package/src/components/SubHeader/SubHeader.mdx +5 -6
- package/src/components/SubHeader/tests/SubHeader.visual.cy.ts +48 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-default.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-loading.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-no-back-btn.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-with-subtitle.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-closable.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-error.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-info.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-success.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-outlined.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-tonal.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-warning.snap.png +0 -0
- package/src/components/SyHeading/tests/SyHeading.visual.cy.ts +33 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-1.snap.png +0 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-2.snap.png +0 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-3.snap.png +0 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +25 -0
- package/src/components/SyTextArea/SyTextArea.vue +7 -0
- package/src/components/SyTextArea/composables/useSyTextAreaValidation.ts +1 -1
- package/src/components/SyTextArea/tests/SyTextArea.a11y.spec.ts +18 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +135 -1
- package/src/components/SyTextArea/tests/SyTextArea.visual.cy.ts +48 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-default.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-filled.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-required.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-with-value.snap.png +0 -0
- package/src/components/SyTextArea/validation/Validation.stories.ts +6 -86
- package/src/components/TableToolbar/tests/TableToolbar.visual.cy.ts +49 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-default.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-filtered.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-loading.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-with-add-btn.snap.png +0 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +3 -3
- package/src/components/Tables/SyServerTable/accessibilite/Accessibility.mdx +114 -7
- package/src/components/Tables/SyServerTable/tests/SyServerTable.visual.cy.ts +58 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-default.snap.png +0 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-loading.snap.png +0 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-with-select.snap.png +0 -0
- package/src/components/Tables/SyTable/accessibilite/Accessibility.mdx +116 -7
- package/src/components/Tables/SyTable/tests/SyTable.visual.cy.ts +70 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-compact.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-default.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-striped.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-with-select.snap.png +0 -0
- package/src/components/Tables/common/tableStyles.scss +4 -4
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +19 -13
- package/src/components/Tables/common/tests/filterByRange.spec.ts +23 -22
- package/src/components/ToolbarContainer/tests/ToolbarContainer.visual.cy.ts +34 -0
- package/src/components/ToolbarContainer/tests/__snapshots__/toolbar-container-default.snap.png +0 -0
- package/src/components/ToolbarContainer/tests/__snapshots__/toolbar-container-links.snap.png +0 -0
- package/src/components/UploadWorkflow/UploadWorkflow.mdx +0 -1
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +1 -2
- package/src/components/UploadWorkflow/tests/UploadWorkflow.visual.cy.ts +39 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/upload-workflow-default.snap.png +0 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/upload-workflow-with-title.snap.png +0 -0
- package/src/components/UserMenuBtn/UserMenuBtn.mdx +0 -1
- package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +177 -0
- package/src/components/UserMenuBtn/tests/UserMenuBtn.visual.cy.ts +42 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-default.snap.png +0 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-no-logout.snap.png +0 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-with-name.snap.png +0 -0
- package/src/composables/unifyValidation/documentationValidationProps.ts +2 -2
- package/src/composables/unifyValidation/tests/documentationValidationProps.spec.ts +2 -2
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +13 -1
- package/src/composables/unifyValidation/useValidation.ts +41 -31
- package/src/composables/useFilterable/useFilterable.spec.ts +105 -142
- package/src/composables/useFilterable/useFilterable.ts +6 -17
- package/src/composables/useFormFieldErrorHandling.ts +1 -1
- package/src/composables/validation/tests/useFormValidation.spec.ts +11 -2
- package/src/composables/validation/tests/useValidatable.spec.ts +16 -6
- package/src/composables/validation/tests/useValidation.spec.ts +2 -2
- package/src/composables/validation/useValidation.ts +1 -1
- package/src/composantsVuetify/VCard/VCard.mdx +12 -0
- package/src/composantsVuetify/VCard/v-card.stories.ts +283 -1
- package/src/composantsVuetify/VCarousel/VCarousel.mdx +74 -0
- package/src/composantsVuetify/VCarousel/v-carousel.stories.ts +531 -0
- package/src/composantsVuetify/VNavigationDrawer/VNavgationDrawer.mdx +53 -0
- package/src/composantsVuetify/VNavigationDrawer/v-navigation-drawer.stories.ts +310 -0
- package/src/composantsVuetify/VSlideGroup/VSlideGroup.mdx +105 -0
- package/src/composantsVuetify/VSlideGroup/v-slide-group.stories.ts +463 -0
- package/src/composantsVuetify/VStepper/VStepper.mdx +56 -0
- package/src/composantsVuetify/VStepper/v-stepper.stories.ts +563 -0
- package/src/designTokens/tokens/amelipro/apLightTheme.ts +1 -0
- package/src/designTokens/tokens/amelipro/apSemantic.ts +1 -1
- package/src/designTokens/tokens/baseColors.ts +1 -1
- package/src/designTokens/tokens/baseTokens.ts +18 -18
- package/src/designTokens/tokens/pa/paLightTheme.ts +1 -0
- package/src/stories/Accessibilite/DesignSystem/a11y-status.json +1 -1
- package/src/stories/Components/Components.stories.ts +95 -11
- package/src/stories/Demarrer/Releases.stories.ts +59 -2
- package/src/stories/DesignTokens/Arrondis.mdx +1 -1
- package/src/stories/DesignTokens/Colors.mdx +2 -0
- package/src/stories/DesignTokens/Correspondances.mdx +219 -0
- package/src/stories/DesignTokens/UtiliserLesTokens.mdx +235 -0
- package/src/stories/DesignTokens/colors.stories.ts +582 -569
- package/src/stories/EcoConception/EcoBestPracticesDoc.vue +930 -0
- package/src/stories/EcoConception/EcoBestPratices.mdx +38 -0
- package/src/stories/EcoConception/Introduction.mdx +8 -1
- package/src/stories/EcoConception/datas/bonnes_pratiques_essentielles.json +1018 -0
- package/src/stories/EcoConception/ecoconception-best-practices.stories.ts +20 -0
- package/src/stories/GuideDuDev/Amelipro.mdx +9 -1
- package/src/stories/GuideDuDev/Amelipro.stories.ts +1023 -168
- package/src/stories/GuideDuDev/PortailAgent.stories.ts +0 -1
- package/src/utils/functions/deepCopy/index.ts +2 -3
- package/dist/components/Customs/SyCheckbox/locales.d.ts +0 -3
- package/dist/components/LunarCalendar/useLunarCalendarRules.d.ts +0 -5
- package/dist/components/PhoneField/tests/types.d.ts +0 -18
- package/dist/components/SyHeading/SyHeading.a11y.test.d.ts +0 -1
- package/dist/components/SyHeading/SyHeading.test.d.ts +0 -1
- package/src/components/Customs/SyCheckbox/locales.ts +0 -3
- package/src/components/Customs/SyTextField/types.d.ts +0 -4
- package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +0 -184
- package/src/components/LunarCalendar/useLunarCalendarRules.ts +0 -96
- package/src/components/PhoneField/tests/types.d.ts +0 -19
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import { mount, VueWrapper } from '@vue/test-utils'
|
|
1
|
+
import { mount as baseMount, VueWrapper } from '@vue/test-utils'
|
|
2
2
|
import PhoneField from '../PhoneField.vue'
|
|
3
3
|
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'
|
|
4
4
|
import { indicatifs } from '../indicatifs'
|
|
5
|
+
import type { ComponentPublicInstance } from 'vue'
|
|
6
|
+
import { locales } from '../locales'
|
|
7
|
+
import SyForm from '@/components/Customs/SyForm/SyForm.vue'
|
|
8
|
+
|
|
9
|
+
interface PhoneFieldInstance extends ComponentPublicInstance {
|
|
10
|
+
phoneNumber: string
|
|
11
|
+
internalDialCode: { code: string, country: string, abbreviation: string, phoneLength: number, mask: string, displayText?: string }
|
|
12
|
+
dialCodeList: unknown[]
|
|
13
|
+
hasError: boolean
|
|
14
|
+
errors: string[]
|
|
15
|
+
validation: {
|
|
16
|
+
clearValidation: () => void
|
|
17
|
+
errors: string[]
|
|
18
|
+
warnings: string[]
|
|
19
|
+
successes: string[]
|
|
20
|
+
hasError: boolean
|
|
21
|
+
hasWarning: boolean
|
|
22
|
+
hasSuccess: boolean
|
|
23
|
+
}
|
|
24
|
+
validateOnSubmit: () => Promise<boolean>
|
|
25
|
+
phoneMask: string
|
|
26
|
+
clearValidation: () => void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type IndicatifLike = {
|
|
30
|
+
code: string
|
|
31
|
+
country: string
|
|
32
|
+
abbreviation: string
|
|
33
|
+
phoneLength: number
|
|
34
|
+
mask: string
|
|
35
|
+
displayText?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const mount = (component: unknown, options?: Record<string, unknown>) => baseMount(component as never, options as never) as unknown as VueWrapper<PhoneFieldInstance>
|
|
5
39
|
|
|
6
40
|
describe('PhoneField', () => {
|
|
7
41
|
afterEach(() => {
|
|
@@ -18,7 +52,6 @@ describe('PhoneField', () => {
|
|
|
18
52
|
const input = wrapper.find('input')
|
|
19
53
|
await input.setValue('1234567890')
|
|
20
54
|
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
21
|
-
// change est émis au blur, pas à chaque frappe
|
|
22
55
|
await input.trigger('blur')
|
|
23
56
|
expect(wrapper.emitted('change')).toBeTruthy()
|
|
24
57
|
})
|
|
@@ -28,7 +61,7 @@ describe('PhoneField', () => {
|
|
|
28
61
|
props: {
|
|
29
62
|
required: true,
|
|
30
63
|
modelValue: '01 23 45 67 89',
|
|
31
|
-
|
|
64
|
+
isValidateOnBlur: true,
|
|
32
65
|
},
|
|
33
66
|
})
|
|
34
67
|
|
|
@@ -42,11 +75,13 @@ describe('PhoneField', () => {
|
|
|
42
75
|
props: {
|
|
43
76
|
required: true,
|
|
44
77
|
modelValue: '',
|
|
45
|
-
|
|
78
|
+
isValidateOnBlur: true,
|
|
79
|
+
showSuccessMessages: true,
|
|
46
80
|
},
|
|
47
81
|
})
|
|
48
82
|
|
|
49
83
|
const input = wrapper.find('input')
|
|
84
|
+
await input.trigger('focus')
|
|
50
85
|
await input.setValue('123456')
|
|
51
86
|
await input.trigger('blur')
|
|
52
87
|
|
|
@@ -59,7 +94,8 @@ describe('PhoneField', () => {
|
|
|
59
94
|
const wrapper = mount(PhoneField, {
|
|
60
95
|
props: {
|
|
61
96
|
withCountryCode: true,
|
|
62
|
-
|
|
97
|
+
isValidateOnBlur: false,
|
|
98
|
+
showSuccessMessages: true,
|
|
63
99
|
modelValue: '',
|
|
64
100
|
},
|
|
65
101
|
})
|
|
@@ -90,8 +126,7 @@ describe('PhoneField', () => {
|
|
|
90
126
|
},
|
|
91
127
|
})
|
|
92
128
|
|
|
93
|
-
wrapper.
|
|
94
|
-
await wrapper.vm.$nextTick()
|
|
129
|
+
await wrapper.setProps({ dialCodeModel: '+27' })
|
|
95
130
|
|
|
96
131
|
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
97
132
|
const input = textField.find('input')
|
|
@@ -111,8 +146,7 @@ describe('PhoneField', () => {
|
|
|
111
146
|
},
|
|
112
147
|
})
|
|
113
148
|
|
|
114
|
-
wrapper.
|
|
115
|
-
await wrapper.vm.$nextTick()
|
|
149
|
+
await wrapper.setProps({ dialCodeModel: '+27' })
|
|
116
150
|
|
|
117
151
|
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
118
152
|
expect(textField.props('counter')).toBe(9)
|
|
@@ -122,7 +156,8 @@ describe('PhoneField', () => {
|
|
|
122
156
|
const wrapper = mount(PhoneField, {
|
|
123
157
|
props: { modelValue: '0619123456' },
|
|
124
158
|
})
|
|
125
|
-
|
|
159
|
+
await wrapper.vm.$nextTick()
|
|
160
|
+
expect(wrapper.find('input').element.value).toBe('06 19 12 34 56')
|
|
126
161
|
})
|
|
127
162
|
|
|
128
163
|
it('renders SySelect when withCountryCode is true', () => {
|
|
@@ -132,61 +167,18 @@ describe('PhoneField', () => {
|
|
|
132
167
|
expect(wrapper.findComponent({ name: 'SySelect' }).exists()).toBe(true)
|
|
133
168
|
})
|
|
134
169
|
|
|
135
|
-
it('validates country code when countryCodeRequired is true', async () => {
|
|
136
|
-
const wrapper = mount(PhoneField, {
|
|
137
|
-
props: {
|
|
138
|
-
withCountryCode: true,
|
|
139
|
-
countryCodeRequired: true,
|
|
140
|
-
modelValue: '0123456789',
|
|
141
|
-
},
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
// Vider le code pays manuellement (France est sélectionnée par défaut)
|
|
145
|
-
wrapper.vm.dialCode = ''
|
|
146
|
-
await wrapper.vm.$nextTick()
|
|
147
|
-
|
|
148
|
-
const result = await wrapper.vm.validateOnSubmit()
|
|
149
|
-
|
|
150
|
-
expect(result).toBe(false)
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Nécessaire pour accéder à errors
|
|
152
|
-
expect((wrapper.vm as any).errors.length).toBeGreaterThan(0)
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Nécessaire pour accéder à errors
|
|
154
|
-
expect((wrapper.vm as any).errors[0]).toContain('est requis')
|
|
155
|
-
})
|
|
156
|
-
|
|
157
170
|
it('updates phone mask and counter when dialCode changes', async () => {
|
|
158
171
|
const wrapper = mount(PhoneField, {
|
|
159
172
|
props: { withCountryCode: true },
|
|
160
173
|
})
|
|
161
|
-
wrapper.
|
|
162
|
-
await wrapper.vm.$nextTick()
|
|
174
|
+
await wrapper.setProps({ dialCodeModel: '+1' })
|
|
163
175
|
// dialCode is normalized against the canonical indicatifs list by code
|
|
164
176
|
expect(wrapper.vm.phoneMask).toBe('### ### ####')
|
|
165
|
-
expect(wrapper.
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
it('validates phone number with country code on blur', async () => {
|
|
169
|
-
const wrapper = mount(PhoneField, {
|
|
170
|
-
props: {
|
|
171
|
-
required: true,
|
|
172
|
-
countryCodeRequired: true,
|
|
173
|
-
modelValue: '1234567890',
|
|
174
|
-
withCountryCode: true,
|
|
175
|
-
isValidatedOnBlur: true,
|
|
176
|
-
},
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
wrapper.vm.dialCode = { code: '+1', phoneLength: 10, mask: '###-###-####' }
|
|
180
|
-
await wrapper.vm.$nextTick()
|
|
181
|
-
|
|
182
|
-
const input = wrapper.find('input')
|
|
183
|
-
await input.trigger('blur')
|
|
184
|
-
|
|
185
|
-
expect(wrapper.vm.hasError).toBe(false)
|
|
177
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(10)
|
|
186
178
|
})
|
|
187
179
|
|
|
188
|
-
it('uses only custom indicatifs when useCustomIndicatifsOnly is true', () => {
|
|
189
|
-
const customIndicatifs = [{ code: '+99', abbreviation: 'XX', country: 'Testland', phoneLength: 10 }]
|
|
180
|
+
it('uses only custom indicatifs when useCustomIndicatifsOnly is true', async () => {
|
|
181
|
+
const customIndicatifs = [{ code: '+99', abbreviation: 'XX', country: 'Testland', phoneLength: 10, displayText: '+99' }]
|
|
190
182
|
const wrapper = mount(PhoneField, {
|
|
191
183
|
props: {
|
|
192
184
|
useCustomIndicatifsOnly: true,
|
|
@@ -194,27 +186,7 @@ describe('PhoneField', () => {
|
|
|
194
186
|
},
|
|
195
187
|
})
|
|
196
188
|
|
|
197
|
-
expect(wrapper.vm.
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
it('validates phone number with valid country code on blur', async () => {
|
|
201
|
-
const wrapper = mount(PhoneField, {
|
|
202
|
-
props: {
|
|
203
|
-
required: true,
|
|
204
|
-
countryCodeRequired: true,
|
|
205
|
-
modelValue: '1234567890',
|
|
206
|
-
withCountryCode: true,
|
|
207
|
-
isValidatedOnBlur: true,
|
|
208
|
-
},
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
wrapper.vm.dialCode = { code: '+1', phoneLength: 10, mask: '###-###-####' }
|
|
212
|
-
await wrapper.vm.$nextTick()
|
|
213
|
-
|
|
214
|
-
const input = wrapper.find('input')
|
|
215
|
-
await input.trigger('blur')
|
|
216
|
-
|
|
217
|
-
expect(wrapper.vm.hasError).toBe(false)
|
|
189
|
+
expect(wrapper.vm.dialCodeList).toEqual(customIndicatifs.map(ind => expect.objectContaining(ind)))
|
|
218
190
|
})
|
|
219
191
|
|
|
220
192
|
it('renders VTextField with outlined variant when outlined prop is true', () => {
|
|
@@ -251,8 +223,9 @@ describe('PhoneField', () => {
|
|
|
251
223
|
|
|
252
224
|
await wrapper.vm.$nextTick()
|
|
253
225
|
|
|
254
|
-
|
|
255
|
-
expect(
|
|
226
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
227
|
+
expect(select.exists()).toBe(true)
|
|
228
|
+
expect(typeof select.props('modelValue')).toBe('object')
|
|
256
229
|
|
|
257
230
|
type Indicatif = {
|
|
258
231
|
code: string
|
|
@@ -262,7 +235,7 @@ describe('PhoneField', () => {
|
|
|
262
235
|
mask: string
|
|
263
236
|
displayText?: string
|
|
264
237
|
}
|
|
265
|
-
const dialCode =
|
|
238
|
+
const dialCode = select.props('modelValue') as Indicatif
|
|
266
239
|
|
|
267
240
|
expect(dialCode.code).toBe('+33')
|
|
268
241
|
expect(dialCode.country).toBe('France')
|
|
@@ -274,74 +247,37 @@ describe('PhoneField', () => {
|
|
|
274
247
|
expect(typeof dialCode.displayText).toBe('string')
|
|
275
248
|
})
|
|
276
249
|
|
|
277
|
-
it('formats phone number correctly', () => {
|
|
250
|
+
it('formats phone number correctly', async () => {
|
|
278
251
|
const wrapper = mount(PhoneField, {
|
|
279
252
|
props: {
|
|
280
253
|
modelValue: '0123456789',
|
|
281
254
|
},
|
|
282
255
|
})
|
|
283
|
-
|
|
284
|
-
|
|
256
|
+
await wrapper.vm.$nextTick()
|
|
257
|
+
const input = wrapper.find('input')
|
|
258
|
+
expect(input.element.value).toBe('01 23 45 67 89')
|
|
285
259
|
})
|
|
286
260
|
|
|
287
|
-
it('emits update:
|
|
261
|
+
it('emits update:dialCodeModel when dialCode changes', async () => {
|
|
288
262
|
const wrapper = mount(PhoneField, {
|
|
289
263
|
props: {
|
|
290
264
|
withCountryCode: true,
|
|
291
265
|
},
|
|
292
266
|
})
|
|
293
267
|
|
|
294
|
-
|
|
295
|
-
wrapper.vm.dialCode = dialCodeValue
|
|
296
|
-
await wrapper.vm.$nextTick()
|
|
268
|
+
await wrapper.setProps({ dialCodeModel: '+34' })
|
|
297
269
|
|
|
298
|
-
expect(wrapper.emitted('update:
|
|
299
|
-
const emittedEvents = wrapper.emitted('update:
|
|
270
|
+
expect(wrapper.emitted('update:dialCodeModel')).toBeTruthy()
|
|
271
|
+
const emittedEvents = wrapper.emitted('update:dialCodeModel')
|
|
300
272
|
const lastEmitted = emittedEvents && emittedEvents[emittedEvents.length - 1]?.[0]
|
|
301
|
-
expect(lastEmitted).toHaveProperty('code',
|
|
302
|
-
})
|
|
303
|
-
|
|
304
|
-
it('validates phone number on submit', async () => {
|
|
305
|
-
const wrapper = mount(PhoneField, {
|
|
306
|
-
props: {
|
|
307
|
-
required: true,
|
|
308
|
-
modelValue: '',
|
|
309
|
-
},
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
const result = await wrapper.vm.validateOnSubmit()
|
|
313
|
-
console.log('Validation result:', result)
|
|
314
|
-
|
|
315
|
-
expect(result).toBe(false)
|
|
316
|
-
expect(wrapper.vm.hasError).toBe(true)
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Nécessaire pour accéder à errors
|
|
318
|
-
expect((wrapper.vm as any).errors.length).toBeGreaterThan(0)
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
it('validates phone number successfully on submit with valid input', async () => {
|
|
322
|
-
const wrapper = mount(PhoneField, {
|
|
323
|
-
props: {
|
|
324
|
-
required: true,
|
|
325
|
-
modelValue: '0123456789',
|
|
326
|
-
},
|
|
327
|
-
})
|
|
328
|
-
|
|
329
|
-
const result = await wrapper.vm.validateOnSubmit()
|
|
330
|
-
|
|
331
|
-
expect(result).toBe(true)
|
|
332
|
-
expect(wrapper.vm.hasError).toBe(false)
|
|
273
|
+
expect(lastEmitted).toHaveProperty('code', '+34')
|
|
333
274
|
})
|
|
334
275
|
|
|
335
276
|
it('exposes necessary properties and methods', () => {
|
|
336
277
|
const wrapper = mount(PhoneField)
|
|
337
278
|
|
|
338
|
-
expect(wrapper.vm.computedValue).toBeDefined()
|
|
339
|
-
expect(wrapper.vm.dialCode).toBeDefined()
|
|
340
279
|
expect(wrapper.vm.phoneMask).toBeDefined()
|
|
341
|
-
expect(wrapper.vm.
|
|
342
|
-
expect(wrapper.vm.hasError).toBeDefined()
|
|
343
|
-
expect(wrapper.vm.phoneNumber).toBeDefined()
|
|
344
|
-
expect(wrapper.vm.mergedDialCodes).toBeDefined()
|
|
280
|
+
expect(wrapper.vm.dialCodeList).toBeDefined()
|
|
345
281
|
expect(wrapper.vm.validation).toBeDefined()
|
|
346
282
|
expect(wrapper.vm.validateOnSubmit).toBeDefined()
|
|
347
283
|
})
|
|
@@ -354,13 +290,14 @@ describe('PhoneField', () => {
|
|
|
354
290
|
},
|
|
355
291
|
})
|
|
356
292
|
|
|
357
|
-
expect(wrapper.
|
|
358
|
-
|
|
359
|
-
|
|
293
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(10)
|
|
294
|
+
await wrapper.setProps({
|
|
295
|
+
dialCodeModel: { code: '+44', abbreviation: 'UK', country: 'United Kingdom', phoneLength: 11, mask: '### ### #####' },
|
|
296
|
+
})
|
|
360
297
|
await wrapper.vm.$nextTick()
|
|
361
298
|
|
|
362
|
-
//
|
|
363
|
-
expect(wrapper.
|
|
299
|
+
// In the indicatifs list, +44 is associed with phoneLength 10
|
|
300
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(10)
|
|
364
301
|
})
|
|
365
302
|
|
|
366
303
|
it('handles disabled state correctly', async () => {
|
|
@@ -393,27 +330,62 @@ describe('PhoneField', () => {
|
|
|
393
330
|
expect(select.props('readonly')).toBe(true)
|
|
394
331
|
})
|
|
395
332
|
|
|
396
|
-
it('
|
|
333
|
+
it('forwards hideDetails prop to SyTextField', () => {
|
|
397
334
|
const wrapper = mount(PhoneField, {
|
|
398
335
|
props: {
|
|
399
|
-
|
|
400
|
-
|
|
336
|
+
hideDetails: true,
|
|
337
|
+
},
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
341
|
+
expect(textField.props('hideDetails')).toBe(true)
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
it('shows and handles clear button when isClearable is true', async () => {
|
|
345
|
+
const wrapper = mount(PhoneField, {
|
|
346
|
+
props: {
|
|
347
|
+
isClearable: true,
|
|
348
|
+
modelValue: '0123456789',
|
|
401
349
|
},
|
|
402
350
|
})
|
|
403
351
|
|
|
404
352
|
await wrapper.vm.$nextTick()
|
|
405
353
|
|
|
406
|
-
|
|
407
|
-
expect(
|
|
354
|
+
const clearButton = wrapper.find(`button[aria-label="${locales.clearButtonAriaLabel}"]`)
|
|
355
|
+
expect(clearButton.exists()).toBe(true)
|
|
356
|
+
|
|
357
|
+
await clearButton.trigger('click')
|
|
358
|
+
await wrapper.vm.$nextTick()
|
|
359
|
+
|
|
360
|
+
expect(wrapper.vm.phoneNumber).toBe('')
|
|
361
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
362
|
+
expect(wrapper.emitted('update:modelValue')?.at(-1)?.[0]).toBe('')
|
|
408
363
|
|
|
364
|
+
await wrapper.setProps({ isClearable: false, modelValue: '0123456789' })
|
|
365
|
+
await wrapper.vm.$nextTick()
|
|
366
|
+
expect(wrapper.find(`button[aria-label="${locales.clearButtonAriaLabel}"]`).exists()).toBe(false)
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
it('verifies SyTextField and SySelect props are correctly passed', async () => {
|
|
370
|
+
const wrapper = mount(PhoneField, {
|
|
371
|
+
props: {
|
|
372
|
+
withCountryCode: true,
|
|
373
|
+
dialCodeModel: { code: '+33', abbreviation: 'FR', country: 'France', phoneLength: 10, mask: '## ## ## ## ##' },
|
|
374
|
+
},
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
const phoneInput = wrapper.find<HTMLInputElement>('input[type="tel"]')
|
|
378
|
+
await phoneInput.setValue('0123456789')
|
|
379
|
+
expect(phoneInput.element.value).toBe('01 23 45 67 89')
|
|
409
380
|
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
381
|
+
|
|
410
382
|
expect(textField.exists()).toBe(true)
|
|
411
383
|
expect(textField.props('counter')).toBe(10)
|
|
412
384
|
|
|
413
385
|
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
414
386
|
expect(select.exists()).toBe(true)
|
|
415
387
|
expect(select.props('returnObject')).toBe(true)
|
|
416
|
-
expect(select.props('modelValue')).
|
|
388
|
+
expect((select.props('modelValue') as IndicatifLike).code).toBe('+33')
|
|
417
389
|
})
|
|
418
390
|
|
|
419
391
|
it('updates dialCode when dialCodeModel changes after mount', async () => {
|
|
@@ -424,7 +396,7 @@ describe('PhoneField', () => {
|
|
|
424
396
|
})
|
|
425
397
|
|
|
426
398
|
// France est sélectionnée par défaut quand withCountryCode=true
|
|
427
|
-
expect(wrapper.
|
|
399
|
+
expect((wrapper.findComponent({ name: 'SySelect' }).props('modelValue') as IndicatifLike).code).toBe('+33')
|
|
428
400
|
|
|
429
401
|
await wrapper.setProps({
|
|
430
402
|
dialCodeModel: { code: '+1', country: 'USA', abbreviation: 'US', phoneLength: 10, mask: '###-###-####' },
|
|
@@ -432,8 +404,9 @@ describe('PhoneField', () => {
|
|
|
432
404
|
|
|
433
405
|
await wrapper.vm.$nextTick()
|
|
434
406
|
|
|
435
|
-
|
|
436
|
-
expect(
|
|
407
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
408
|
+
expect(select.exists()).toBe(true)
|
|
409
|
+
expect(typeof select.props('modelValue')).toBe('object')
|
|
437
410
|
|
|
438
411
|
type Indicatif = {
|
|
439
412
|
code: string
|
|
@@ -443,12 +416,12 @@ describe('PhoneField', () => {
|
|
|
443
416
|
mask: string
|
|
444
417
|
displayText?: string
|
|
445
418
|
}
|
|
446
|
-
const dialCode =
|
|
419
|
+
const dialCode = select.props('modelValue') as Indicatif
|
|
447
420
|
|
|
448
421
|
expect(dialCode.code).toBe('+1')
|
|
449
422
|
expect(dialCode.country).toBe('USA/Canada')
|
|
450
423
|
expect(wrapper.vm.phoneMask).toBe('### ### ####')
|
|
451
|
-
expect(wrapper.
|
|
424
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(10)
|
|
452
425
|
})
|
|
453
426
|
|
|
454
427
|
it('handles dialCodeModel objects without displayText property', async () => {
|
|
@@ -469,7 +442,8 @@ describe('PhoneField', () => {
|
|
|
469
442
|
|
|
470
443
|
await wrapper.vm.$nextTick()
|
|
471
444
|
|
|
472
|
-
|
|
445
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
446
|
+
expect(select.exists()).toBe(true)
|
|
473
447
|
|
|
474
448
|
type Indicatif = {
|
|
475
449
|
code: string
|
|
@@ -479,7 +453,7 @@ describe('PhoneField', () => {
|
|
|
479
453
|
mask: string
|
|
480
454
|
displayText?: string
|
|
481
455
|
}
|
|
482
|
-
const dialCode =
|
|
456
|
+
const dialCode = select.props('modelValue') as Indicatif
|
|
483
457
|
|
|
484
458
|
expect(dialCode.code).toBe('+44')
|
|
485
459
|
expect(dialCode.country).toBe('United Kingdom')
|
|
@@ -558,7 +532,7 @@ describe('PhoneField', () => {
|
|
|
558
532
|
expect(phoneInput.attributes('autocomplete')).toBe('tel-national')
|
|
559
533
|
|
|
560
534
|
// Check that country code select has default tel-country-code autocomplete
|
|
561
|
-
const selectInput = wrapper.find('.
|
|
535
|
+
const selectInput = wrapper.find('.dial-code-select input')
|
|
562
536
|
expect(selectInput.attributes('autocomplete')).toBe('tel-country-code')
|
|
563
537
|
})
|
|
564
538
|
|
|
@@ -579,7 +553,7 @@ describe('PhoneField', () => {
|
|
|
579
553
|
expect(phoneInput.attributes('autocomplete')).toBe('tel-extension')
|
|
580
554
|
|
|
581
555
|
// Check that country code select has custom autocomplete
|
|
582
|
-
const selectInput = wrapper.find('.
|
|
556
|
+
const selectInput = wrapper.find('.dial-code-select input')
|
|
583
557
|
expect(selectInput.attributes('autocomplete')).toBe('tel-country-code')
|
|
584
558
|
})
|
|
585
559
|
|
|
@@ -602,7 +576,7 @@ describe('PhoneField', () => {
|
|
|
602
576
|
expect(telAutocomplete).toBe('tel-national')
|
|
603
577
|
|
|
604
578
|
// Verify country select input has correct autocomplete
|
|
605
|
-
const selectInput = wrapper.find('.
|
|
579
|
+
const selectInput = wrapper.find('.dial-code-select input')
|
|
606
580
|
expect(selectInput.exists()).toBe(true)
|
|
607
581
|
const selectAutocomplete = selectInput.attributes('autocomplete')
|
|
608
582
|
expect(selectAutocomplete).toBe('tel-country-code')
|
|
@@ -624,7 +598,7 @@ describe('PhoneField', () => {
|
|
|
624
598
|
expect(phoneInput.attributes('autocomplete')).toBe('tel')
|
|
625
599
|
|
|
626
600
|
// Check that country code select doesn't exist
|
|
627
|
-
const selectInput = wrapper.find('.
|
|
601
|
+
const selectInput = wrapper.find('.dial-code-select input')
|
|
628
602
|
expect(selectInput.exists()).toBe(false)
|
|
629
603
|
})
|
|
630
604
|
|
|
@@ -641,7 +615,8 @@ describe('PhoneField', () => {
|
|
|
641
615
|
|
|
642
616
|
await wrapper.vm.$nextTick()
|
|
643
617
|
|
|
644
|
-
|
|
618
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
619
|
+
expect(select.exists()).toBe(true)
|
|
645
620
|
|
|
646
621
|
type Indicatif = {
|
|
647
622
|
code: string
|
|
@@ -651,50 +626,17 @@ describe('PhoneField', () => {
|
|
|
651
626
|
mask: string
|
|
652
627
|
displayText?: string
|
|
653
628
|
}
|
|
654
|
-
const dialCode =
|
|
629
|
+
const dialCode = select.props('modelValue') as Indicatif
|
|
655
630
|
|
|
656
631
|
expect(dialCode.code).toBe('+33')
|
|
657
632
|
expect(dialCode.country).toBe('France')
|
|
658
633
|
|
|
659
|
-
|
|
660
|
-
expect(select.exists()).toBe(true)
|
|
661
|
-
expect(select.props('modelValue')).toEqual(wrapper.vm.dialCode)
|
|
662
|
-
})
|
|
663
|
-
|
|
664
|
-
it('disables error handling when readonly is true', async () => {
|
|
665
|
-
const wrapper = mount(PhoneField, {
|
|
666
|
-
props: {
|
|
667
|
-
required: true,
|
|
668
|
-
modelValue: '',
|
|
669
|
-
readonly: true,
|
|
670
|
-
},
|
|
671
|
-
})
|
|
672
|
-
|
|
673
|
-
expect(wrapper.props('readonly')).toBe(true)
|
|
674
|
-
|
|
675
|
-
const isValid = await wrapper.vm.validateOnSubmit()
|
|
676
|
-
|
|
677
|
-
expect(isValid).toBe(true)
|
|
678
|
-
|
|
679
|
-
expect(wrapper.vm.hasError).toBe(false)
|
|
680
|
-
const wrapperNotReadonly = mount(PhoneField, {
|
|
681
|
-
props: {
|
|
682
|
-
required: true,
|
|
683
|
-
modelValue: '',
|
|
684
|
-
readonly: false,
|
|
685
|
-
},
|
|
686
|
-
})
|
|
687
|
-
|
|
688
|
-
const isValidNotReadonly = await wrapperNotReadonly.vm.validateOnSubmit()
|
|
689
|
-
|
|
690
|
-
expect(isValidNotReadonly).toBe(false)
|
|
691
|
-
|
|
692
|
-
expect(wrapperNotReadonly.vm.hasError).toBe(true)
|
|
634
|
+
expect(select.props('modelValue')).toEqual(expect.objectContaining({ code: '+33' }))
|
|
693
635
|
})
|
|
694
636
|
|
|
695
637
|
// Tests pour les formats d'affichage avec abréviations encapsulées
|
|
696
638
|
describe('Display formats with abbreviations', () => {
|
|
697
|
-
let wrapper: VueWrapper<
|
|
639
|
+
let wrapper: VueWrapper<PhoneFieldInstance>
|
|
698
640
|
|
|
699
641
|
beforeEach(() => {
|
|
700
642
|
wrapper = mount(PhoneField, {
|
|
@@ -742,6 +684,72 @@ describe('PhoneField', () => {
|
|
|
742
684
|
const expectedCountry = firstItem.countryFr || firstItem.country
|
|
743
685
|
expect(firstItem.displayText).toBe(`<abbr title="${expectedCountry}">${firstItem.abbreviation}</abbr>`)
|
|
744
686
|
})
|
|
687
|
+
|
|
688
|
+
it('escapes HTML special characters in country name and abbreviation for code-abbreviation format', async () => {
|
|
689
|
+
const maliciousIndicatif = {
|
|
690
|
+
code: '+99',
|
|
691
|
+
country: 'Bad"Country<script>',
|
|
692
|
+
abbreviation: 'B&D',
|
|
693
|
+
phoneLength: 10,
|
|
694
|
+
mask: '## ## ## ##',
|
|
695
|
+
}
|
|
696
|
+
await wrapper.setProps({
|
|
697
|
+
displayFormat: 'code-abbreviation',
|
|
698
|
+
customIndicatifs: [maliciousIndicatif],
|
|
699
|
+
useCustomIndicatifsOnly: true,
|
|
700
|
+
})
|
|
701
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
702
|
+
const item = select.props('items')[0]
|
|
703
|
+
expect(item.displayText).not.toContain('<script>')
|
|
704
|
+
expect(item.displayText).not.toContain('"Country')
|
|
705
|
+
expect(item.displayText).toContain('"Country')
|
|
706
|
+
expect(item.displayText).toContain('<')
|
|
707
|
+
expect(item.displayText).toContain('&')
|
|
708
|
+
expect(item.plainDisplayText).toBe(`${maliciousIndicatif.code} (${maliciousIndicatif.abbreviation})`)
|
|
709
|
+
})
|
|
710
|
+
|
|
711
|
+
it('escapes HTML special characters in country name and abbreviation for abbreviation format', async () => {
|
|
712
|
+
const maliciousIndicatif = {
|
|
713
|
+
code: '+99',
|
|
714
|
+
country: 'Evil<img src=x onerror=alert(1)>',
|
|
715
|
+
abbreviation: '<XSS>',
|
|
716
|
+
phoneLength: 10,
|
|
717
|
+
mask: '## ## ## ##',
|
|
718
|
+
}
|
|
719
|
+
await wrapper.setProps({
|
|
720
|
+
displayFormat: 'abbreviation',
|
|
721
|
+
customIndicatifs: [maliciousIndicatif],
|
|
722
|
+
useCustomIndicatifsOnly: true,
|
|
723
|
+
})
|
|
724
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
725
|
+
const item = select.props('items')[0]
|
|
726
|
+
expect(item.displayText).not.toContain('<img')
|
|
727
|
+
expect(item.displayText).not.toContain('<XSS>')
|
|
728
|
+
expect(item.displayText).toContain('<XSS>')
|
|
729
|
+
expect(item.displayText).toContain('<img')
|
|
730
|
+
expect(item.plainDisplayText).toBe(maliciousIndicatif.abbreviation)
|
|
731
|
+
})
|
|
732
|
+
|
|
733
|
+
it('escapes HTML in country name for non-abbreviation formats (code-country, country)', async () => {
|
|
734
|
+
const maliciousIndicatif = {
|
|
735
|
+
code: '+99',
|
|
736
|
+
country: '<img src=x onerror=alert(1)>',
|
|
737
|
+
abbreviation: 'XX',
|
|
738
|
+
phoneLength: 10,
|
|
739
|
+
mask: '## ## ## ##',
|
|
740
|
+
}
|
|
741
|
+
for (const format of ['code-country', 'country'] as const) {
|
|
742
|
+
await wrapper.setProps({
|
|
743
|
+
displayFormat: format,
|
|
744
|
+
customIndicatifs: [maliciousIndicatif],
|
|
745
|
+
useCustomIndicatifsOnly: true,
|
|
746
|
+
})
|
|
747
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
748
|
+
const item = select.props('items')[0]
|
|
749
|
+
expect(item.displayText).not.toContain('<img')
|
|
750
|
+
expect(item.displayText).toContain('<img')
|
|
751
|
+
}
|
|
752
|
+
})
|
|
745
753
|
})
|
|
746
754
|
|
|
747
755
|
// Tests pour l'initialisation avec un dialCode par défaut
|
|
@@ -756,15 +764,16 @@ describe('PhoneField', () => {
|
|
|
756
764
|
})
|
|
757
765
|
|
|
758
766
|
await wrapper.vm.$nextTick()
|
|
767
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
759
768
|
|
|
760
769
|
// Vérifier que le dialCode est correctement initialisé
|
|
761
|
-
expect(
|
|
770
|
+
expect(select.exists()).toBe(true)
|
|
762
771
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
763
|
-
expect((
|
|
772
|
+
expect((select.props('modelValue') as any).code).toBe('+44')
|
|
764
773
|
// Vérifier que le masque est appliqué (le format exact peut varier)
|
|
765
774
|
expect(wrapper.vm.phoneMask).toBeDefined()
|
|
766
775
|
// Vérifier que le counter est défini selon la phoneLength
|
|
767
|
-
expect(wrapper.
|
|
776
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBeDefined()
|
|
768
777
|
})
|
|
769
778
|
|
|
770
779
|
it('initializes with a default dialCode string', async () => {
|
|
@@ -776,32 +785,162 @@ describe('PhoneField', () => {
|
|
|
776
785
|
})
|
|
777
786
|
|
|
778
787
|
await wrapper.vm.$nextTick()
|
|
788
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
779
789
|
|
|
780
790
|
// Vérifier que le dialCode est correctement initialisé
|
|
781
|
-
expect(
|
|
791
|
+
expect(select.props('modelValue')).toEqual(expect.objectContaining({ code: '+33' }))
|
|
782
792
|
})
|
|
783
793
|
})
|
|
784
794
|
|
|
785
|
-
// Tests
|
|
786
|
-
describe('
|
|
795
|
+
// Tests de validation
|
|
796
|
+
describe('Validation', () => {
|
|
797
|
+
it('cleans spaces from phone number before validation', async () => {
|
|
798
|
+
const wrapper = mount(PhoneField, {
|
|
799
|
+
props: {
|
|
800
|
+
required: true,
|
|
801
|
+
modelValue: '01 23 45 67 89',
|
|
802
|
+
},
|
|
803
|
+
})
|
|
804
|
+
|
|
805
|
+
const isValid = await wrapper.vm.validateOnSubmit()
|
|
806
|
+
expect(isValid).toBe(true)
|
|
807
|
+
expect(wrapper.vm.hasError).toBe(false)
|
|
808
|
+
})
|
|
809
|
+
|
|
810
|
+
it('validates phone number and country code on blur', async () => {
|
|
811
|
+
const wrapper = mount(PhoneField, {
|
|
812
|
+
props: {
|
|
813
|
+
required: true,
|
|
814
|
+
modelValue: '12345',
|
|
815
|
+
isValidateOnBlur: true,
|
|
816
|
+
},
|
|
817
|
+
})
|
|
818
|
+
|
|
819
|
+
const input = wrapper.find('input')
|
|
820
|
+
await input.trigger('focus')
|
|
821
|
+
await input.trigger('blur')
|
|
822
|
+
await wrapper.vm.$nextTick()
|
|
823
|
+
|
|
824
|
+
expect(wrapper.vm.hasError).toBe(true)
|
|
825
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required to access errors
|
|
826
|
+
expect((wrapper.vm as any).errors[0]).toContain(locales.errorLength(10))
|
|
827
|
+
})
|
|
828
|
+
|
|
829
|
+
it('keeps a consistent success message before and after blur when withCountryCode is true', async () => {
|
|
830
|
+
const wrapper = mount(PhoneField, {
|
|
831
|
+
props: {
|
|
832
|
+
withCountryCode: true,
|
|
833
|
+
isValidateOnBlur: false,
|
|
834
|
+
modelValue: '',
|
|
835
|
+
showSuccessMessages: true,
|
|
836
|
+
},
|
|
837
|
+
})
|
|
838
|
+
|
|
839
|
+
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
840
|
+
const input = textField.find('input')
|
|
841
|
+
await input.setValue('0123456789')
|
|
842
|
+
await wrapper.vm.$nextTick()
|
|
843
|
+
|
|
844
|
+
const messageBeforeBlur = textField.find('.v-messages__message')
|
|
845
|
+
expect(messageBeforeBlur.exists()).toBe(true)
|
|
846
|
+
expect(messageBeforeBlur.text()).toBe('Le champ Numéro de téléphone sans indicatif est valide.')
|
|
847
|
+
expect(messageBeforeBlur.text()).not.toBe('Le champ Numéro de téléphone est valide.')
|
|
848
|
+
|
|
849
|
+
await input.trigger('blur')
|
|
850
|
+
await wrapper.vm.$nextTick()
|
|
851
|
+
|
|
852
|
+
const messageAfterBlur = textField.find('.v-messages__message')
|
|
853
|
+
expect(messageAfterBlur.exists()).toBe(true)
|
|
854
|
+
expect(messageAfterBlur.text()).toBe('Le champ Numéro de téléphone sans indicatif est valide.')
|
|
855
|
+
})
|
|
856
|
+
|
|
857
|
+
it('falls back to default country code when provided code is invalid', async () => {
|
|
858
|
+
const wrapper = mount(PhoneField, {
|
|
859
|
+
props: {
|
|
860
|
+
withCountryCode: true,
|
|
861
|
+
modelValue: '0123456789',
|
|
862
|
+
dialCodeModel: '+9999',
|
|
863
|
+
},
|
|
864
|
+
})
|
|
865
|
+
|
|
866
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
867
|
+
|
|
868
|
+
expect(result).toBe(true)
|
|
869
|
+
expect((wrapper.findComponent({ name: 'SySelect' }).props('modelValue') as IndicatifLike).code).toBe('+33')
|
|
870
|
+
})
|
|
871
|
+
|
|
872
|
+
it('validates phone number on submit', async () => {
|
|
873
|
+
const wrapper = mount(PhoneField, {
|
|
874
|
+
props: {
|
|
875
|
+
required: true,
|
|
876
|
+
modelValue: '',
|
|
877
|
+
},
|
|
878
|
+
})
|
|
879
|
+
|
|
880
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
881
|
+
|
|
882
|
+
expect(result).toBe(false)
|
|
883
|
+
expect(wrapper.vm.hasError).toBe(true)
|
|
884
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required to access errors
|
|
885
|
+
expect((wrapper.vm as any).errors.length).toBeGreaterThan(0)
|
|
886
|
+
})
|
|
887
|
+
|
|
888
|
+
it('validates phone number successfully on submit with valid input', async () => {
|
|
889
|
+
const wrapper = mount(PhoneField, {
|
|
890
|
+
props: {
|
|
891
|
+
required: true,
|
|
892
|
+
modelValue: '0123456789',
|
|
893
|
+
},
|
|
894
|
+
})
|
|
895
|
+
|
|
896
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
897
|
+
|
|
898
|
+
expect(result).toBe(true)
|
|
899
|
+
expect(wrapper.vm.hasError).toBe(false)
|
|
900
|
+
})
|
|
901
|
+
|
|
902
|
+
it('disables error handling when readonly is true', async () => {
|
|
903
|
+
const wrapper = mount(PhoneField, {
|
|
904
|
+
props: {
|
|
905
|
+
required: true,
|
|
906
|
+
modelValue: '',
|
|
907
|
+
readonly: true,
|
|
908
|
+
},
|
|
909
|
+
})
|
|
910
|
+
|
|
911
|
+
const isValid = await wrapper.vm.validateOnSubmit()
|
|
912
|
+
|
|
913
|
+
expect(isValid).toBe(true)
|
|
914
|
+
expect(wrapper.vm.hasError).toBe(false)
|
|
915
|
+
|
|
916
|
+
const wrapperNotReadonly = mount(PhoneField, {
|
|
917
|
+
props: {
|
|
918
|
+
required: true,
|
|
919
|
+
modelValue: '',
|
|
920
|
+
readonly: false,
|
|
921
|
+
},
|
|
922
|
+
})
|
|
923
|
+
|
|
924
|
+
const isValidNotReadonly = await wrapperNotReadonly.vm.validateOnSubmit()
|
|
925
|
+
expect(isValidNotReadonly).toBe(false)
|
|
926
|
+
expect(wrapperNotReadonly.vm.hasError).toBe(true)
|
|
927
|
+
})
|
|
928
|
+
|
|
787
929
|
it('displays error messages by default when validation fails', async () => {
|
|
788
930
|
const wrapper = mount(PhoneField, {
|
|
789
931
|
props: {
|
|
790
932
|
required: true,
|
|
791
933
|
modelValue: '',
|
|
792
|
-
|
|
934
|
+
isValidateOnBlur: true,
|
|
793
935
|
},
|
|
794
936
|
})
|
|
795
937
|
|
|
796
|
-
// Déclencher la validation
|
|
797
938
|
await wrapper.vm.validateOnSubmit()
|
|
798
939
|
|
|
799
|
-
// Vérifier que les erreurs sont affichées
|
|
800
940
|
expect(wrapper.vm.hasError).toBe(true)
|
|
801
941
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
802
942
|
expect((wrapper.vm as any).errors.length).toBeGreaterThan(0)
|
|
803
943
|
|
|
804
|
-
// Vérifier que les erreurs sont passées au composant SyTextField
|
|
805
944
|
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
806
945
|
expect(textField.props('errorMessages')).toBeTruthy()
|
|
807
946
|
})
|
|
@@ -811,19 +950,14 @@ describe('PhoneField', () => {
|
|
|
811
950
|
props: {
|
|
812
951
|
required: true,
|
|
813
952
|
modelValue: '',
|
|
814
|
-
|
|
953
|
+
isValidateOnBlur: true,
|
|
815
954
|
disableErrorHandling: true,
|
|
816
955
|
},
|
|
817
956
|
})
|
|
818
957
|
|
|
819
|
-
// Vérifier que la propriété disableErrorHandling est bien prise en compte
|
|
820
|
-
// en vérifiant qu'elle est passée lors de l'initialisation du composable useValidation
|
|
821
958
|
expect(wrapper.vm.validation).toBeDefined()
|
|
822
959
|
})
|
|
823
|
-
})
|
|
824
960
|
|
|
825
|
-
// Tests pour la validation dans un contexte de formulaire
|
|
826
|
-
describe('Form validation', () => {
|
|
827
961
|
it('validates as part of a form submission', async () => {
|
|
828
962
|
const wrapper = mount(PhoneField, {
|
|
829
963
|
props: {
|
|
@@ -832,11 +966,9 @@ describe('PhoneField', () => {
|
|
|
832
966
|
},
|
|
833
967
|
})
|
|
834
968
|
|
|
835
|
-
// Simuler une soumission de formulaire avec un champ vide
|
|
836
969
|
const isValid = await wrapper.vm.validateOnSubmit()
|
|
837
970
|
expect(isValid).toBe(false)
|
|
838
971
|
|
|
839
|
-
// Mettre à jour la valeur et valider à nouveau
|
|
840
972
|
await wrapper.setProps({ modelValue: '0123456789' })
|
|
841
973
|
const isValidAfterUpdate = await wrapper.vm.validateOnSubmit()
|
|
842
974
|
expect(isValidAfterUpdate).toBe(true)
|
|
@@ -846,27 +978,129 @@ describe('PhoneField', () => {
|
|
|
846
978
|
const wrapper = mount(PhoneField, {
|
|
847
979
|
props: {
|
|
848
980
|
required: true,
|
|
849
|
-
modelValue: '
|
|
981
|
+
modelValue: '012',
|
|
982
|
+
dialCodeModel: { code: 'test', abbreviation: 'TEST', country: 'Test', phoneLength: 3, mask: '###' },
|
|
983
|
+
customIndicatifs: [{ code: 'test', abbreviation: 'TEST', country: 'Test', phoneLength: 3, mask: '###' }],
|
|
850
984
|
withCountryCode: true,
|
|
851
|
-
countryCodeRequired: true,
|
|
852
985
|
},
|
|
853
986
|
})
|
|
854
987
|
|
|
855
|
-
// Vider le code pays manuellement (France est sélectionnée par défaut)
|
|
856
|
-
wrapper.vm.dialCode = ''
|
|
857
988
|
await wrapper.vm.$nextTick()
|
|
858
989
|
|
|
859
|
-
// Sans code pays, la validation échoue
|
|
860
990
|
const isValidWithoutCountry = await wrapper.vm.validateOnSubmit()
|
|
861
|
-
expect(isValidWithoutCountry).toBe(
|
|
991
|
+
expect(isValidWithoutCountry).toBe(true)
|
|
862
992
|
|
|
863
|
-
// Ajouter un code pays et valider à nouveau
|
|
864
|
-
wrapper.vm.dialCode = { code: '+33', abbreviation: 'FR', country: 'France', phoneLength: 10, mask: '## ## ## ## ##' }
|
|
865
993
|
await wrapper.vm.$nextTick()
|
|
866
994
|
|
|
867
995
|
const isValidWithCountry = await wrapper.vm.validateOnSubmit()
|
|
868
996
|
expect(isValidWithCountry).toBe(true)
|
|
869
997
|
})
|
|
998
|
+
|
|
999
|
+
describe('Validation with SyForm', () => {
|
|
1000
|
+
it('validates as part of SyForm submission', async () => {
|
|
1001
|
+
const wrapper = baseMount({
|
|
1002
|
+
components: { PhoneField, SyForm },
|
|
1003
|
+
template: `
|
|
1004
|
+
<SyForm>
|
|
1005
|
+
<PhoneField with-country-code required />
|
|
1006
|
+
<button type="submit">Submit</button>
|
|
1007
|
+
</SyForm>
|
|
1008
|
+
`,
|
|
1009
|
+
})
|
|
1010
|
+
|
|
1011
|
+
const syForm = wrapper.findComponent(SyForm)
|
|
1012
|
+
const form = syForm.vm as unknown as { validate: () => Promise<boolean> }
|
|
1013
|
+
const isValidWithoutPhone = await form.validate()
|
|
1014
|
+
await wrapper.vm.$nextTick()
|
|
1015
|
+
|
|
1016
|
+
const phoneField = wrapper.find('.phone-field')
|
|
1017
|
+
expect(syForm.exists()).toBe(true)
|
|
1018
|
+
expect(isValidWithoutPhone).toBe(false)
|
|
1019
|
+
expect(phoneField.classes()).toContain('error-field')
|
|
1020
|
+
|
|
1021
|
+
const input = wrapper.find('input[type="tel"]')
|
|
1022
|
+
await input.setValue('0123456789')
|
|
1023
|
+
await wrapper.vm.$nextTick()
|
|
1024
|
+
|
|
1025
|
+
const isValidWithPhone = await form.validate()
|
|
1026
|
+
await wrapper.vm.$nextTick()
|
|
1027
|
+
|
|
1028
|
+
expect(isValidWithPhone).toBe(true)
|
|
1029
|
+
expect(phoneField.classes()).not.toContain('error-field')
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
it('blocks SyForm submission when a Vuetify custom rule fails', async () => {
|
|
1033
|
+
const wrapper = baseMount({
|
|
1034
|
+
components: { PhoneField, SyForm },
|
|
1035
|
+
setup() {
|
|
1036
|
+
const rules = [(v: unknown) => String(v ?? '').replace(/\D/g, '').startsWith('06') || 'Le numéro doit commencer par 06']
|
|
1037
|
+
return { rules }
|
|
1038
|
+
},
|
|
1039
|
+
template: `
|
|
1040
|
+
<SyForm>
|
|
1041
|
+
<PhoneField :rules="rules" use-vuetify-validation />
|
|
1042
|
+
<button type="submit">Submit</button>
|
|
1043
|
+
</SyForm>
|
|
1044
|
+
`,
|
|
1045
|
+
})
|
|
1046
|
+
|
|
1047
|
+
const syForm = wrapper.findComponent(SyForm)
|
|
1048
|
+
const form = syForm.vm as unknown as { validate: () => Promise<boolean> }
|
|
1049
|
+
|
|
1050
|
+
// A number that does not start with 06 — the Vuetify rule rejects it
|
|
1051
|
+
const input = wrapper.find('input[type="tel"]')
|
|
1052
|
+
await input.setValue('0123456789')
|
|
1053
|
+
await wrapper.vm.$nextTick()
|
|
1054
|
+
|
|
1055
|
+
const isInvalid = await form.validate()
|
|
1056
|
+
await wrapper.vm.$nextTick()
|
|
1057
|
+
|
|
1058
|
+
expect(isInvalid).toBe(false)
|
|
1059
|
+
expect(wrapper.find('.phone-field').classes()).toContain('error-field')
|
|
1060
|
+
|
|
1061
|
+
// Fix the value so the Vuetify rule passes
|
|
1062
|
+
await input.setValue('0612345678')
|
|
1063
|
+
await wrapper.vm.$nextTick()
|
|
1064
|
+
|
|
1065
|
+
const isValid = await form.validate()
|
|
1066
|
+
await wrapper.vm.$nextTick()
|
|
1067
|
+
|
|
1068
|
+
expect(isValid).toBe(true)
|
|
1069
|
+
expect(wrapper.find('.phone-field').classes()).not.toContain('error-field')
|
|
1070
|
+
})
|
|
1071
|
+
|
|
1072
|
+
it('passes SyForm submission when all Vuetify rules are satisfied', async () => {
|
|
1073
|
+
const wrapper = baseMount({
|
|
1074
|
+
components: { PhoneField, SyForm },
|
|
1075
|
+
setup() {
|
|
1076
|
+
const rules = [
|
|
1077
|
+
(v: unknown) => !!v || 'Champ requis',
|
|
1078
|
+
(v: unknown) => String(v ?? '').replace(/\D/g, '').length === 10 || 'Le numéro doit contenir 10 chiffres',
|
|
1079
|
+
]
|
|
1080
|
+
return { rules }
|
|
1081
|
+
},
|
|
1082
|
+
template: `
|
|
1083
|
+
<SyForm>
|
|
1084
|
+
<PhoneField :rules="rules" use-vuetify-validation />
|
|
1085
|
+
<button type="submit">Submit</button>
|
|
1086
|
+
</SyForm>
|
|
1087
|
+
`,
|
|
1088
|
+
})
|
|
1089
|
+
|
|
1090
|
+
const syForm = wrapper.findComponent(SyForm)
|
|
1091
|
+
const form = syForm.vm as unknown as { validate: () => Promise<boolean> }
|
|
1092
|
+
|
|
1093
|
+
const input = wrapper.find('input[type="tel"]')
|
|
1094
|
+
await input.setValue('0612345678')
|
|
1095
|
+
await wrapper.vm.$nextTick()
|
|
1096
|
+
|
|
1097
|
+
const isValid = await form.validate()
|
|
1098
|
+
await wrapper.vm.$nextTick()
|
|
1099
|
+
|
|
1100
|
+
expect(isValid).toBe(true)
|
|
1101
|
+
expect(wrapper.find('.phone-field').classes()).not.toContain('error-field')
|
|
1102
|
+
})
|
|
1103
|
+
})
|
|
870
1104
|
})
|
|
871
1105
|
|
|
872
1106
|
// Tests pour la gestion des indicatifs personnalisés
|
|
@@ -881,8 +1115,8 @@ describe('PhoneField', () => {
|
|
|
881
1115
|
})
|
|
882
1116
|
|
|
883
1117
|
// Vérifier que les indicatifs personnalisés sont ajoutés aux indicatifs standards
|
|
884
|
-
expect(wrapper.vm.
|
|
885
|
-
expect(wrapper.vm.
|
|
1118
|
+
expect(wrapper.vm.dialCodeList.length).toBe(indicatifs.length + customIndicatifs.length)
|
|
1119
|
+
expect(wrapper.vm.dialCodeList).toContainEqual(expect.objectContaining(customIndicatifs[0]))
|
|
886
1120
|
})
|
|
887
1121
|
|
|
888
1122
|
it('uses only custom indicatifs when useCustomIndicatifsOnly is true', () => {
|
|
@@ -896,8 +1130,8 @@ describe('PhoneField', () => {
|
|
|
896
1130
|
})
|
|
897
1131
|
|
|
898
1132
|
// Vérifier que seuls les indicatifs personnalisés sont utilisés
|
|
899
|
-
expect(wrapper.vm.
|
|
900
|
-
expect(wrapper.vm.
|
|
1133
|
+
expect(wrapper.vm.dialCodeList.length).toBe(customIndicatifs.length)
|
|
1134
|
+
expect(wrapper.vm.dialCodeList).toEqual(expect.arrayContaining(customIndicatifs.map(ind => expect.objectContaining(ind))))
|
|
901
1135
|
})
|
|
902
1136
|
|
|
903
1137
|
it('updates phone mask and counter based on selected custom indicatif', async () => {
|
|
@@ -910,13 +1144,77 @@ describe('PhoneField', () => {
|
|
|
910
1144
|
})
|
|
911
1145
|
|
|
912
1146
|
// Sélectionner l'indicatif personnalisé
|
|
913
|
-
wrapper.
|
|
914
|
-
await wrapper.vm.$nextTick()
|
|
1147
|
+
await wrapper.setProps({ dialCodeModel: '+999' })
|
|
915
1148
|
|
|
916
1149
|
// Vérifier que le masque et le counter sont mis à jour
|
|
917
|
-
expect(wrapper.
|
|
1150
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(8)
|
|
918
1151
|
expect(wrapper.vm.phoneMask).toBe('## ## ## ##')
|
|
919
1152
|
})
|
|
1153
|
+
|
|
1154
|
+
it('updates the dialCode when customIndicatifs prop changes', async () => {
|
|
1155
|
+
const initialCustomIndicatifs = [{ code: '+999', abbreviation: 'XX', country: 'Test Country', phoneLength: 8, mask: '## ## ## ##' }]
|
|
1156
|
+
const wrapper = mount(PhoneField, {
|
|
1157
|
+
props: {
|
|
1158
|
+
customIndicatifs: initialCustomIndicatifs,
|
|
1159
|
+
useCustomIndicatifsOnly: true,
|
|
1160
|
+
withCountryCode: true,
|
|
1161
|
+
},
|
|
1162
|
+
})
|
|
1163
|
+
|
|
1164
|
+
// Vérifier que le dialCode est initialisé avec l'indicatif personnalisé
|
|
1165
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
1166
|
+
expect(select.props('modelValue')).toEqual(expect.objectContaining(initialCustomIndicatifs[0]))
|
|
1167
|
+
|
|
1168
|
+
const newCustomIndicatifs = [{ code: '+998', abbreviation: 'YY', country: 'New Test Country', phoneLength: 9, mask: '### ### ###' }]
|
|
1169
|
+
await wrapper.setProps({ customIndicatifs: newCustomIndicatifs })
|
|
1170
|
+
await wrapper.vm.$nextTick()
|
|
1171
|
+
|
|
1172
|
+
// Vérifier que le dialCode est mis à jour avec le nouvel indicatif personnalisé
|
|
1173
|
+
expect(select.props('modelValue')).toEqual(expect.objectContaining(newCustomIndicatifs[0]))
|
|
1174
|
+
|
|
1175
|
+
// Vérifier que le masque et le counter sont mis à jour avec le nouvel indicatif personnalisé
|
|
1176
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(9)
|
|
1177
|
+
expect(wrapper.vm.phoneMask).toBe('### ### ###')
|
|
1178
|
+
|
|
1179
|
+
// Vérifier que les indicatifs affichés dans le select sont mis à jour avec les nouveaux indicatifs personnalisés
|
|
1180
|
+
const items = select.props('items')
|
|
1181
|
+
expect(items).toEqual(expect.arrayContaining(newCustomIndicatifs.map(ind => expect.objectContaining(ind))))
|
|
1182
|
+
|
|
1183
|
+
// Vérifier que les anciens indicatifs personnalisés ne sont plus présents
|
|
1184
|
+
expect(items).not.toEqual(expect.arrayContaining(initialCustomIndicatifs.map(ind => expect.objectContaining(ind))))
|
|
1185
|
+
|
|
1186
|
+
// Vérifier que l'indicatif sélectionné est mis à jour
|
|
1187
|
+
expect(select.props('modelValue')).toEqual(expect.objectContaining(newCustomIndicatifs[0]))
|
|
1188
|
+
})
|
|
1189
|
+
|
|
1190
|
+
it('does not keep selected dial code when it is no longer available', async () => {
|
|
1191
|
+
const initialCustomIndicatifs = [
|
|
1192
|
+
{ code: '+999', abbreviation: 'XX', country: 'Test Country', phoneLength: 8, mask: '## ## ## ##' },
|
|
1193
|
+
{ code: '+998', abbreviation: 'YY', country: 'Fallback Country', phoneLength: 9, mask: '### ### ###' },
|
|
1194
|
+
]
|
|
1195
|
+
|
|
1196
|
+
const wrapper = mount(PhoneField, {
|
|
1197
|
+
props: {
|
|
1198
|
+
customIndicatifs: initialCustomIndicatifs,
|
|
1199
|
+
useCustomIndicatifsOnly: true,
|
|
1200
|
+
withCountryCode: true,
|
|
1201
|
+
dialCodeModel: '+999',
|
|
1202
|
+
},
|
|
1203
|
+
})
|
|
1204
|
+
|
|
1205
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
1206
|
+
expect((select.props('modelValue') as IndicatifLike).code).toBe('+999')
|
|
1207
|
+
|
|
1208
|
+
await wrapper.setProps({
|
|
1209
|
+
customIndicatifs: [{ code: '+998', abbreviation: 'YY', country: 'Fallback Country', phoneLength: 9, mask: '### ### ###' }],
|
|
1210
|
+
})
|
|
1211
|
+
await wrapper.vm.$nextTick()
|
|
1212
|
+
|
|
1213
|
+
const currentDialCode = select.props('modelValue') as IndicatifLike
|
|
1214
|
+
expect(currentDialCode.code).toBe('+998')
|
|
1215
|
+
expect(currentDialCode.code).not.toBe('+999')
|
|
1216
|
+
expect(wrapper.findComponent({ name: 'SyTextField' }).props('counter')).toBe(9)
|
|
1217
|
+
})
|
|
920
1218
|
})
|
|
921
1219
|
|
|
922
1220
|
describe('Fieldset rendering', () => {
|