@cnamts/synapse 1.0.6 → 1.0.8
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-BlOpwEVq.js → DateFilter-DkqG0pmr.js} +1 -1
- package/dist/{NumberFilter-BPUXE4wY.js → NumberFilter-Ck7AwD39.js} +1 -1
- package/dist/{PeriodFilter-B2yx329_.js → PeriodFilter-LRI6YpgU.js} +1 -1
- package/dist/{SelectFilter-CedKn1oV.js → SelectFilter-DPc70Jk7.js} +1 -1
- package/dist/{TextFilter-DkhJjRtR.js → TextFilter-DRQL7uD8.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.d.ts +116 -0
- package/dist/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +220 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +68 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.d.ts +204 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +26 -26
- package/dist/components/Amelipro/AmeliproBadge/AmeliproBadge.d.ts +59 -0
- package/dist/components/Amelipro/AmeliproBtn/AmeliproBtn.d.ts +3 -3
- package/dist/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +214 -0
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproCarousel/types.d.ts +7 -0
- package/dist/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.d.ts +125 -0
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproResultList/AmeliproResultList.d.ts +164 -0
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +27 -27
- package/dist/components/Amelipro/AmeliproStateTile/AmeliproStateTile.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +32 -32
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +7 -7
- package/dist/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTooltips/AmeliproTooltips.d.ts +2 -2
- package/dist/components/ChipList/ChipList.d.ts +4 -0
- package/dist/components/ChipList/locales.d.ts +4 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +8 -8
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +329 -1296
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +0 -1
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +2 -0
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +71 -0
- package/dist/components/Customs/SyTabs/config.d.ts +17 -0
- package/dist/components/Customs/SyTabs/types.d.ts +11 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +9 -9
- package/dist/components/DataList/DataList.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +4811 -240
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +52 -33
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +23 -10
- package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +1 -0
- package/dist/components/DatePicker/composables/useTodayButton.d.ts +1 -0
- package/dist/components/DialogBox/DialogBox.d.ts +219 -0
- package/dist/components/HeaderLoading/HeaderLoading.d.ts +27 -0
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +110 -3
- package/dist/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.d.ts +19 -1
- package/dist/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/components/NirField/NirField.d.ts +18 -18
- package/dist/components/PeriodField/PeriodField.d.ts +10766 -1620
- package/dist/components/PhoneField/PhoneField.d.ts +1866 -2
- package/dist/components/PhoneField/indicatifs.d.ts +1 -0
- package/dist/components/PhoneField/locales.d.ts +1 -0
- package/dist/components/RangeField/RangeField.d.ts +1 -1
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/SubHeader/SubHeader.d.ts +8 -0
- package/dist/components/SubHeader/locales.d.ts +1 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +6 -6
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -4
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -4
- package/dist/components/Tables/common/SyTablePagination.d.ts +333 -1296
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +2 -2
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/design-system-v3.js +173 -164
- package/dist/design-system-v3.umd.cjs +286 -263
- package/dist/{main-BXPFSAB4.js → main-DXMoMtj5.js} +13176 -11457
- package/dist/services/NotificationService.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/amelipro/icons.ts +38 -11
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.stories.ts +135 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.vue +107 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/__snapshots__/AmeliproAccordionGroup.spec.ts.snap +513 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.mdx +16 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +300 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +288 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/AmeliproAccordionList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +1712 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.mdx +19 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +68 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +66 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.vue +145 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/AmeliproAccordionResultTemplate.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/__snapshots__/AmeliproAccordionResultTemplate.spec.ts.snap +127 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/AmeliproAccordionResult.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/__snapshots__/AmeliproAccordionResult.spec.ts.snap +123 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +273 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +275 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/AmeliproAccordionResultList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +1593 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.mdx +15 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.stories.ts +54 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.vue +76 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/AmeliproBadge.spec.ts +20 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/__snapshots__/AmeliproBadge.spec.ts.snap +19 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.mdx +15 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.stories.ts +191 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +263 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.vue +93 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/AmeliproCarouselItem.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/__snapshots__/AmeliproCarouselItem.spec.ts.snap +43 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/AmeliproCarousel.spec.ts +40 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/__snapshots__/AmeliproCarousel.spec.ts.snap +342 -0
- package/src/components/Amelipro/AmeliproCarousel/types.d.ts +8 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.mdx +18 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.stories.ts +67 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.vue +233 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/AmeliproClickableTile.spec.ts +21 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/__snapshots__/AmeliproClickableTile.spec.ts.snap +140 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +7 -1
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproIcon/iconList.ts +6 -0
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.mdx +15 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +264 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +231 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/AmeliproResultList.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +434 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +6 -5
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +23 -26
- package/src/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.stories.ts +2 -2
- package/src/components/ChipList/Accessibilite.stories.ts +4 -0
- package/src/components/ChipList/ChipList.vue +185 -42
- package/src/components/ChipList/locales.ts +4 -2
- package/src/components/ChipList/tests/chipList.spec.ts +7 -4
- package/src/components/Customs/Selects/SelectOverview.mdx +34 -66
- package/src/components/Customs/Selects/SyBtnSelect/SyBtnSelect.stories.ts +10 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.mdx +3 -0
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +14 -0
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +14 -6
- package/src/components/Customs/Selects/SySelect/SySelect.vue +268 -205
- package/src/components/Customs/Selects/SySelect/composables/tests/useSySelectKeyboard.spec.ts +0 -10
- package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +0 -5
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +184 -25
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +3 -1
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +165 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +28 -9
- package/src/components/Customs/SyTabs/Accessibilite.mdx +309 -0
- package/src/components/Customs/SyTabs/SyTabs.mdx +117 -0
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +354 -0
- package/src/components/Customs/SyTabs/SyTabs.vue +413 -0
- package/src/components/Customs/SyTabs/config.ts +17 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +425 -0
- package/src/components/Customs/SyTabs/types.ts +12 -0
- package/src/components/Customs/SyTextField/SyTextField.mdx +3 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +142 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -16
- package/src/components/DataList/DataList.vue +47 -49
- package/src/components/DataListGroup/DataListGroup.vue +1 -1
- package/src/components/DataListItem/DataListItem.vue +67 -63
- package/src/components/DataListItem/tests/DataListItem.spec.ts +2 -2
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +3 -3
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +49 -13
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +412 -649
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +215 -0
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.mdx +2 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +281 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +17 -4
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +111 -18
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +238 -6
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +716 -757
- package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +4 -4
- package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +17 -10
- package/src/components/DatePicker/composables/useDateInputEditing.ts +52 -22
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +18 -4
- package/src/components/DatePicker/composables/useTodayButton.ts +13 -1
- package/src/components/DatePicker/utils/dateFormattingUtils.ts +79 -14
- package/src/components/DialogBox/DialogBox.stories.ts +12 -0
- package/src/components/DialogBox/DialogBox.vue +16 -11
- package/src/components/DialogBox/tests/DialogBox.spec.ts +22 -0
- package/src/components/HeaderLoading/Accessibilite.mdx +429 -8
- package/src/components/HeaderLoading/Accessibilite.stories.ts +4 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +59 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +17 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +91 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +37 -1
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +284 -21
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +2 -2
- package/src/components/NirField/NirField.mdx +3 -0
- package/src/components/NirField/NirField.vue +10 -1
- package/src/components/NirField/tests/NirField.spec.ts +81 -0
- package/src/components/NotificationBar/NotificationBar.stories.ts +128 -2
- package/src/components/NotificationBar/NotificationBar.vue +16 -1
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +65 -0
- package/src/components/PasswordField/PasswordField.mdx +3 -0
- package/src/components/PeriodField/PeriodField.mdx +2 -0
- package/src/components/PeriodField/PeriodField.stories.ts +195 -0
- package/src/components/PhoneField/Accessibilite.stories.ts +4 -0
- package/src/components/PhoneField/PhoneField.mdx +3 -1
- package/src/components/PhoneField/PhoneField.stories.ts +285 -1
- package/src/components/PhoneField/PhoneField.vue +228 -95
- package/src/components/PhoneField/indicatifs.ts +102 -102
- package/src/components/PhoneField/locales.ts +1 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +419 -2
- package/src/components/SkipLink/SkipLink.vue +3 -31
- package/src/components/SkipLink/tests/skipLink.spec.ts +0 -21
- package/src/components/SubHeader/Accessibilite.stories.ts +8 -0
- package/src/components/SubHeader/SubHeader.mdx +1 -0
- package/src/components/SubHeader/SubHeader.stories.ts +179 -60
- package/src/components/SubHeader/SubHeader.vue +45 -15
- package/src/components/SubHeader/locales.ts +1 -0
- package/src/components/SyAlert/SyAlert.vue +6 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +3 -10
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +242 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +29 -10
- package/src/components/Tables/SyTable/SyTable.mdx +3 -10
- package/src/components/Tables/SyTable/SyTable.stories.ts +242 -0
- package/src/components/Tables/SyTable/SyTable.vue +2 -0
- package/src/components/Tables/common/SyTablePagination.vue +13 -6
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +6 -1
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +157 -0
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/index.ts +9 -0
- package/src/composables/useFilterable/useFilterable.ts +10 -0
- package/src/designTokens/tokens/amelipro/apColors.ts +1 -1
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +3 -3
- package/src/services/NotificationService.ts +9 -0
- package/src/stories/Components/Components.stories.ts +1 -1
- package/src/stories/GuideDuDev/FormValidationGuide.mdx +342 -0
- package/src/stories/Templates/Templates.stories.ts +1 -1
- package/src/utils/functions/ameliproColors/ameliproColors.ts +1 -1
- package/dist/components/DataList/locales.d.ts +0 -3
- package/src/components/DataList/locales.ts +0 -3
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +0 -266
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
1
|
+
import { mount, VueWrapper } from '@vue/test-utils'
|
|
2
2
|
import PhoneField from '../PhoneField.vue'
|
|
3
|
-
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'
|
|
4
4
|
import { createVuetify } from 'vuetify'
|
|
5
5
|
import * as components from 'vuetify/components'
|
|
6
6
|
import * as directives from 'vuetify/directives'
|
|
@@ -11,6 +11,10 @@ const vuetify = createVuetify({
|
|
|
11
11
|
directives,
|
|
12
12
|
})
|
|
13
13
|
describe('PhoneField', () => {
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
vi.clearAllMocks()
|
|
16
|
+
document.body.innerHTML = ''
|
|
17
|
+
})
|
|
14
18
|
it('renders correctly with default props', () => {
|
|
15
19
|
const wrapper = mount(PhoneField, {
|
|
16
20
|
global: {
|
|
@@ -496,6 +500,166 @@ describe('PhoneField', () => {
|
|
|
496
500
|
expect(dialCode.displayText).toContain('+44')
|
|
497
501
|
})
|
|
498
502
|
|
|
503
|
+
it('should display helpText below by default when helpText is provided', async () => {
|
|
504
|
+
const wrapper = mount(PhoneField, {
|
|
505
|
+
global: {
|
|
506
|
+
plugins: [vuetify],
|
|
507
|
+
},
|
|
508
|
+
props: {
|
|
509
|
+
modelValue: '',
|
|
510
|
+
required: true,
|
|
511
|
+
helpText: 'Saisissez votre numéro de téléphone au format 01 23 45 67 89',
|
|
512
|
+
},
|
|
513
|
+
})
|
|
514
|
+
|
|
515
|
+
await wrapper.vm.$nextTick()
|
|
516
|
+
|
|
517
|
+
// Check that helpText is displayed by default when provided
|
|
518
|
+
const helpTextDiv = wrapper.find('.help-text-below')
|
|
519
|
+
expect(helpTextDiv.exists()).toBe(true)
|
|
520
|
+
expect(helpTextDiv.text()).toBe('Saisissez votre numéro de téléphone au format 01 23 45 67 89')
|
|
521
|
+
expect(helpTextDiv.classes()).toContain('help-text-below')
|
|
522
|
+
})
|
|
523
|
+
|
|
524
|
+
it('should display helpText below even when field has valid value', async () => {
|
|
525
|
+
const wrapper = mount(PhoneField, {
|
|
526
|
+
global: {
|
|
527
|
+
plugins: [vuetify],
|
|
528
|
+
},
|
|
529
|
+
props: {
|
|
530
|
+
modelValue: '01 23 45 67 89',
|
|
531
|
+
required: true,
|
|
532
|
+
helpText: 'Saisissez votre numéro de téléphone au format 01 23 45 67 89',
|
|
533
|
+
},
|
|
534
|
+
})
|
|
535
|
+
|
|
536
|
+
await wrapper.vm.$nextTick()
|
|
537
|
+
|
|
538
|
+
// Check that helpText is displayed even when there are no errors
|
|
539
|
+
const helpTextDiv = wrapper.find('.help-text-below')
|
|
540
|
+
expect(helpTextDiv.exists()).toBe(true)
|
|
541
|
+
expect(helpTextDiv.text()).toBe('Saisissez votre numéro de téléphone au format 01 23 45 67 89')
|
|
542
|
+
})
|
|
543
|
+
|
|
544
|
+
it('should not display helpText below when helpText is not provided', async () => {
|
|
545
|
+
const wrapper = mount(PhoneField, {
|
|
546
|
+
global: {
|
|
547
|
+
plugins: [vuetify],
|
|
548
|
+
},
|
|
549
|
+
props: {
|
|
550
|
+
modelValue: '',
|
|
551
|
+
required: true,
|
|
552
|
+
// No helpText prop
|
|
553
|
+
},
|
|
554
|
+
})
|
|
555
|
+
|
|
556
|
+
// Trigger validation by blurring the field
|
|
557
|
+
const phoneInput = wrapper.find('input[type="tel"]')
|
|
558
|
+
await phoneInput.trigger('blur')
|
|
559
|
+
await wrapper.vm.$nextTick()
|
|
560
|
+
|
|
561
|
+
// Check that helpText div is not displayed when helpText is not provided
|
|
562
|
+
const helpTextDiv = wrapper.find('.help-text-below')
|
|
563
|
+
expect(helpTextDiv.exists()).toBe(false)
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
it('should apply default autocomplete attributes correctly', async () => {
|
|
567
|
+
const wrapper = mount(PhoneField, {
|
|
568
|
+
global: {
|
|
569
|
+
plugins: [vuetify],
|
|
570
|
+
},
|
|
571
|
+
props: {
|
|
572
|
+
modelValue: '',
|
|
573
|
+
withCountryCode: true,
|
|
574
|
+
},
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
await wrapper.vm.$nextTick()
|
|
578
|
+
|
|
579
|
+
// Check that phone input has default tel-national autocomplete
|
|
580
|
+
const phoneInput = wrapper.find('input[type="tel"]')
|
|
581
|
+
expect(phoneInput.attributes('autocomplete')).toBe('tel-national')
|
|
582
|
+
|
|
583
|
+
// Check that country code select has default tel-country-code autocomplete
|
|
584
|
+
const selectInput = wrapper.find('.custom-select input')
|
|
585
|
+
expect(selectInput.attributes('autocomplete')).toBe('tel-country-code')
|
|
586
|
+
})
|
|
587
|
+
|
|
588
|
+
it('should apply custom autocomplete attributes when provided', async () => {
|
|
589
|
+
const wrapper = mount(PhoneField, {
|
|
590
|
+
global: {
|
|
591
|
+
plugins: [vuetify],
|
|
592
|
+
},
|
|
593
|
+
props: {
|
|
594
|
+
modelValue: '',
|
|
595
|
+
withCountryCode: true,
|
|
596
|
+
autocompleteCountryCode: 'tel-country-code',
|
|
597
|
+
autocompletePhone: 'tel-extension',
|
|
598
|
+
},
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
await wrapper.vm.$nextTick()
|
|
602
|
+
|
|
603
|
+
// Check that phone input has custom autocomplete
|
|
604
|
+
const phoneInput = wrapper.find('input[type="tel"]')
|
|
605
|
+
expect(phoneInput.attributes('autocomplete')).toBe('tel-extension')
|
|
606
|
+
|
|
607
|
+
// Check that country code select has custom autocomplete
|
|
608
|
+
const selectInput = wrapper.find('.custom-select input')
|
|
609
|
+
expect(selectInput.attributes('autocomplete')).toBe('tel-country-code')
|
|
610
|
+
})
|
|
611
|
+
|
|
612
|
+
it('should verify autocomplete attributes are present in the actual DOM', async () => {
|
|
613
|
+
const wrapper = mount(PhoneField, {
|
|
614
|
+
global: {
|
|
615
|
+
plugins: [vuetify],
|
|
616
|
+
},
|
|
617
|
+
props: {
|
|
618
|
+
modelValue: '',
|
|
619
|
+
withCountryCode: true,
|
|
620
|
+
autocompleteCountryCode: 'tel-country-code',
|
|
621
|
+
autocompletePhone: 'tel-national',
|
|
622
|
+
},
|
|
623
|
+
})
|
|
624
|
+
|
|
625
|
+
await wrapper.vm.$nextTick()
|
|
626
|
+
|
|
627
|
+
// Verify tel input has correct autocomplete
|
|
628
|
+
const telInput = wrapper.find('input[type="tel"]')
|
|
629
|
+
expect(telInput.exists()).toBe(true)
|
|
630
|
+
const telAutocomplete = telInput.attributes('autocomplete')
|
|
631
|
+
expect(telAutocomplete).toBe('tel-national')
|
|
632
|
+
|
|
633
|
+
// Verify country select input has correct autocomplete
|
|
634
|
+
const selectInput = wrapper.find('.custom-select input')
|
|
635
|
+
expect(selectInput.exists()).toBe(true)
|
|
636
|
+
const selectAutocomplete = selectInput.attributes('autocomplete')
|
|
637
|
+
expect(selectAutocomplete).toBe('tel-country-code')
|
|
638
|
+
})
|
|
639
|
+
|
|
640
|
+
it('should apply autocomplete to phone field only when no country code', async () => {
|
|
641
|
+
const wrapper = mount(PhoneField, {
|
|
642
|
+
global: {
|
|
643
|
+
plugins: [vuetify],
|
|
644
|
+
},
|
|
645
|
+
props: {
|
|
646
|
+
modelValue: '',
|
|
647
|
+
withCountryCode: false,
|
|
648
|
+
autocompletePhone: 'tel',
|
|
649
|
+
},
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
await wrapper.vm.$nextTick()
|
|
653
|
+
|
|
654
|
+
// Check that phone input has autocomplete
|
|
655
|
+
const phoneInput = wrapper.find('input[type="tel"]')
|
|
656
|
+
expect(phoneInput.attributes('autocomplete')).toBe('tel')
|
|
657
|
+
|
|
658
|
+
// Check that country code select doesn't exist
|
|
659
|
+
const selectInput = wrapper.find('.custom-select input')
|
|
660
|
+
expect(selectInput.exists()).toBe(false)
|
|
661
|
+
})
|
|
662
|
+
|
|
499
663
|
it('works correctly with standard indicatifs imported from indicatifs.ts', async () => {
|
|
500
664
|
const franceIndicatif = indicatifs.find(ind => ind.country === 'France')
|
|
501
665
|
expect(franceIndicatif).toBeDefined()
|
|
@@ -568,4 +732,257 @@ describe('PhoneField', () => {
|
|
|
568
732
|
|
|
569
733
|
expect(wrapperNotReadonly.vm.hasError).toBe(true)
|
|
570
734
|
})
|
|
735
|
+
|
|
736
|
+
// Tests pour les formats d'affichage avec abréviations encapsulées
|
|
737
|
+
describe('Display formats with abbreviations', () => {
|
|
738
|
+
let wrapper: VueWrapper<InstanceType<typeof PhoneField>>
|
|
739
|
+
|
|
740
|
+
beforeEach(() => {
|
|
741
|
+
wrapper = mount(PhoneField, {
|
|
742
|
+
global: {
|
|
743
|
+
plugins: [vuetify],
|
|
744
|
+
},
|
|
745
|
+
props: {
|
|
746
|
+
withCountryCode: true,
|
|
747
|
+
displayFormat: 'code',
|
|
748
|
+
},
|
|
749
|
+
})
|
|
750
|
+
})
|
|
751
|
+
|
|
752
|
+
it('formats display text as code by default', () => {
|
|
753
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
754
|
+
const firstItem = select.props('items')[0]
|
|
755
|
+
expect(firstItem.displayText).toBe(firstItem.code)
|
|
756
|
+
})
|
|
757
|
+
|
|
758
|
+
it('formats display text as code-abbreviation', async () => {
|
|
759
|
+
await wrapper.setProps({ displayFormat: 'code-abbreviation' })
|
|
760
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
761
|
+
const firstItem = select.props('items')[0]
|
|
762
|
+
const expectedCountry = firstItem.countryFr || firstItem.country
|
|
763
|
+
expect(firstItem.displayText).toBe(`${firstItem.code} (<abbr title="${expectedCountry}">${firstItem.abbreviation}</abbr>)`)
|
|
764
|
+
})
|
|
765
|
+
|
|
766
|
+
it('formats display text as code-country', async () => {
|
|
767
|
+
await wrapper.setProps({ displayFormat: 'code-country' })
|
|
768
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
769
|
+
const firstItem = select.props('items')[0]
|
|
770
|
+
const expectedCountry = firstItem.countryFr || firstItem.country
|
|
771
|
+
expect(firstItem.displayText).toBe(`${firstItem.code} ${expectedCountry}`)
|
|
772
|
+
})
|
|
773
|
+
|
|
774
|
+
it('formats display text as country', async () => {
|
|
775
|
+
await wrapper.setProps({ displayFormat: 'country' })
|
|
776
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
777
|
+
const firstItem = select.props('items')[0]
|
|
778
|
+
const expectedCountry = firstItem.countryFr || firstItem.country
|
|
779
|
+
expect(firstItem.displayText).toBe(expectedCountry)
|
|
780
|
+
})
|
|
781
|
+
|
|
782
|
+
it('formats display text as abbreviation', async () => {
|
|
783
|
+
await wrapper.setProps({ displayFormat: 'abbreviation' })
|
|
784
|
+
const select = wrapper.findComponent({ name: 'SySelect' })
|
|
785
|
+
const firstItem = select.props('items')[0]
|
|
786
|
+
const expectedCountry = firstItem.countryFr || firstItem.country
|
|
787
|
+
expect(firstItem.displayText).toBe(`<abbr title="${expectedCountry}">${firstItem.abbreviation}</abbr>`)
|
|
788
|
+
})
|
|
789
|
+
})
|
|
790
|
+
|
|
791
|
+
// Tests pour l'initialisation avec un dialCode par défaut
|
|
792
|
+
describe('Default dialCode initialization', () => {
|
|
793
|
+
it('initializes with a default dialCode object', async () => {
|
|
794
|
+
const defaultDialCode = { code: '+44', abbreviation: 'UK', country: 'United Kingdom', phoneLength: 11, mask: '#### ### ####' }
|
|
795
|
+
const wrapper = mount(PhoneField, {
|
|
796
|
+
global: {
|
|
797
|
+
plugins: [vuetify],
|
|
798
|
+
},
|
|
799
|
+
props: {
|
|
800
|
+
withCountryCode: true,
|
|
801
|
+
dialCodeModel: defaultDialCode,
|
|
802
|
+
},
|
|
803
|
+
})
|
|
804
|
+
|
|
805
|
+
await wrapper.vm.$nextTick()
|
|
806
|
+
|
|
807
|
+
// Vérifier que le dialCode est correctement initialisé
|
|
808
|
+
expect(wrapper.vm.dialCode).toBeDefined()
|
|
809
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
810
|
+
expect((wrapper.vm.dialCode as any).code).toBe('+44')
|
|
811
|
+
// Vérifier que le masque est appliqué (le format exact peut varier)
|
|
812
|
+
expect(wrapper.vm.phoneMask).toBeDefined()
|
|
813
|
+
// Vérifier que le counter est défini selon la phoneLength
|
|
814
|
+
expect(wrapper.vm.counter).toBeDefined()
|
|
815
|
+
})
|
|
816
|
+
|
|
817
|
+
it('initializes with a default dialCode string', async () => {
|
|
818
|
+
const wrapper = mount(PhoneField, {
|
|
819
|
+
global: {
|
|
820
|
+
plugins: [vuetify],
|
|
821
|
+
},
|
|
822
|
+
props: {
|
|
823
|
+
withCountryCode: true,
|
|
824
|
+
dialCodeModel: '+33',
|
|
825
|
+
},
|
|
826
|
+
})
|
|
827
|
+
|
|
828
|
+
await wrapper.vm.$nextTick()
|
|
829
|
+
|
|
830
|
+
// Vérifier que le dialCode est correctement initialisé
|
|
831
|
+
expect(wrapper.vm.dialCode).toBe('+33')
|
|
832
|
+
})
|
|
833
|
+
})
|
|
834
|
+
|
|
835
|
+
// Tests pour la désactivation de la gestion des erreurs
|
|
836
|
+
describe('Error handling', () => {
|
|
837
|
+
it('displays error messages by default when validation fails', async () => {
|
|
838
|
+
const wrapper = mount(PhoneField, {
|
|
839
|
+
global: {
|
|
840
|
+
plugins: [vuetify],
|
|
841
|
+
},
|
|
842
|
+
props: {
|
|
843
|
+
required: true,
|
|
844
|
+
modelValue: '',
|
|
845
|
+
isValidatedOnBlur: true,
|
|
846
|
+
},
|
|
847
|
+
})
|
|
848
|
+
|
|
849
|
+
// Déclencher la validation
|
|
850
|
+
await wrapper.vm.validateOnSubmit()
|
|
851
|
+
|
|
852
|
+
// Vérifier que les erreurs sont affichées
|
|
853
|
+
expect(wrapper.vm.hasError).toBe(true)
|
|
854
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
855
|
+
expect((wrapper.vm as any).errors.length).toBeGreaterThan(0)
|
|
856
|
+
|
|
857
|
+
// Vérifier que les erreurs sont passées au composant SyTextField
|
|
858
|
+
const textField = wrapper.findComponent({ name: 'SyTextField' })
|
|
859
|
+
expect(textField.props('errorMessages')).toBeTruthy()
|
|
860
|
+
})
|
|
861
|
+
|
|
862
|
+
it('initializes with disableErrorHandling prop', async () => {
|
|
863
|
+
const wrapper = mount(PhoneField, {
|
|
864
|
+
global: {
|
|
865
|
+
plugins: [vuetify],
|
|
866
|
+
},
|
|
867
|
+
props: {
|
|
868
|
+
required: true,
|
|
869
|
+
modelValue: '',
|
|
870
|
+
isValidatedOnBlur: true,
|
|
871
|
+
disableErrorHandling: true,
|
|
872
|
+
},
|
|
873
|
+
})
|
|
874
|
+
|
|
875
|
+
// Vérifier que la propriété disableErrorHandling est bien prise en compte
|
|
876
|
+
// en vérifiant qu'elle est passée lors de l'initialisation du composable useValidation
|
|
877
|
+
expect(wrapper.vm.validation).toBeDefined()
|
|
878
|
+
})
|
|
879
|
+
})
|
|
880
|
+
|
|
881
|
+
// Tests pour la validation dans un contexte de formulaire
|
|
882
|
+
describe('Form validation', () => {
|
|
883
|
+
it('validates as part of a form submission', async () => {
|
|
884
|
+
const wrapper = mount(PhoneField, {
|
|
885
|
+
global: {
|
|
886
|
+
plugins: [vuetify],
|
|
887
|
+
},
|
|
888
|
+
props: {
|
|
889
|
+
required: true,
|
|
890
|
+
modelValue: '',
|
|
891
|
+
},
|
|
892
|
+
})
|
|
893
|
+
|
|
894
|
+
// Simuler une soumission de formulaire avec un champ vide
|
|
895
|
+
const isValid = await wrapper.vm.validateOnSubmit()
|
|
896
|
+
expect(isValid).toBe(false)
|
|
897
|
+
|
|
898
|
+
// Mettre à jour la valeur et valider à nouveau
|
|
899
|
+
await wrapper.setProps({ modelValue: '0123456789' })
|
|
900
|
+
const isValidAfterUpdate = await wrapper.vm.validateOnSubmit()
|
|
901
|
+
expect(isValidAfterUpdate).toBe(true)
|
|
902
|
+
})
|
|
903
|
+
|
|
904
|
+
it('validates country code as part of form submission', async () => {
|
|
905
|
+
const wrapper = mount(PhoneField, {
|
|
906
|
+
global: {
|
|
907
|
+
plugins: [vuetify],
|
|
908
|
+
},
|
|
909
|
+
props: {
|
|
910
|
+
required: true,
|
|
911
|
+
modelValue: '0123456789',
|
|
912
|
+
withCountryCode: true,
|
|
913
|
+
countryCodeRequired: true,
|
|
914
|
+
},
|
|
915
|
+
})
|
|
916
|
+
|
|
917
|
+
// Sans code pays, la validation échoue
|
|
918
|
+
const isValidWithoutCountry = await wrapper.vm.validateOnSubmit()
|
|
919
|
+
expect(isValidWithoutCountry).toBe(false)
|
|
920
|
+
|
|
921
|
+
// Ajouter un code pays et valider à nouveau
|
|
922
|
+
wrapper.vm.dialCode = { code: '+33', abbreviation: 'FR', country: 'France', phoneLength: 10, mask: '## ## ## ## ##' }
|
|
923
|
+
await wrapper.vm.$nextTick()
|
|
924
|
+
|
|
925
|
+
const isValidWithCountry = await wrapper.vm.validateOnSubmit()
|
|
926
|
+
expect(isValidWithCountry).toBe(true)
|
|
927
|
+
})
|
|
928
|
+
})
|
|
929
|
+
|
|
930
|
+
// Tests pour la gestion des indicatifs personnalisés
|
|
931
|
+
describe('Custom indicatifs', () => {
|
|
932
|
+
it('merges custom indicatifs with standard ones by default', () => {
|
|
933
|
+
const customIndicatifs = [{ code: '+999', abbreviation: 'XX', country: 'Test Country', phoneLength: 8, mask: '## ## ## ##' }]
|
|
934
|
+
const wrapper = mount(PhoneField, {
|
|
935
|
+
global: {
|
|
936
|
+
plugins: [vuetify],
|
|
937
|
+
},
|
|
938
|
+
props: {
|
|
939
|
+
customIndicatifs,
|
|
940
|
+
withCountryCode: true,
|
|
941
|
+
},
|
|
942
|
+
})
|
|
943
|
+
|
|
944
|
+
// Vérifier que les indicatifs personnalisés sont ajoutés aux indicatifs standards
|
|
945
|
+
expect(wrapper.vm.mergedDialCodes.length).toBe(indicatifs.length + customIndicatifs.length)
|
|
946
|
+
expect(wrapper.vm.mergedDialCodes).toContainEqual(customIndicatifs[0])
|
|
947
|
+
})
|
|
948
|
+
|
|
949
|
+
it('uses only custom indicatifs when useCustomIndicatifsOnly is true', () => {
|
|
950
|
+
const customIndicatifs = [{ code: '+999', abbreviation: 'XX', country: 'Test Country', phoneLength: 8, mask: '## ## ## ##' }]
|
|
951
|
+
const wrapper = mount(PhoneField, {
|
|
952
|
+
global: {
|
|
953
|
+
plugins: [vuetify],
|
|
954
|
+
},
|
|
955
|
+
props: {
|
|
956
|
+
customIndicatifs,
|
|
957
|
+
useCustomIndicatifsOnly: true,
|
|
958
|
+
withCountryCode: true,
|
|
959
|
+
},
|
|
960
|
+
})
|
|
961
|
+
|
|
962
|
+
// Vérifier que seuls les indicatifs personnalisés sont utilisés
|
|
963
|
+
expect(wrapper.vm.mergedDialCodes.length).toBe(customIndicatifs.length)
|
|
964
|
+
expect(wrapper.vm.mergedDialCodes).toEqual(customIndicatifs)
|
|
965
|
+
})
|
|
966
|
+
|
|
967
|
+
it('updates phone mask and counter based on selected custom indicatif', async () => {
|
|
968
|
+
const customIndicatifs = [{ code: '+999', abbreviation: 'XX', country: 'Test Country', phoneLength: 8, mask: '## ## ## ##' }]
|
|
969
|
+
const wrapper = mount(PhoneField, {
|
|
970
|
+
global: {
|
|
971
|
+
plugins: [vuetify],
|
|
972
|
+
},
|
|
973
|
+
props: {
|
|
974
|
+
customIndicatifs,
|
|
975
|
+
withCountryCode: true,
|
|
976
|
+
},
|
|
977
|
+
})
|
|
978
|
+
|
|
979
|
+
// Sélectionner l'indicatif personnalisé
|
|
980
|
+
wrapper.vm.dialCode = customIndicatifs[0]
|
|
981
|
+
await wrapper.vm.$nextTick()
|
|
982
|
+
|
|
983
|
+
// Vérifier que le masque et le counter sont mis à jour
|
|
984
|
+
expect(wrapper.vm.counter).toBe(8)
|
|
985
|
+
expect(wrapper.vm.phoneMask).toBe('## ## ## ##')
|
|
986
|
+
})
|
|
987
|
+
})
|
|
571
988
|
})
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { locales } from './locales'
|
|
3
|
-
import {
|
|
4
|
-
import { getCurrentInstance } from 'vue'
|
|
5
|
-
import type { Router } from 'vue-router'
|
|
3
|
+
import { ref } from 'vue'
|
|
6
4
|
|
|
7
5
|
withDefaults(
|
|
8
6
|
defineProps<{
|
|
@@ -17,34 +15,8 @@
|
|
|
17
15
|
|
|
18
16
|
const skipLinkSpan = ref<HTMLLinkElement | null>(null)
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!instance) return
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- we test the existence of Nuxt
|
|
25
|
-
const nuxtApp = (instance?.appContext.app as any)?.$nuxt
|
|
26
|
-
let router: undefined | Router
|
|
27
|
-
if (nuxtApp && nuxtApp.$router) {
|
|
28
|
-
router = nuxtApp.$router as Router
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- we test the existence of vue-router
|
|
32
|
-
const vueRouter = (instance.appContext.app.config.globalProperties as any)?.$router
|
|
33
|
-
if (vueRouter) {
|
|
34
|
-
router = vueRouter as Router
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (router && router.afterEach) {
|
|
38
|
-
router.afterEach((to, from, fail) => {
|
|
39
|
-
if (fail) return
|
|
40
|
-
if (to.path === from.path) return
|
|
41
|
-
nextTick(() => {
|
|
42
|
-
const link = document.querySelector('a.sy-skip-link') as HTMLAnchorElement
|
|
43
|
-
if (link) link.focus()
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
})
|
|
18
|
+
// La ref du skip link est disponible si besoin
|
|
19
|
+
const skipLink = ref<HTMLAnchorElement | null>(null)
|
|
48
20
|
</script>
|
|
49
21
|
|
|
50
22
|
<template>
|
|
@@ -28,27 +28,6 @@ describe('SkipLink', () => {
|
|
|
28
28
|
expect(wrapper.html()).toMatchSnapshot()
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
it('focuses the skip link on route change', async () => {
|
|
32
|
-
// Monter le composant
|
|
33
|
-
mount(SkipLink, {
|
|
34
|
-
global: {
|
|
35
|
-
plugins: [router],
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
// Espionner querySelector et focus
|
|
40
|
-
const linkElement = document.createElement('a')
|
|
41
|
-
const focusSpy = vi.spyOn(linkElement, 'focus')
|
|
42
|
-
vi.spyOn(document, 'querySelector').mockImplementation(() => linkElement)
|
|
43
|
-
|
|
44
|
-
// Déclencher le changement de route
|
|
45
|
-
await router.push('/about')
|
|
46
|
-
await router.isReady()
|
|
47
|
-
await new Promise(resolve => setTimeout(resolve, 0))
|
|
48
|
-
|
|
49
|
-
expect(focusSpy).toHaveBeenCalled()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
31
|
it('accepte des props personnalisées', () => {
|
|
53
32
|
const customLabel = 'Accéder au contenu'
|
|
54
33
|
const customTarget = '#content'
|
|
@@ -158,6 +158,14 @@ export const Legende: StoryObj = {
|
|
|
158
158
|
Problèmes relevés par Tanaguru
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
|
+
<div class="mt-4">
|
|
162
|
+
<p>Rapport d’audit manuel : <a href="/audits/SubHeader.xlsx" style="color:#0C41BD;">Voir le
|
|
163
|
+
rapport</a></p>
|
|
164
|
+
<p style="color: grey; font-size: 14px">Correctifs associés (<a
|
|
165
|
+
href="https://github.com/assurance-maladie-digital/design-system-v3/pull/942" target="_blank"
|
|
166
|
+
style="color:#0C41BD;"
|
|
167
|
+
>issue #942</a>)</p>
|
|
168
|
+
</div>
|
|
161
169
|
</div>
|
|
162
170
|
`,
|
|
163
171
|
}
|
|
@@ -26,6 +26,7 @@ import { SubHeader } from '@cnamts/synapse'
|
|
|
26
26
|
back-btn-text="Back"
|
|
27
27
|
title-text="Paul Dupont"
|
|
28
28
|
sub-title-text="1 69 08 75 125 456 75"
|
|
29
|
+
sub-title-text-accessible-name="Numéro de sécurité sociale de Paul Dupont : 1 69 08 75 125 456 75"
|
|
29
30
|
/>
|
|
30
31
|
</template>
|
|
31
32
|
`} />
|