@cnamts/synapse 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DateFilter-C0wDuzgn.js → DateFilter-DoCcOfDW.js} +1 -1
- package/dist/{NumberFilter-CBj7zdOi.js → NumberFilter-9uR8uo6p.js} +1 -1
- package/dist/{PeriodFilter-DB4wWyKy.js → PeriodFilter-CxN5ini7.js} +1 -1
- package/dist/{SelectFilter-Dces8572.js → SelectFilter-bfxipgvt.js} +1 -1
- package/dist/{TextFilter-BU9nlkuS.js → TextFilter-yCnWcmW2.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordion.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +11 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.d.ts +9 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +12 -30
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +18 -0
- package/dist/components/Amelipro/AmeliproFooter/AmeliproFooter.d.ts +9 -0
- package/dist/components/Amelipro/AmeliproFooter/locales.d.ts +0 -1
- package/dist/components/Amelipro/AmeliproFooter/types.d.ts +1 -0
- package/dist/components/Amelipro/AmeliproHeader/AmeliproHeader.d.ts +2 -0
- package/dist/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBar.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/AmeliproHeaderBrandSection.d.ts +8 -4
- package/dist/components/Amelipro/AmeliproPageLayout/AmeliproPageLayout.d.ts +2 -0
- package/dist/components/Amelipro/AmeliproResultList/AmeliproResultList.d.ts +9 -0
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +11 -11
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +13 -0
- package/dist/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +12 -12
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproUpload/types.d.ts +10 -0
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +16 -16
- package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +1 -1
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +6 -6
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +2 -2
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +52 -16
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +52 -10
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +8 -13
- package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +2 -1
- package/dist/components/DatePicker/tests/setup.d.ts +464 -104
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +6 -6
- package/dist/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/components/NirField/NirField.d.ts +10 -8
- package/dist/components/PeriodField/PeriodField.d.ts +104 -24
- package/dist/components/PhoneField/PhoneField.d.ts +3 -3
- package/dist/components/SearchListField/SearchListField.d.ts +13 -4
- package/dist/components/SyTextArea/SyTextArea.d.ts +2 -2
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -8
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -8
- package/dist/components/Tables/common/SyTablePagination.d.ts +7 -7
- package/dist/components/Tables/common/TableHeader.d.ts +6 -0
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +2 -2
- package/dist/components/Tables/common/types.d.ts +11 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -4
- package/dist/components/Tables/common/useTableCheckbox.d.ts +10 -6
- package/dist/components/Tables/common/useTableHeaders.d.ts +10 -20
- package/dist/design-system-v3.js +1 -1
- package/dist/design-system-v3.umd.cjs +160 -160
- package/dist/main-DMXtXK3y.js +33458 -0
- package/dist/style.css +1 -1
- package/dist/utils/amelipro/rules/uploadFile/index.d.ts +6 -0
- package/dist/utils/amelipro/toKebabCase/toKebabCase.d.ts +1 -0
- package/dist/utils/rules/isRequired/index.d.ts +5 -2
- package/dist/utils/rules/types.d.ts +12 -3
- package/package.json +12 -3
- package/src/assets/amelipro/img/bg-pieces-jointe.svg +28 -0
- package/src/assets/overrides/_btns.scss +1 -0
- package/src/assets/overrides/_forms.scss +7 -0
- package/src/components/Accordion/tests/accordion.spec.ts +0 -55
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.stories.ts +7 -4
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/__tests__/AmeliproAccordionTemplate.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordion/__tests__/AmeliproAccordion.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionFrieze/AmeliproAccordionFrieze.vue +1 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/__tests__/AmeliproAccordionFrieze.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionFrieze/__tests__/__snapshots__/AmeliproAccordionFrieze.spec.ts.snap +574 -112
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +11 -2
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +7 -2
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/AmeliproAccordionList.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +13 -2
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +6 -3
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/AmeliproAccordionResultTemplate.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/AmeliproAccordionResult.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +11 -2
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +7 -2
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/AmeliproAccordionResultList.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +13 -2
- package/src/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.stories.ts +1 -1
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/AmeliproAutoCompleteField.spec.ts +277 -55
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/__snapshots__/AmeliproAutoCompleteField.spec.ts.snap +113 -233
- package/src/components/Amelipro/AmeliproBadge/__tests__/AmeliproBadge.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproBreadcrumb/__tests__/AmeliproBreadcrumb.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproBtn/__tests__/AmeliproBtn.spec.ts +478 -0
- package/src/components/Amelipro/AmeliproBtn/__tests__/__snapshots__/AmeliproBtn.spec.ts.snap +74 -0
- package/src/components/Amelipro/AmeliproCallback/__tests__/AmeliproCallback.spec.ts +100 -0
- package/src/components/Amelipro/AmeliproCallback/__tests__/__snapshots__/AmeliproCallback.spec.ts.snap +50 -0
- package/src/components/Amelipro/AmeliproCaptcha/__tests__/AmeliproCaptcha.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproCaptcha/__tests__/__snapshots__/AmeliproCaptcha.spec.ts.snap +10 -2
- package/src/components/Amelipro/AmeliproCard/__tests__/AmeliproCard.spec.ts +402 -0
- package/src/components/Amelipro/AmeliproCard/__tests__/__snapshots__/AmeliproCard.spec.ts.snap +106 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.stories.ts +2 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +11 -1
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/AmeliproCarouselItem.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproCarousel/__tests__/AmeliproCarousel.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproCarousel/__tests__/__snapshots__/AmeliproCarousel.spec.ts.snap +0 -2
- package/src/components/Amelipro/AmeliproCheckbox/__tests__/AmeliproCheckbox.spec.ts +175 -0
- package/src/components/Amelipro/AmeliproCheckbox/__tests__/__snapshots__/AmeliproCheckbox.spec.ts.snap +88 -0
- package/src/components/Amelipro/AmeliproCheckboxGroup/__tests__/AmeliproCheckboxGroup.spec.ts +423 -0
- package/src/components/Amelipro/AmeliproCheckboxGroup/{tests → __tests__}/__snapshots__/AmeliproCheckboxGroup.spec.ts.snap +112 -78
- package/src/components/Amelipro/AmeliproChips/__tests__/AmeliproChips.spec.ts +92 -0
- package/src/components/Amelipro/AmeliproChips/__tests__/__snapshots__/AmeliproChips.spec.ts.snap +81 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/AmeliproClickableTile.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproContentLayout/__tests__/AmeliproContentLayout.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproCopyBtn/__tests__/AmeliproCopyBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproCustomSelector/__tests__/AmeliproCustomSelector.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproDentalChart/AmeliproTooth/tests/AmeliproTooth.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproDentalChart/tests/AmeliproDentalChart.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproDialog/__tests__/AmeliproDialog.spec.ts +257 -0
- package/src/components/Amelipro/AmeliproDialog/__tests__/__snapshots__/AmeliproDialog.spec.ts.snap +61 -0
- package/src/components/Amelipro/AmeliproDisclosure/__tests__/AmeliproDisclosure.spec.ts +79 -0
- package/src/components/Amelipro/AmeliproDisclosure/__tests__/__snapshots__/AmeliproDisclosure.spec.ts.snap +89 -0
- package/src/components/Amelipro/AmeliproErrorTemplate/__tests__/AmeliproErrorTemplate.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproFilePreview/__tests__/AmeliproFilePreview.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproFirstLogin/__tests__/AmeliproFirstLogin.spec.ts +0 -2
- package/src/components/Amelipro/AmeliproFooter/AmeliproFooter.stories.ts +1 -0
- package/src/components/Amelipro/AmeliproFooter/AmeliproFooter.vue +5 -1
- package/src/components/Amelipro/AmeliproFooter/locales.ts +0 -1
- package/src/components/Amelipro/AmeliproFooter/tests/AmeliproFooter.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproFooter/types.d.ts +1 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.stories.ts +18 -8
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +3 -1
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBar.vue +3 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/AmeliproHeaderBrandSection.vue +10 -2
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/tests/AmeliproHeaderBrandSection.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/tests/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +2 -3
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproLogoAm/tests/AmeliproLogoAm.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/tests/AmeliproHeaderBar.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/tests/__snapshots__/AmeliproHeaderBar.spec.ts.snap +2 -3
- package/src/components/Amelipro/AmeliproHeader/tests/AmeliproHeader.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +2 -3
- package/src/components/Amelipro/AmeliproIcon/tests/AmeliproIcon.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproIconBtn/tests/AmeliproIconBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproIllustratedDataTile/tests/AmeliproIllustratedDataTile.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/tests/AmeliproIllustratedRadioGroup.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMailTile/tests/AmeliproMailTile.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMenu/tests/AmeliproMenu.spec.ts +0 -2
- package/src/components/Amelipro/AmeliproMessage/tests/AmeliproMessage.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenuBtn/tests/AmeliproDropdownMenuBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/tests/AmeliproDropdownMenu.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingMenuBtn/tests/AmeliproMessagingMenuBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMessagingLayout/tests/AmeliproMessagingLayout.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproMultipleFoldingCard/tests/AmeliproMultipleFoldingCard.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproNumberedCard/tests/AmeliproNumberedCard.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproOnboarding/tests/AmeliproOnboarding.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPageLayout/AmeliproPageLayout.stories.ts +9 -2
- package/src/components/Amelipro/AmeliproPageLayout/AmeliproPageLayout.vue +4 -1
- package/src/components/Amelipro/AmeliproPageLayout/tests/AmeliproPageLayout.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +2 -3
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/tests/AmeliproPaginationBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPagination/tests/AmeliproPagination.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPatientBanner/tests/AmeliproPatientBanner.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPatientLogged/__tests__/AmeliproPatientLogged.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPatientLogged/__tests__/__snapshots__/AmeliproPatientLogged.spec.ts.snap +13 -2
- package/src/components/Amelipro/AmeliproPatientLogin/AmeliproPatientLoginForm/__tests__/AmeliproPatientLoginForm.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPatientLogin/__tests__/AmeliproPatientLogin.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/__tests__/AmeliproPostalAddressCityRow.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/__tests__/__snapshots__/AmeliproPostalAddressCityRow.spec.ts.snap +24 -4
- package/src/components/Amelipro/AmeliproPostalAddressField/tests/AmeliproPostalAddressField.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproPostalAddressField/tests/__snapshots__/AmeliproPostalAddressField.spec.ts.snap +40 -8
- package/src/components/Amelipro/AmeliproRadioGroup/tests/AmeliproRadioGroup.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +6 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +5 -1
- package/src/components/Amelipro/AmeliproResultList/__tests__/AmeliproResultList.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +13 -2
- package/src/components/Amelipro/AmeliproSelect/tests/AmeliproSelect.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproSelect/tests/__snapshots__/AmeliproSelect.spec.ts.snap +13 -2
- package/src/components/Amelipro/AmeliproStateTile/tests/AmeliproStateTile.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproStatus/tests/AmeliproStatus.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepBtn/tests/AmeliproStepBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproStepper/tests/AmeliproStepper.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.stories.ts +87 -9
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +144 -62
- package/src/components/Amelipro/AmeliproTable/__tests__/AmeliproTable.spec.ts +10 -4
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +374 -189
- package/src/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/tests/AmeliproTabBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTabs/tests/AmeliproTabs.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTextArea/AmeliproTextArea.stories.ts +1 -1
- package/src/components/Amelipro/AmeliproTextArea/__tests__/AmeliproTextArea.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTextArea/__tests__/__snapshots__/AmeliproTextArea.spec.ts.snap +10 -2
- package/src/components/Amelipro/AmeliproTextField/tests/AmeliproTextField.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTextField/tests/__snapshots__/AmeliproTextField.spec.ts.snap +10 -2
- package/src/components/Amelipro/AmeliproTileBtn/tests/AmeliproTileBtn.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTooltips/tests/AmeliproTooltips.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproTransmission/tests/AmeliproTransmission.spec.ts +0 -4
- package/src/components/Amelipro/AmeliproUpload/AmeliproUpload.mdx +38 -0
- package/src/components/Amelipro/AmeliproUpload/AmeliproUpload.stories.ts +99 -0
- package/src/components/Amelipro/AmeliproUpload/AmeliproUpload.vue +714 -0
- package/src/components/Amelipro/AmeliproUpload/README.md +66 -0
- package/src/components/Amelipro/AmeliproUpload/__tests__/AmeliproUpload.spec.ts +74 -0
- package/src/components/Amelipro/AmeliproUpload/types.d.ts +10 -0
- package/src/components/Amelipro/ServiceMenu/ServiceBtn/tests/ServiceBtn.spec.ts +0 -4
- package/src/components/Amelipro/ServiceMenu/ServiceList/tests/ServiceList.spec.ts +0 -4
- package/src/components/Amelipro/ServiceMenu/ServiceMenuContent/tests/ServiceMenuContent.spec.ts +0 -4
- package/src/components/Amelipro/ServiceMenu/tests/ServiceMenu.spec.ts +0 -4
- package/src/components/Amelipro/StructureMenu/StructureBtn/tests/StructureBtn.spec.ts +0 -4
- package/src/components/Amelipro/StructureMenu/StructureItem/tests/StructureItem.spec.ts +0 -4
- package/src/components/Amelipro/StructureMenu/StructureList/tests/StructureList.spec.ts +0 -4
- package/src/components/Amelipro/StructureMenu/StructureTabs/tests/StructureTabs.spec.ts +0 -4
- package/src/components/Amelipro/StructureMenu/tests/StructureMenu.spec.ts +0 -2
- package/src/components/Amelipro/UserInformationSummary/tests/UserInformationSummary.spec.ts +0 -4
- package/src/components/Amelipro/UserMenu/UserMenuDetails/tests/UserMenuDetails.spec.ts +0 -4
- package/src/components/Amelipro/UserMenu/tests/UserMenu.spec.ts +0 -4
- package/src/components/BackBtn/BackBtn.vue +2 -1
- package/src/components/BackBtn/tests/BackBtn.spec.ts +1 -23
- package/src/components/BackToTopBtn/tests/BackToTopBtn.spec.ts +3 -34
- package/src/components/ChipList/tests/chipList.spec.ts +0 -38
- package/src/components/CollapsibleList/tests/CollapsibleList.spec.ts +0 -8
- package/src/components/ContextualMenu/tests/ContextualMenu.spec.ts +0 -28
- package/src/components/CookieBanner/tests/CookieBanner.spec.ts +1 -11
- package/src/components/CookiesSelection/CookiesInformation/tests/CookiesInformation.spec.ts +0 -16
- package/src/components/CookiesSelection/CookiesTable/tests/CookiesTable.spec.ts +0 -4
- package/src/components/CookiesSelection/tests/CookiesSelection.spec.ts +0 -16
- package/src/components/CopyBtn/tests/CopyBtn.spec.ts +0 -31
- package/src/components/CopyBtn/tests/__snapshots__/CopyBtn.spec.ts.snap +1 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +3 -37
- package/src/components/Customs/Selects/SyBtnSelect/tests/SyBtnSelect.spec.ts +0 -28
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.spec.ts +8 -104
- package/src/components/Customs/Selects/SySelect/SySelect.vue +2 -2
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +0 -135
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +1 -1
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +1 -1
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +0 -20
- package/src/components/Customs/SyForm/SyForm.mdx +1 -3
- package/src/components/Customs/SyForm/SyForm.stories.ts +131 -143
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +0 -2
- package/src/components/Customs/SyTextField/SyTextField.vue +27 -5
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +1 -27
- package/src/components/DataList/DataListLoading/tests/DataListLoading.spec.ts +0 -4
- package/src/components/DataList/tests/DataList.spec.ts +0 -26
- package/src/components/DataListGroup/tests/DataListGroup.spec.ts +0 -10
- package/src/components/DataListItem/tests/DataListItem.spec.ts +0 -28
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +31 -8
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.events.spec.ts +0 -16
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.spec.ts +4 -34
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +44 -12
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.events.spec.ts +0 -10
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +2 -2
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +0 -13
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +0 -10
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +0 -52
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +7 -1
- package/src/components/DatePicker/composables/tests/useDatePickerViewMode.spec.ts +107 -72
- package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +6 -6
- package/src/components/DatePicker/composables/useDatePickerViewMode.ts +57 -7
- package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +14 -14
- package/src/components/DatePicker/tests/DatePicker.validation.spec.ts +0 -543
- package/src/components/DatePicker/tests/navigation.regression.spec.ts +74 -0
- package/src/components/DatePicker/tests/navigation.simple.spec.ts +137 -0
- package/src/components/DiacriticPicker/tests/DiatriticPicker.spec.ts +0 -6
- package/src/components/DialogBox/tests/DialogBox.spec.ts +0 -63
- package/src/components/DownloadBtn/tests/DownloadBtn.spec.ts +0 -7
- package/src/components/ErrorPage/tests/ErrorPage.spec.ts +0 -7
- package/src/components/ExternalLinks/tests/ExternalLinks.spec.ts +0 -16
- package/src/components/ExternalLinks/tests/__snapshots__/ExternalLinks.spec.ts.snap +1 -0
- package/src/components/FileList/tests/FileList.spec.ts +0 -13
- package/src/components/FilePreview/tests/FilePreview.spec.ts +1 -6
- package/src/components/FileUpload/tests/FileUpload.spec.ts +1 -48
- package/src/components/FilterInline/tests/FilterInline.spec.ts +0 -10
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +2 -0
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +0 -10
- package/src/components/FooterBar/tests/FooterBar.spec.ts +7 -19
- package/src/components/FranceConnectBtn/tests/FranceConnectBtn.spec.ts +0 -11
- package/src/components/HeaderBar/HeaderBar.stories.ts +37 -38
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/tests/HeaderSubMenu.spec.ts +0 -6
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +0 -6
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/useHandleSubMenus.spec.ts +0 -13
- package/src/components/HeaderBar/HeaderLogo/tests/HeaderLogo.spec.ts +1 -22
- package/src/components/HeaderBar/HeaderMenuBtn/tests/HeaderMenuBtn.spec.ts +0 -10
- package/src/components/HeaderBar/tests/HeaderBar.spec.ts +0 -16
- package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +0 -4
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +22 -15
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +0 -4
- package/src/components/HeaderToolbar/tests/HeaderToolBar.spec.ts +7 -51
- package/src/components/LangBtn/tests/LangBtn.spec.ts +0 -56
- package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +22 -67
- package/src/components/NirField/NirField.stories.ts +13 -2
- package/src/components/NirField/NirField.vue +69 -34
- package/src/components/NirField/tests/NirField.cursor.spec.ts +315 -0
- package/src/components/NirField/tests/NirField.spec.ts +215 -17
- package/src/components/NotFoundPage/tests/NotFoundPage.spec.ts +2 -12
- package/src/components/NotificationBar/NotificationBar.mdx +1 -1
- package/src/components/NotificationBar/NotificationBar.stories.ts +1 -0
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +5 -44
- package/src/components/PageContainer/tests/PageContainer.spec.ts +1 -15
- package/src/components/PaginatedTable/tests/PaginatedTable.spec.ts +0 -23
- package/src/components/PasswordField/tests/PasswordField.spec.ts +4 -38
- package/src/components/PeriodField/tests/PeriodField.spec.ts +4 -74
- package/src/components/PhoneField/tests/PhoneField.spec.ts +3 -154
- package/src/components/RangeField/RangeSlider/tests/rangeSlider.spec.ts +0 -13
- package/src/components/RangeField/RangeSlider/tests/useThumbKeyboard.spec.ts +0 -34
- package/src/components/RangeField/RangeSlider/tests/useTrack.spec.ts +4 -24
- package/src/components/RangeField/tests/RangeField.spec.ts +0 -34
- package/src/components/RatingPicker/EmotionPicker/tests/EmotionPicker.spec.ts +2 -23
- package/src/components/RatingPicker/NumberPicker/tests/NumberPicker.spec.ts +2 -17
- package/src/components/RatingPicker/StarsPicker/tests/StarsPicker.spec.ts +3 -22
- package/src/components/RatingPicker/tests/Rating.spec.ts +0 -10
- package/src/components/RatingPicker/tests/RatingPicker.spec.ts +0 -23
- package/src/components/SearchListField/SearchListField.mdx +3 -4
- package/src/components/SearchListField/SearchListField.stories.ts +103 -3
- package/src/components/SearchListField/SearchListField.vue +34 -9
- package/src/components/SearchListField/tests/SearchListField.spec.ts +98 -44
- package/src/components/SocialMediaLinks/tests/SocialMediaLinks.spec.ts +0 -32
- package/src/components/SubHeader/tests/SubHeader.spec.ts +0 -18
- package/src/components/SyAlert/tests/SyAlert.spec.ts +0 -14
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +0 -31
- package/src/components/TableToolbar/tests/TableToolbar.spec.ts +0 -31
- package/src/components/TableToolbar/tests/__snapshots__/TableToolbar.spec.ts.snap +72 -24
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +15 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +309 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +33 -6
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -58
- package/src/components/Tables/SyTable/SyTable.mdx +15 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +228 -0
- package/src/components/Tables/SyTable/SyTable.vue +48 -10
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +63 -55
- package/src/components/Tables/common/SyTablePagination.vue +11 -9
- package/src/components/Tables/common/TableHeader.vue +57 -2
- package/src/components/Tables/common/filters/tests/DateFilter.spec.ts +0 -11
- package/src/components/Tables/common/filters/tests/NumberFilter.spec.ts +0 -11
- package/src/components/Tables/common/filters/tests/PeriodFilter.spec.ts +0 -11
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +0 -11
- package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +0 -11
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +0 -31
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +0 -49
- package/src/components/Tables/common/tests/TableHeader.spec.ts +0 -19
- package/src/components/Tables/common/tests/filterByRange.spec.ts +0 -13
- package/src/components/Tables/common/tests/resize.spec.ts +0 -13
- package/src/components/Tables/common/types.ts +11 -0
- package/src/components/Tables/common/usePagination.ts +11 -20
- package/src/components/Tables/common/useStoredOptions.ts +1 -1
- package/src/components/Tables/common/useTableCheckbox.ts +23 -11
- package/src/components/Tables/common/useTableHeaders.ts +73 -6
- package/src/components/ToolbarContainer/tests/ToolbarContainer.spec.ts +0 -19
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +0 -15
- package/src/components/Usages/tests/Usages.spec.ts +3 -31
- package/src/components/UserMenuBtn/tests/UserMenuBtn.spec.ts +0 -31
- package/src/composables/useFilterable/useFilterable.ts +33 -24
- package/src/composables/validation/{AvecVosComposants.mdx → AvecVosComposants.mdx.old} +1 -1
- package/src/composables/validation/{FormValidation.stories.ts → FormValidation.stories.ts.old} +5 -5
- package/src/stories/Accessibilite/Introduction.mdx +1 -1
- package/src/stories/Demarrer/EnrichirLeDesignSystem.mdx +43 -0
- package/src/stories/Demarrer/EnrichirLeDesignSystem.stories.ts +239 -0
- package/src/stories/Demarrer/SignalerUneAnomalie.mdx +39 -0
- package/src/stories/Demarrer/SignalerUneAnomalie.stories.ts +261 -0
- package/src/stories/GuideDuDev/FormValidationGuide.mdx +746 -114
- package/src/stories/GuideDuDev/UtiliserLesRules.mdx +138 -136
- package/src/utils/amelipro/rules/uploadFile/index.ts +119 -0
- package/src/utils/amelipro/rules/uploadFile/tests/uploadFile.spec.ts +55 -0
- package/src/utils/amelipro/toKebabCase/toKebabCase.ts +11 -0
- package/src/utils/rules/doMatchPattern/index.ts +1 -1
- package/src/utils/rules/isDateValid/index.ts +1 -1
- package/src/utils/rules/isExactLength/index.ts +4 -0
- package/src/utils/rules/isHolidayDay/index.ts +1 -1
- package/src/utils/rules/isHolidayDay/tests/isHolidayDay.spec.ts +24 -14
- package/src/utils/rules/isMaxLength/index.ts +4 -0
- package/src/utils/rules/isMinLength/index.ts +4 -0
- package/src/utils/rules/isNotAfterDate/index.ts +4 -0
- package/src/utils/rules/isNotAfterToday/index.ts +1 -1
- package/src/utils/rules/isNotBeforeDate/index.ts +4 -0
- package/src/utils/rules/isNotBeforeToday/index.ts +1 -1
- package/src/utils/rules/isRequired/index.ts +11 -5
- package/src/utils/rules/isRequired/tests/{isRequred.spec.ts → isRequired.spec.ts} +24 -0
- package/src/utils/rules/isValidEmail/index.ts +1 -1
- package/src/utils/rules/types.d.ts +12 -3
- package/dist/main-Dt4iNotT.js +0 -33147
- package/src/components/Amelipro/AmeliproBtn/tests/AmeliproBtn.spec.ts +0 -22
- package/src/components/Amelipro/AmeliproBtn/tests/__snapshots__/AmeliproBtn.spec.ts.snap +0 -46
- package/src/components/Amelipro/AmeliproCallback/tests/AmeliproCallback.spec.ts +0 -21
- package/src/components/Amelipro/AmeliproCallback/tests/__snapshots__/AmeliproCallback.spec.ts.snap +0 -165
- package/src/components/Amelipro/AmeliproCard/tests/AmeliproCard.spec.ts +0 -23
- package/src/components/Amelipro/AmeliproCard/tests/__snapshots__/AmeliproCard.spec.ts.snap +0 -78
- package/src/components/Amelipro/AmeliproCheckbox/tests/AmeliproCheckbox.spec.ts +0 -23
- package/src/components/Amelipro/AmeliproCheckbox/tests/__snapshots__/AmeliproCheckbox.spec.ts.snap +0 -40
- package/src/components/Amelipro/AmeliproCheckboxGroup/tests/AmeliproCheckboxGroup.spec.ts +0 -50
- package/src/components/Amelipro/AmeliproChips/tests/AmeliproChips.spec.ts +0 -20
- package/src/components/Amelipro/AmeliproChips/tests/__snapshots__/AmeliproChips.spec.ts.snap +0 -97
- package/src/components/Amelipro/AmeliproDialog/tests/AmeliproDialog.spec.ts +0 -26
- package/src/components/Amelipro/AmeliproDialog/tests/__snapshots__/AmeliproDialog.spec.ts.snap +0 -134
- package/src/components/Amelipro/AmeliproDisclosure/tests/AmeliproDisclosure.spec.ts +0 -23
- package/src/components/Amelipro/AmeliproDisclosure/tests/__snapshots__/AmeliproDisclosure.spec.ts.snap +0 -104
- package/src/components/BackBtn/tests/__snapshots__/BackBtn.spec.ts.snap +0 -45
- package/src/components/DialogBox/tests/__snapshots__/DialogBox.spec.ts.snap +0 -204
- package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +0 -1222
- package/src/stories/Demarrer/CreerUneIssue.mdx +0 -67
- package/src/stories/Demarrer/components.stories.ts +0 -25
- /package/src/composables/validation/{FormValidation.mdx → FormValidation.mdx.old} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { VueWrapper, mount, shallowMount } from '@vue/test-utils'
|
|
2
|
+
import { beforeEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import AmeliproCheckbox from '../AmeliproCheckbox.vue'
|
|
4
|
+
import type { AmeliproCheckboxItem } from '../types'
|
|
5
|
+
import { AmeliproMessage } from '@/components'
|
|
6
|
+
import type { ComponentProps } from 'vue-component-type-helpers'
|
|
7
|
+
import type { ExpectedPropOptions } from '@tests/types'
|
|
8
|
+
import { type PropType } from 'vue'
|
|
9
|
+
import TestHelper from '@tests/helpers/TestHelper'
|
|
10
|
+
import { attachToApp } from '@tests/helpers/utils'
|
|
11
|
+
|
|
12
|
+
const expectedPropOptions: ExpectedPropOptions<typeof AmeliproCheckbox> = {
|
|
13
|
+
ariaRequired: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
checkbox: {
|
|
18
|
+
type: Object as PropType<AmeliproCheckboxItem>,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
errorDefault: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
isSwitch: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
labelLeft: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
requiredErrorMessage: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'Sélection obligatoire',
|
|
44
|
+
},
|
|
45
|
+
uniqueId: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Values pour les props "required"
|
|
52
|
+
const requiredPropValues = (): ComponentProps<typeof AmeliproCheckbox> => ({
|
|
53
|
+
checkbox: {
|
|
54
|
+
label: 'Required checkbox label',
|
|
55
|
+
value: 'required-checkbox-value',
|
|
56
|
+
},
|
|
57
|
+
uniqueId: 'required-unique-id',
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Valeurs pour les props "modified"
|
|
61
|
+
const modifiedPropValues = (): ComponentProps<typeof AmeliproCheckbox> => ({
|
|
62
|
+
ariaRequired: true,
|
|
63
|
+
checkbox: {
|
|
64
|
+
description: 'Modified checkbox description',
|
|
65
|
+
label: 'Modified checkbox label',
|
|
66
|
+
value: 'modified-checkbox-value',
|
|
67
|
+
} as AmeliproCheckboxItem,
|
|
68
|
+
disabled: true,
|
|
69
|
+
errorDefault: true,
|
|
70
|
+
modelValue: true,
|
|
71
|
+
requiredErrorMessage: 'Modified required error message',
|
|
72
|
+
uniqueId: 'modified-unique-id',
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const testHelper = new TestHelper(AmeliproCheckbox)
|
|
76
|
+
testHelper.setExpectedPropOptions(expectedPropOptions)
|
|
77
|
+
.setRequiredPropValues(requiredPropValues)
|
|
78
|
+
.setModifiedPropValues(modifiedPropValues)
|
|
79
|
+
|
|
80
|
+
describe('AmeliproCheckbox', () => {
|
|
81
|
+
describe('Snapshots', () => {
|
|
82
|
+
testHelper.snapshots()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
describe('Properties', () => {
|
|
86
|
+
testHelper.properties()
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe.todo('Setting props should update attributes of inner tags')
|
|
90
|
+
|
|
91
|
+
describe.todo('Setting props should update props or attributes of inner components')
|
|
92
|
+
|
|
93
|
+
describe('Events', () => {
|
|
94
|
+
let wrapper: VueWrapper<InstanceType<typeof AmeliproCheckbox>>
|
|
95
|
+
const inputWrapper = () => wrapper.find('[role="checkbox"]')
|
|
96
|
+
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
wrapper = mount(AmeliproCheckbox, {
|
|
99
|
+
attachTo: attachToApp(),
|
|
100
|
+
props: {
|
|
101
|
+
...requiredPropValues(),
|
|
102
|
+
checkbox: {
|
|
103
|
+
label: 'Exemple',
|
|
104
|
+
value: 'Valeur de la checkbox',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('should test the input wrapper', () => {
|
|
111
|
+
expect(inputWrapper().attributes()).toMatchObject({
|
|
112
|
+
'aria-checked': 'false',
|
|
113
|
+
'aria-disabled': 'false',
|
|
114
|
+
'class': expect.stringContaining('amelipro-checkbox-input'),
|
|
115
|
+
'id': testHelper.default('uniqueId'),
|
|
116
|
+
'role': 'checkbox',
|
|
117
|
+
'tabindex': '0',
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// TODO: Le contenu de emitted() semble buggé (non conforme à la doc)
|
|
122
|
+
it.skip('should react to input event', async () => {
|
|
123
|
+
expect(wrapper.emitted('input')).toBeUndefined()
|
|
124
|
+
await inputWrapper().trigger('input')
|
|
125
|
+
expect(wrapper.emitted('input')).toEqual([[true, 'Valeur de la checkbox']])
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
describe('errors', () => {
|
|
130
|
+
let wrapper: VueWrapper<InstanceType<typeof AmeliproCheckbox>>
|
|
131
|
+
|
|
132
|
+
beforeEach(() => {
|
|
133
|
+
wrapper = shallowMount(AmeliproCheckbox, {
|
|
134
|
+
props: {
|
|
135
|
+
...requiredPropValues(),
|
|
136
|
+
checkbox: {
|
|
137
|
+
description: 'The checkbox description',
|
|
138
|
+
label: 'the checkbox label',
|
|
139
|
+
value: 'the-checkbox-value',
|
|
140
|
+
} as AmeliproCheckboxItem,
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it.skip('should display error message', async () => {
|
|
146
|
+
let componentWrapper = wrapper.findComponent(AmeliproMessage)
|
|
147
|
+
expect(componentWrapper.exists()).toBe(false)
|
|
148
|
+
|
|
149
|
+
await wrapper.setProps({ ariaRequired: true })
|
|
150
|
+
await wrapper.find('[role="checkbox"]').trigger('click')
|
|
151
|
+
await wrapper.find('[role="checkbox"]').trigger('click')
|
|
152
|
+
componentWrapper = wrapper.findComponent(AmeliproMessage)
|
|
153
|
+
|
|
154
|
+
expect(wrapper.find('[role="checkbox"]').attributes('aria-describedby')).toBe('the-id-error The checkbox description')
|
|
155
|
+
expect(componentWrapper.exists()).toBe(true)
|
|
156
|
+
expect(componentWrapper.find('.mb-0').text()).toBe('Sélection obligatoire')
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
it('should update label color classes', async () => {
|
|
160
|
+
const elementWrapper = wrapper.find('.checkbox-label')
|
|
161
|
+
expect(elementWrapper.exists()).toBe(true)
|
|
162
|
+
expect(elementWrapper.attributes('class')).toContain('text-ap-grey-darken-1')
|
|
163
|
+
|
|
164
|
+
await wrapper.setProps({ disabled: true })
|
|
165
|
+
expect(elementWrapper.exists()).toBe(true)
|
|
166
|
+
expect(elementWrapper.attributes('class')).toContain('text-ap-grey')
|
|
167
|
+
|
|
168
|
+
await wrapper.setProps({ disabled: false, ariaRequired: true })
|
|
169
|
+
await wrapper.find('[role="checkbox"]').trigger('click')
|
|
170
|
+
await wrapper.find('[role="checkbox"]').trigger('click')
|
|
171
|
+
expect(elementWrapper.exists()).toBe(true)
|
|
172
|
+
expect(elementWrapper.attributes('class')).toContain('checkbox-label text-ap-error')
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
})
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`AmeliproCheckbox > Snapshots > renders the component with all properties filled in 1`] = `
|
|
4
|
+
<div id="modified-unique-id-container">
|
|
5
|
+
<div class="
|
|
6
|
+
align-center
|
|
7
|
+
amelipro-checkbox
|
|
8
|
+
d-flex
|
|
9
|
+
">
|
|
10
|
+
<div
|
|
11
|
+
aria-checked="true"
|
|
12
|
+
aria-describedby="Modified checkbox description"
|
|
13
|
+
aria-disabled="true"
|
|
14
|
+
aria-required="true"
|
|
15
|
+
class="
|
|
16
|
+
align-center
|
|
17
|
+
amelipro-checkbox-input
|
|
18
|
+
d-inline-flex
|
|
19
|
+
flex-row
|
|
20
|
+
mr-0
|
|
21
|
+
text-body-1
|
|
22
|
+
"
|
|
23
|
+
id="modified-unique-id"
|
|
24
|
+
role="checkbox"
|
|
25
|
+
tabindex="-1"
|
|
26
|
+
>
|
|
27
|
+
<span
|
|
28
|
+
class="
|
|
29
|
+
checkbox-label
|
|
30
|
+
text-ap-grey
|
|
31
|
+
"
|
|
32
|
+
id="modified-unique-id-label-text"
|
|
33
|
+
>
|
|
34
|
+
Modified checkbox label
|
|
35
|
+
<span
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
class="d-inline-flex"
|
|
38
|
+
>
|
|
39
|
+
*
|
|
40
|
+
</span>
|
|
41
|
+
<span class="d-sr-only">
|
|
42
|
+
Champ obligatoire
|
|
43
|
+
</span>
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<!-- v-if -->
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`AmeliproCheckbox > Snapshots > renders the component with only required properties filled in 1`] = `
|
|
52
|
+
<div id="required-unique-id-container">
|
|
53
|
+
<div class="
|
|
54
|
+
align-center
|
|
55
|
+
amelipro-checkbox
|
|
56
|
+
d-flex
|
|
57
|
+
">
|
|
58
|
+
<div
|
|
59
|
+
aria-checked="false"
|
|
60
|
+
aria-disabled="false"
|
|
61
|
+
class="
|
|
62
|
+
align-center
|
|
63
|
+
amelipro-checkbox-input
|
|
64
|
+
d-inline-flex
|
|
65
|
+
flex-row
|
|
66
|
+
mr-0
|
|
67
|
+
text-body-1
|
|
68
|
+
"
|
|
69
|
+
id="required-unique-id"
|
|
70
|
+
role="checkbox"
|
|
71
|
+
tabindex="0"
|
|
72
|
+
>
|
|
73
|
+
<span
|
|
74
|
+
class="
|
|
75
|
+
checkbox-label
|
|
76
|
+
text-ap-grey-darken-1
|
|
77
|
+
"
|
|
78
|
+
id="required-unique-id-label-text"
|
|
79
|
+
>
|
|
80
|
+
Required checkbox label
|
|
81
|
+
<!-- v-if -->
|
|
82
|
+
<!-- v-if -->
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<!-- v-if -->
|
|
87
|
+
</div>
|
|
88
|
+
`;
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { DOMWrapper, type VueWrapper, mount, shallowMount } from '@vue/test-utils'
|
|
2
|
+
import { beforeEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import AmeliproCheckboxGroup from '../AmeliproCheckboxGroup.vue'
|
|
4
|
+
import type { AmeliproCheckboxGroupItem } from '../types'
|
|
5
|
+
import { AmeliproMessage } from '@/components'
|
|
6
|
+
import type { ComponentProps } from 'vue-component-type-helpers'
|
|
7
|
+
import type { ExpectedPropOptions } from '@tests/types'
|
|
8
|
+
import type { PropType } from 'vue'
|
|
9
|
+
import TestHelper from '@tests/helpers/TestHelper'
|
|
10
|
+
import { attachToApp } from '@tests/helpers/utils'
|
|
11
|
+
|
|
12
|
+
const expectedPropOptions: ExpectedPropOptions<typeof AmeliproCheckboxGroup> = {
|
|
13
|
+
ariaRequired: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
fullHorizontal: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
groupLabel: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
hiddenLabel: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
horizontal: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
horizontalLabel: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: Array as PropType<AmeliproCheckboxGroupItem[]>,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
multipleRequired: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
multipleRequiredErrorMessage: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'Vous devez cocher au moins deux options',
|
|
52
|
+
},
|
|
53
|
+
pills: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
requiredErrorMessage: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'Sélection obligatoire',
|
|
60
|
+
},
|
|
61
|
+
uniqueId: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Values pour les props "required"
|
|
68
|
+
const requiredPropValues = (): ComponentProps<typeof AmeliproCheckboxGroup> => ({
|
|
69
|
+
groupLabel: 'required-group-label',
|
|
70
|
+
modelValue: [{
|
|
71
|
+
isChecked: true,
|
|
72
|
+
label: 'Required item label',
|
|
73
|
+
value: 'required-item-value',
|
|
74
|
+
}],
|
|
75
|
+
multipleRequired: false,
|
|
76
|
+
uniqueId: 'required-unique-id',
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Valeurs pour les props "modified"
|
|
80
|
+
const modifiedPropValues = (): ComponentProps<typeof AmeliproCheckboxGroup> => ({
|
|
81
|
+
ariaRequired: true,
|
|
82
|
+
disabled: true,
|
|
83
|
+
fullHorizontal: true,
|
|
84
|
+
groupLabel: 'Modified group label',
|
|
85
|
+
horizontal: true,
|
|
86
|
+
horizontalLabel: true,
|
|
87
|
+
modelValue: [
|
|
88
|
+
{
|
|
89
|
+
description: 'Modified item description 1',
|
|
90
|
+
disabled: false,
|
|
91
|
+
isChecked: false,
|
|
92
|
+
label: 'Modified item label 1',
|
|
93
|
+
value: 'modified-item-value-1',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
description: 'Modified item description 2',
|
|
97
|
+
disabled: false,
|
|
98
|
+
isChecked: true,
|
|
99
|
+
label: 'Modified item label 2',
|
|
100
|
+
value: 'modified-item-value-2',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
description: 'Modified item description 3',
|
|
104
|
+
disabled: false,
|
|
105
|
+
isChecked: true,
|
|
106
|
+
label: 'Modified item label 3',
|
|
107
|
+
value: 'modified-item-value-3',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
multipleRequired: true,
|
|
111
|
+
multipleRequiredErrorMessage: 'Modified multiple required error message',
|
|
112
|
+
pills: true,
|
|
113
|
+
requiredErrorMessage: 'Modified required error message',
|
|
114
|
+
uniqueId: 'modified-unique-id',
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const testHelper = new TestHelper(AmeliproCheckboxGroup)
|
|
118
|
+
testHelper.setExpectedPropOptions(expectedPropOptions)
|
|
119
|
+
.setRequiredPropValues(requiredPropValues)
|
|
120
|
+
.setModifiedPropValues(modifiedPropValues)
|
|
121
|
+
|
|
122
|
+
describe('AmeliproCheckboxGroup', () => {
|
|
123
|
+
describe('Snapshots', () => {
|
|
124
|
+
testHelper.snapshots()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
describe('Properties', () => {
|
|
128
|
+
testHelper.properties()
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
describe('Setting props should update attributes of inner tags', () => {
|
|
132
|
+
describe('Checkbox group', () => {
|
|
133
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproCheckboxGroup>>
|
|
134
|
+
|
|
135
|
+
beforeEach(() => {
|
|
136
|
+
vueWrapper = shallowMount(AmeliproCheckboxGroup, { props: requiredPropValues() })
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('should have the default classes', () => {
|
|
140
|
+
expect(vueWrapper.find('.amelipro-checkbox-group').attributes('class'))
|
|
141
|
+
.toBe('amelipro-checkbox-group d-flex flex-column classic')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it('prop fullHorizontal sets attribute class', async () => {
|
|
145
|
+
await vueWrapper.setProps({ fullHorizontal: true })
|
|
146
|
+
expect(vueWrapper.find('.amelipro-checkbox-group').attributes('class'))
|
|
147
|
+
.toBe('amelipro-checkbox-group d-flex flex-column flex-md-row align-md-start classic')
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('prop horizontalLabel sets attribute class', async () => {
|
|
151
|
+
await vueWrapper.setProps({ horizontalLabel: true })
|
|
152
|
+
expect(vueWrapper.find('.amelipro-checkbox-group').attributes('class'))
|
|
153
|
+
.toBe('amelipro-checkbox-group d-flex flex-column flex-md-row align-md-start classic')
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('prop pills sets attribute class', async () => {
|
|
157
|
+
await vueWrapper.setProps({ pills: true })
|
|
158
|
+
expect(vueWrapper.find('.amelipro-checkbox-group').attributes('class'))
|
|
159
|
+
.toBe('amelipro-checkbox-group d-flex flex-column pills')
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
describe('Checkbox group wrapper', () => {
|
|
164
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproCheckboxGroup>>
|
|
165
|
+
|
|
166
|
+
beforeEach(() => {
|
|
167
|
+
vueWrapper = shallowMount(AmeliproCheckboxGroup, { props: requiredPropValues() })
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('should have the default class', () => {
|
|
171
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
172
|
+
.toBe('amelipro-checkbox-group__wrapper')
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it('should update class when pills is true', async () => {
|
|
176
|
+
await vueWrapper.setProps({ pills: true })
|
|
177
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
178
|
+
.toBe('amelipro-checkbox-group__wrapper mt-2')
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it('should update class when fullHorizontal is true', async () => {
|
|
182
|
+
await vueWrapper.setProps({ fullHorizontal: true })
|
|
183
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
184
|
+
.toBe('amelipro-checkbox-group__wrapper mt-1 mt-md-0')
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it('should update class when fullHorizontal and pills are true', async () => {
|
|
188
|
+
await vueWrapper.setProps({ fullHorizontal: true, pills: true })
|
|
189
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
190
|
+
.toBe('amelipro-checkbox-group__wrapper mt-2')
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('should update class when horizontal is true', async () => {
|
|
194
|
+
await vueWrapper.setProps({ horizontal: true })
|
|
195
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
196
|
+
.toBe('amelipro-checkbox-group__wrapper')
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
it('should update class when horizontal and pills are true', async () => {
|
|
200
|
+
await vueWrapper.setProps({ horizontal: true, pills: true })
|
|
201
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__wrapper').attributes('class'))
|
|
202
|
+
.toBe('amelipro-checkbox-group__wrapper mt-2')
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
describe('Checkbox group list', () => {
|
|
207
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproCheckboxGroup>>
|
|
208
|
+
|
|
209
|
+
beforeEach(() => {
|
|
210
|
+
vueWrapper = shallowMount(AmeliproCheckboxGroup, { props: requiredPropValues() })
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
it('should have the default class', () => {
|
|
214
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
215
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list flex-column')
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
it('should update class when pills is true', async () => {
|
|
219
|
+
await vueWrapper.setProps({ pills: true })
|
|
220
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
221
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list')
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it('should update class when fullHorizontal is true', async () => {
|
|
225
|
+
await vueWrapper.setProps({ fullHorizontal: true })
|
|
226
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
227
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list flex-column flex-md-row align-md-center')
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
it('should update class when fullHorizontal and pills are true', async () => {
|
|
231
|
+
await vueWrapper.setProps({ fullHorizontal: true, pills: true })
|
|
232
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
233
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list flex-md-row align-md-center')
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('should update class when horizontal is true', async () => {
|
|
237
|
+
await vueWrapper.setProps({ horizontal: true })
|
|
238
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
239
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list flex-column flex-md-row align-md-center')
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('should update class when horizontal and pills are true', async () => {
|
|
243
|
+
await vueWrapper.setProps({ horizontal: true, pills: true })
|
|
244
|
+
expect(vueWrapper.find('.amelipro-checkbox-group__list').attributes('class'))
|
|
245
|
+
.toBe('d-flex flex-wrap list-style-none amelipro-checkbox-group__list flex-md-row align-md-center')
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
describe('classes', () => {
|
|
251
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproCheckboxGroup>>
|
|
252
|
+
|
|
253
|
+
beforeEach(() => {
|
|
254
|
+
vueWrapper = shallowMount(AmeliproCheckboxGroup, {
|
|
255
|
+
props: {
|
|
256
|
+
...requiredPropValues(),
|
|
257
|
+
modelValue: modifiedPropValues().modelValue,
|
|
258
|
+
},
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
it('should update checkbox label classes', async () => {
|
|
263
|
+
const labelWrappers = vueWrapper.findAll('.amelipro-checkbox-group__item-input .checkbox-label')
|
|
264
|
+
expect(labelWrappers.at(0)?.attributes('class')).toContain('text-ap-grey-darken-1')
|
|
265
|
+
|
|
266
|
+
await vueWrapper.setProps({ disabled: true })
|
|
267
|
+
expect(labelWrappers.at(0)?.attributes('class')).toContain('text-ap-grey')
|
|
268
|
+
|
|
269
|
+
await vueWrapper.setProps({ disabled: false, ariaRequired: true })
|
|
270
|
+
await vueWrapper.findAll('.amelipro-checkbox-group__item-input').at(1)?.trigger('click')
|
|
271
|
+
await vueWrapper.findAll('.amelipro-checkbox-group__item-input').at(2)?.trigger('click')
|
|
272
|
+
expect(labelWrappers.at(1)?.attributes('class')).toContain('checkbox-label text-ap-red amelipro-checkbox-group__item-label-span-error')
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
it('should update checkbox label classes with pills version', async () => {
|
|
276
|
+
await vueWrapper.setProps({ pills: true })
|
|
277
|
+
const labelWrappers = vueWrapper.findAll('.amelipro-checkbox-group__item-input .checkbox-label')
|
|
278
|
+
expect(labelWrappers.at(0)?.attributes('class')).toContain('text-ap-blue-darken-1')
|
|
279
|
+
|
|
280
|
+
await vueWrapper.setProps({ disabled: true })
|
|
281
|
+
expect(labelWrappers.at(0)?.attributes('class')).toContain('text-ap-grey-darken-1')
|
|
282
|
+
|
|
283
|
+
await vueWrapper.setProps({ disabled: false, ariaRequired: true })
|
|
284
|
+
await vueWrapper.findAll('.amelipro-checkbox-group__item-input').at(1)?.trigger('click')
|
|
285
|
+
await vueWrapper.findAll('.amelipro-checkbox-group__item-input').at(2)?.trigger('click')
|
|
286
|
+
expect(labelWrappers.at(0)?.attributes('class')).toContain('checkbox-label text-ap-red amelipro-checkbox-group__item-label-span-error')
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
describe.todo('Setting props should update props or attributes of inner components')
|
|
291
|
+
|
|
292
|
+
// TODO: n'a pas le comportement attendu, probablement à cause de slotSubItem (ne réagit pas aux changements de props ?)
|
|
293
|
+
describe.skip('Slots', () => {
|
|
294
|
+
const vueWrapper = mount(AmeliproCheckboxGroup, {
|
|
295
|
+
attachTo: attachToApp(),
|
|
296
|
+
props: requiredPropValues(),
|
|
297
|
+
slots: {
|
|
298
|
+
'subItem-0': '<p>subItem 0</p>',
|
|
299
|
+
'subItem-1': '<p>subItem 1</p>',
|
|
300
|
+
},
|
|
301
|
+
// stubs: { AmeliproMessage },
|
|
302
|
+
})
|
|
303
|
+
const inputWrappers = () => vueWrapper.findAll('.amelipro-checkbox-group__item__label input')
|
|
304
|
+
|
|
305
|
+
it('should test slots and aria-controls', async () => {
|
|
306
|
+
const subItemsWrapper = (index: number) => vueWrapper.find(`#test-id-subitem-${index}`)
|
|
307
|
+
|
|
308
|
+
// Default state
|
|
309
|
+
expect(subItemsWrapper(0).exists()).toBe(false)
|
|
310
|
+
expect(inputWrappers().at(0)?.attributes('aria-controls')).toBe('uniqueId-subitem-0')
|
|
311
|
+
|
|
312
|
+
// test case for item with slot but fullHorizontal or Horizontal is true
|
|
313
|
+
await vueWrapper.setProps({ fullHorizontal: true })
|
|
314
|
+
// => slotSubItem = false => no sub-items, no aria-controls
|
|
315
|
+
expect(subItemsWrapper(0).exists()).toBe(false)
|
|
316
|
+
// expect(inputWrappers().at(0)?.attributes('aria-controls')).toBeUndefined(); // => Ne retourne pas la valeur attendue
|
|
317
|
+
|
|
318
|
+
// test case for checked item with slot
|
|
319
|
+
await vueWrapper.setProps({ fullHorizontal: false })
|
|
320
|
+
expect(subItemsWrapper(0).exists()).toBe(true)
|
|
321
|
+
expect(inputWrappers().at(0)?.attributes('aria-controls')).toBe('test-id-subitem-0')
|
|
322
|
+
// test case for item which is not checked
|
|
323
|
+
expect(subItemsWrapper(1).exists()).toBe(false)
|
|
324
|
+
expect(inputWrappers().at(1)?.attributes('aria-controls')).toBe('test-id-subitem-1')
|
|
325
|
+
// test case for item without slot
|
|
326
|
+
expect(subItemsWrapper(2).exists()).toBe(false)
|
|
327
|
+
expect(inputWrappers().at(2)?.attributes('aria-controls')).toBeUndefined()
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
// TODO: n'a pas le comportement attendu, probablement à cause de slotSubItem (ne réagit pas aux changements de props ?)
|
|
332
|
+
describe.skip('attributes', () => {
|
|
333
|
+
const vueWrapper = shallowMount(AmeliproCheckboxGroup, {
|
|
334
|
+
props: modifiedPropValues(),
|
|
335
|
+
slots: {
|
|
336
|
+
'subItem-0': '<p>subItem 0</p>',
|
|
337
|
+
'subItem-1': '<p>subItem 1</p>',
|
|
338
|
+
},
|
|
339
|
+
})
|
|
340
|
+
const inputWrappers = () => vueWrapper.findAll('.amelipro-checkbox-group__item__label input')
|
|
341
|
+
|
|
342
|
+
it('should test aria-expanded value', () => {
|
|
343
|
+
// test case for item slot opened
|
|
344
|
+
expect(inputWrappers().at(0)?.attributes('aria-expanded')).toBe('true')
|
|
345
|
+
// test case for item slot closed
|
|
346
|
+
expect(inputWrappers().at(1)?.attributes('aria-expanded')).toBe('false')
|
|
347
|
+
// test case for item without slot
|
|
348
|
+
expect(inputWrappers().at(2)?.attributes('aria-expanded')).toBe(undefined)
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
// skip this because there is an error "Cannot read property 'addApp' of null" we don't know where is this property 'addApp'
|
|
353
|
+
// we tested with console.log and it seems to work well but the error is still here
|
|
354
|
+
describe.skip('errors', () => {
|
|
355
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproCheckboxGroup>>
|
|
356
|
+
let inputWrappers: DOMWrapper<HTMLInputElement>[]
|
|
357
|
+
|
|
358
|
+
beforeEach(() => {
|
|
359
|
+
vueWrapper = shallowMount(AmeliproCheckboxGroup, {
|
|
360
|
+
props: modifiedPropValues(),
|
|
361
|
+
slots: {
|
|
362
|
+
'subItem-0': '<p>subItem 0</p>',
|
|
363
|
+
'subItem-1': '<p>subItem 1</p>',
|
|
364
|
+
},
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
inputWrappers = vueWrapper.findAll('.amelipro-checkbox-group__item__label input')
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
it('should display error message (single)', async () => {
|
|
371
|
+
let componentWrapper = vueWrapper.findComponent(AmeliproMessage)
|
|
372
|
+
expect(componentWrapper.exists()).toBe(false)
|
|
373
|
+
|
|
374
|
+
await vueWrapper.setProps({ ariaRequired: true })
|
|
375
|
+
|
|
376
|
+
inputWrappers.at(1)?.trigger('input')
|
|
377
|
+
inputWrappers.at(2)?.trigger('input')
|
|
378
|
+
await vueWrapper.vm.$nextTick()
|
|
379
|
+
expect(vueWrapper.emitted('change:selected')).toStrictEqual([
|
|
380
|
+
[[{
|
|
381
|
+
description: 'the item description 3',
|
|
382
|
+
disabled: false,
|
|
383
|
+
isChecked: true,
|
|
384
|
+
label: 'the item label 3',
|
|
385
|
+
value: 'the-item-value-3',
|
|
386
|
+
}]],
|
|
387
|
+
[[]],
|
|
388
|
+
])
|
|
389
|
+
componentWrapper = vueWrapper.findComponent(AmeliproMessage)
|
|
390
|
+
|
|
391
|
+
expect(inputWrappers.at(0)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 1')
|
|
392
|
+
expect(inputWrappers.at(1)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 2')
|
|
393
|
+
expect(inputWrappers.at(2)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 3')
|
|
394
|
+
expect(componentWrapper.exists()).toBe(true)
|
|
395
|
+
expect(componentWrapper.find('.mb-0').text()).toBe('Sélection obligatoire')
|
|
396
|
+
})
|
|
397
|
+
|
|
398
|
+
it('should display error message (multiple)', async () => {
|
|
399
|
+
let componentWrapper = vueWrapper.findComponent(AmeliproMessage)
|
|
400
|
+
expect(componentWrapper.exists()).toBe(false)
|
|
401
|
+
|
|
402
|
+
await vueWrapper.setProps({ multipleRequired: true })
|
|
403
|
+
|
|
404
|
+
inputWrappers.at(1)?.trigger('input')
|
|
405
|
+
await vueWrapper.vm.$nextTick()
|
|
406
|
+
|
|
407
|
+
expect(vueWrapper.emitted('change:selected')).toStrictEqual([[{
|
|
408
|
+
description: 'the item description 3',
|
|
409
|
+
disabled: false,
|
|
410
|
+
isChecked: true,
|
|
411
|
+
label: 'the item label 3',
|
|
412
|
+
value: 'the-item-value-3',
|
|
413
|
+
}]])
|
|
414
|
+
componentWrapper = vueWrapper.findComponent(AmeliproMessage)
|
|
415
|
+
|
|
416
|
+
expect(inputWrappers.at(0)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 1')
|
|
417
|
+
expect(inputWrappers.at(1)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 2')
|
|
418
|
+
expect(inputWrappers.at(2)?.attributes('aria-describedby')).toBe('the-group-id-error the item description 3')
|
|
419
|
+
expect(componentWrapper.exists()).toBe(true)
|
|
420
|
+
expect(componentWrapper.find('.mb-0').text()).toBe('Vous devez cocher au moins deux options')
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
})
|