@cnamts/synapse 1.0.11 → 1.0.13
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-QEfKOz0P.js → DateFilter-_EFzsvvM.js} +1 -1
- package/dist/{NumberFilter-C0h7gVzp.js → NumberFilter-CUxEbKJh.js} +1 -1
- package/dist/{PeriodFilter-8dVrKjju.js → PeriodFilter-D5ueqtKy.js} +1 -1
- package/dist/{SelectFilter-BI3QGbqb.js → SelectFilter-BciBNydy.js} +1 -1
- package/dist/{TextFilter-UOp1hcPp.js → TextFilter-DMN_WAQB.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordion.d.ts +7 -3
- package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/AmeliproAccordionTemplate.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +2 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +7 -3
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +50 -68
- package/dist/components/Amelipro/AmeliproCard/AmeliproCard.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIcon/AmeliproIcon.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +5 -5
- package/dist/components/Amelipro/AmeliproMultipleFoldingCard/AmeliproMultipleFoldingCard.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproNumberedCard/AmeliproNumberedCard.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +24 -32
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +36 -48
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +50 -68
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +50 -68
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +0 -4
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +12 -16
- package/dist/components/Captcha/Captcha.d.ts +68 -0
- package/dist/components/Captcha/CaptchaAlert.d.ts +13 -0
- package/dist/components/Captcha/CaptchaBase.d.ts +55 -0
- package/dist/components/Captcha/CaptchaBtn.d.ts +12 -0
- package/dist/components/Captcha/CaptchaForm.d.ts +16 -0
- package/dist/components/Captcha/CaptchaImg.d.ts +12 -0
- package/dist/components/Captcha/CaptchaInformation.d.ts +20 -0
- package/dist/components/Captcha/captchaApi.d.ts +41 -0
- package/dist/components/Captcha/icons/volumeUp.d.ts +2 -0
- package/dist/components/Captcha/locales.d.ts +35 -0
- package/dist/components/Captcha/types.d.ts +2 -0
- package/dist/components/ChipList/ChipList.d.ts +2 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +14 -14
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +5 -5
- package/dist/components/Customs/SyForm/SyForm.d.ts +6 -3
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +12 -16
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +96 -68
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +63 -38
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +23 -27
- package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +2 -1
- package/dist/components/DatePicker/tests/setup.d.ts +816 -520
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +10 -10
- package/dist/components/NirField/NirField.d.ts +31 -34
- package/dist/components/NirField/locales.d.ts +1 -3
- package/dist/components/PasswordField/PasswordField.d.ts +2 -0
- package/dist/components/PeriodField/PeriodField.d.ts +192 -128
- package/dist/components/PhoneField/PhoneField.d.ts +13 -17
- package/dist/components/SearchListField/SearchListField.d.ts +5 -5
- package/dist/components/SyTextArea/SyTextArea.d.ts +0 -4
- 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 +5 -5
- package/dist/components/Tables/common/types.d.ts +4 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -4
- package/dist/components/Tables/common/useTableCheckbox.d.ts +10 -6
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/validation/useFormValidation.d.ts +10 -0
- package/dist/composables/validation/useValidatable.d.ts +10 -2
- package/dist/design-system-v3.js +126 -125
- package/dist/design-system-v3.umd.cjs +265 -265
- package/dist/main-DISHlqcd.js +34217 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/overrides/_forms.scss +2 -0
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.stories.ts +7 -4
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/AmeliproAccordionFrieze.vue +1 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/__tests__/__snapshots__/AmeliproAccordionFrieze.spec.ts.snap +574 -112
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +5 -2
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +2 -1
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +6 -3
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +5 -2
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +2 -1
- 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/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/AmeliproFooter/AmeliproFooter.vue +6 -7
- package/src/components/Amelipro/AmeliproFooter/__tests__/AmeliproFooter.spec.ts +787 -0
- package/src/components/Amelipro/AmeliproFooter/__tests__/__snapshots__/AmeliproFooter.spec.ts.snap +318 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/AmeliproHeaderBrandSection.spec.ts +167 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +100 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/__tests__/AmeliproHeaderBar.spec.ts +312 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/__tests__/__snapshots__/AmeliproHeaderBar.spec.ts.snap +98 -0
- package/src/components/Amelipro/AmeliproHeader/__tests__/AmeliproHeader.spec.ts +361 -0
- package/src/components/Amelipro/AmeliproHeader/__tests__/__snapshots__/AmeliproHeader.spec.ts.snap +22 -0
- package/src/components/Amelipro/AmeliproMenu/__tests__/AmeliproMenu.spec.ts +168 -0
- package/src/components/Amelipro/AmeliproMenu/__tests__/__snapshots__/AmeliproMenu.spec.ts.snap +295 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenuBtn/__tests__/AmeliproDropdownMenuBtn.spec.ts +128 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenuBtn/__tests__/__snapshots__/AmeliproDropdownMenuBtn.spec.ts.snap +67 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/__tests__/AmeliproDropdownMenu.spec.ts +266 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/__tests__/__snapshots__/AmeliproDropdownMenu.spec.ts.snap +134 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingMenuBtn/__tests__/AmeliproMessagingMenuBtn.spec.ts +72 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingMenuBtn/__tests__/__snapshots__/AmeliproMessagingMenuBtn.spec.ts.snap +71 -0
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +12 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.stories.ts +81 -9
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +139 -61
- package/src/components/Amelipro/AmeliproTable/__tests__/AmeliproTable.spec.ts +10 -0
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +361 -187
- package/src/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/src/components/Captcha/Captcha.mdx +72 -0
- package/src/components/Captcha/Captcha.stories.ts +276 -0
- package/src/components/Captcha/Captcha.vue +325 -0
- package/src/components/Captcha/CaptchaAlert.vue +60 -0
- package/src/components/Captcha/CaptchaBase.vue +219 -0
- package/src/components/Captcha/CaptchaBtn.vue +35 -0
- package/src/components/Captcha/CaptchaForm.vue +58 -0
- package/src/components/Captcha/CaptchaImg.vue +41 -0
- package/src/components/Captcha/CaptchaInformation.vue +64 -0
- package/src/components/Captcha/captchaApi.ts +111 -0
- package/src/components/Captcha/icons/volumeUp.vue +11 -0
- package/src/components/Captcha/locales.ts +35 -0
- package/src/components/Captcha/readme.md +5 -0
- package/src/components/Captcha/tests/Captcha.spec.ts +298 -0
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +716 -0
- package/src/components/Captcha/types.ts +2 -0
- package/src/components/Customs/Selects/SySelect/SySelect.vue +2 -2
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +4 -0
- package/src/components/Customs/SyForm/SyForm.stories.ts +133 -23
- package/src/components/Customs/SyForm/SyForm.vue +17 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +29 -7
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +32 -9
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +154 -18
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +2 -2
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +35 -4
- 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/navigation.regression.spec.ts +74 -0
- package/src/components/DatePicker/tests/navigation.simple.spec.ts +137 -0
- package/src/components/NirField/NirField.stories.ts +85 -2
- package/src/components/NirField/NirField.vue +55 -18
- package/src/components/NirField/locales.ts +1 -3
- package/src/components/PasswordField/PasswordField.vue +39 -7
- package/src/components/PhoneField/PhoneField.vue +43 -10
- package/src/components/RangeField/tests/RangeField.spec.ts +0 -3
- 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 +18 -3
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -0
- 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 +18 -3
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +63 -0
- package/src/components/Tables/common/SyTablePagination.vue +10 -8
- package/src/components/Tables/common/types.ts +4 -0
- package/src/components/Tables/common/usePagination.ts +11 -20
- package/src/components/Tables/common/useTableCheckbox.ts +23 -11
- package/src/components/index.ts +1 -0
- package/src/composables/validation/AvecVosComposants.mdx.old +1 -1
- package/src/composables/validation/FormValidation.stories.ts.old +5 -5
- package/src/composables/validation/useFormValidation.ts +46 -8
- package/src/composables/validation/useValidatable.ts +19 -8
- 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/dist/main-DyEOPqqn.js +0 -33329
- package/src/components/Amelipro/AmeliproCheckbox/tests/AmeliproCheckbox.spec.ts +0 -19
- package/src/components/Amelipro/AmeliproCheckbox/tests/__snapshots__/AmeliproCheckbox.spec.ts.snap +0 -40
- package/src/components/Amelipro/AmeliproCheckboxGroup/tests/AmeliproCheckboxGroup.spec.ts +0 -46
- package/src/components/Amelipro/AmeliproChips/tests/AmeliproChips.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproChips/tests/__snapshots__/AmeliproChips.spec.ts.snap +0 -97
- package/src/components/Amelipro/AmeliproDialog/tests/AmeliproDialog.spec.ts +0 -24
- package/src/components/Amelipro/AmeliproDialog/tests/__snapshots__/AmeliproDialog.spec.ts.snap +0 -134
- package/src/components/Amelipro/AmeliproDisclosure/tests/AmeliproDisclosure.spec.ts +0 -19
- package/src/components/Amelipro/AmeliproDisclosure/tests/__snapshots__/AmeliproDisclosure.spec.ts.snap +0 -104
- package/src/components/Amelipro/AmeliproFooter/tests/AmeliproFooter.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproFooter/tests/__snapshots__/AmeliproFooter.spec.ts.snap +0 -432
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/tests/AmeliproHeaderBrandSection.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/tests/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +0 -131
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/tests/AmeliproHeaderBar.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/tests/__snapshots__/AmeliproHeaderBar.spec.ts.snap +0 -172
- package/src/components/Amelipro/AmeliproHeader/tests/AmeliproHeader.spec.ts +0 -159
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +0 -841
- package/src/components/Amelipro/AmeliproMenu/tests/AmeliproMenu.spec.ts +0 -85
- package/src/components/Amelipro/AmeliproMenu/tests/__snapshots__/AmeliproMenu.spec.ts.snap +0 -537
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenuBtn/tests/AmeliproDropdownMenuBtn.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenuBtn/tests/__snapshots__/AmeliproDropdownMenuBtn.spec.ts.snap +0 -56
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/tests/AmeliproDropdownMenu.spec.ts +0 -28
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/tests/__snapshots__/AmeliproDropdownMenu.spec.ts.snap +0 -300
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingMenuBtn/tests/AmeliproMessagingMenuBtn.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingMenuBtn/tests/__snapshots__/AmeliproMessagingMenuBtn.spec.ts.snap +0 -89
- package/src/components/BackBtn/tests/__snapshots__/BackBtn.spec.ts.snap +0 -45
- package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +0 -1270
- package/src/stories/Demarrer/CreerUneIssue.mdx +0 -67
- package/src/stories/Demarrer/components.stories.ts +0 -25
|
@@ -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
|
+
})
|