@cnamts/synapse 1.0.11 → 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-QEfKOz0P.js → DateFilter-DoCcOfDW.js} +1 -1
- package/dist/{NumberFilter-C0h7gVzp.js → NumberFilter-9uR8uo6p.js} +1 -1
- package/dist/{PeriodFilter-8dVrKjju.js → PeriodFilter-CxN5ini7.js} +1 -1
- package/dist/{SelectFilter-BI3QGbqb.js → SelectFilter-bfxipgvt.js} +1 -1
- package/dist/{TextFilter-UOp1hcPp.js → TextFilter-yCnWcmW2.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordion.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +2 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
- 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 +6 -6
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +14 -14
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +3 -3
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +40 -4
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +46 -4
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +5 -10
- package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +2 -1
- package/dist/components/DatePicker/tests/setup.d.ts +368 -8
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +6 -6
- package/dist/components/NirField/NirField.d.ts +4 -2
- package/dist/components/PeriodField/PeriodField.d.ts +80 -0
- package/dist/components/SearchListField/SearchListField.d.ts +3 -3
- 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 +3 -3
- 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/design-system-v3.js +1 -1
- package/dist/design-system-v3.umd.cjs +127 -127
- package/dist/{main-DyEOPqqn.js → main-DMXtXK3y.js} +9984 -9855
- 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/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/Customs/SyTextField/SyTextField.vue +27 -5
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +31 -8
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +44 -12
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +2 -2
- 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/navigation.regression.spec.ts +74 -0
- package/src/components/DatePicker/tests/navigation.simple.spec.ts +137 -0
- package/src/components/NirField/NirField.stories.ts +11 -2
- package/src/components/NirField/NirField.vue +21 -9
- 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/composables/validation/AvecVosComposants.mdx.old +1 -1
- package/src/composables/validation/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/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/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,257 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { VueWrapper, mount } from '@vue/test-utils'
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import AmeliproDialog from '../AmeliproDialog.vue'
|
|
5
|
+
import type { ComponentProps } from 'vue-component-type-helpers'
|
|
6
|
+
import type { ExpectedPropOptions } from '@tests/types'
|
|
7
|
+
import TestHelper from '@tests/helpers/TestHelper'
|
|
8
|
+
|
|
9
|
+
const expectedPropOptions: ExpectedPropOptions<typeof AmeliproDialog> = {
|
|
10
|
+
attach: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false,
|
|
13
|
+
},
|
|
14
|
+
cancelBtnLabel: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'Annuler',
|
|
17
|
+
},
|
|
18
|
+
eager: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
fullscreen: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
hiddenCancelBtn: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
labelledby: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
mainContentMaxHeight: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: undefined,
|
|
37
|
+
},
|
|
38
|
+
mainContentMinHeight: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '150px',
|
|
41
|
+
},
|
|
42
|
+
modelValue: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
noClickOutside: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
noFooter: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
persistent: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
title: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: undefined,
|
|
61
|
+
},
|
|
62
|
+
uniqueId: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
validationBtnLabel: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'Valider',
|
|
69
|
+
},
|
|
70
|
+
width: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '800px',
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Values pour les props "required"
|
|
77
|
+
const requiredPropValues = (): ComponentProps<typeof AmeliproDialog> => ({
|
|
78
|
+
labelledby: 'required-labelledby',
|
|
79
|
+
uniqueId: 'required-uniqueid',
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
// Valeurs pour les props "modified"
|
|
83
|
+
const modifiedPropValues = (): ComponentProps<typeof AmeliproDialog> => ({
|
|
84
|
+
cancelBtnLabel: 'Modified cancel btn label',
|
|
85
|
+
fullscreen: true,
|
|
86
|
+
hiddenCancelBtn: true,
|
|
87
|
+
labelledby: 'modified-labelledby',
|
|
88
|
+
mainContentMaxHeight: '300px',
|
|
89
|
+
mainContentMinHeight: '200px',
|
|
90
|
+
modelValue: true,
|
|
91
|
+
noClickOutside: true,
|
|
92
|
+
noFooter: false,
|
|
93
|
+
persistent: true,
|
|
94
|
+
title: 'Modified title',
|
|
95
|
+
uniqueId: 'modified-uniqueid',
|
|
96
|
+
validationBtnLabel: 'Modified validation btn label',
|
|
97
|
+
width: '700px',
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const testHelper = new TestHelper(AmeliproDialog)
|
|
101
|
+
testHelper.setExpectedPropOptions(expectedPropOptions)
|
|
102
|
+
.setRequiredPropValues(requiredPropValues)
|
|
103
|
+
.setModifiedPropValues(modifiedPropValues)
|
|
104
|
+
|
|
105
|
+
// Mock global MutationObserver pour éviter la boucle infinie dans les tests unitaires
|
|
106
|
+
class NoopMutationObserver {
|
|
107
|
+
observe = vi.fn()
|
|
108
|
+
disconnect = vi.fn()
|
|
109
|
+
takeRecords = vi.fn(() => [])
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
global.MutationObserver = NoopMutationObserver as any
|
|
113
|
+
|
|
114
|
+
describe('AmeliproDialog', () => {
|
|
115
|
+
describe('Snapshots', () => {
|
|
116
|
+
testHelper.snapshots()
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
describe('Properties', () => {
|
|
120
|
+
testHelper.properties()
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
describe('Slots', () => {
|
|
124
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproDialog>>
|
|
125
|
+
|
|
126
|
+
it('renders default slot content', () => {
|
|
127
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
128
|
+
global: {
|
|
129
|
+
stubs: {
|
|
130
|
+
AmeliproBtn: true,
|
|
131
|
+
AmeliproIconBtn: true,
|
|
132
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
props: requiredPropValues(),
|
|
136
|
+
slots: { default: '<div id="slot-content">Slot Content</div>' },
|
|
137
|
+
})
|
|
138
|
+
expect(vueWrapper.find('#slot-content').exists()).toBe(true)
|
|
139
|
+
expect(vueWrapper.find('#slot-content').text()).toBe('Slot Content')
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it('renders header slot content', () => {
|
|
143
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
144
|
+
global: {
|
|
145
|
+
stubs: {
|
|
146
|
+
AmeliproBtn: true,
|
|
147
|
+
AmeliproIconBtn: true,
|
|
148
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
props: requiredPropValues(),
|
|
152
|
+
slots: { header: '<div id="header-slot">Header Slot</div>' },
|
|
153
|
+
})
|
|
154
|
+
expect(vueWrapper.find('#header-slot').exists()).toBe(true)
|
|
155
|
+
expect(vueWrapper.find('#header-slot').text()).toBe('Header Slot')
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it('renders footer slot content', () => {
|
|
159
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
160
|
+
global: {
|
|
161
|
+
stubs: {
|
|
162
|
+
AmeliproBtn: true,
|
|
163
|
+
AmeliproIconBtn: true,
|
|
164
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
props: { ...requiredPropValues(), noFooter: false },
|
|
168
|
+
slots: { footer: '<div id="footer-slot">Footer Slot</div>' },
|
|
169
|
+
})
|
|
170
|
+
expect(vueWrapper.find('#footer-slot').exists()).toBe(true)
|
|
171
|
+
expect(vueWrapper.find('#footer-slot').text()).toBe('Footer Slot')
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
describe('Setting props should update attributes of inner tags', () => {
|
|
176
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproDialog>>
|
|
177
|
+
|
|
178
|
+
beforeEach(() => {
|
|
179
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
180
|
+
global: {
|
|
181
|
+
stubs: {
|
|
182
|
+
AmeliproBtn: true,
|
|
183
|
+
AmeliproIconBtn: true,
|
|
184
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
props: { ...requiredPropValues(), noFooter: false },
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('prop uniqueId sets attribute id on root dialog element', async () => {
|
|
192
|
+
expect(vueWrapper.find('.dialog').attributes('id')).toBe(testHelper.default('uniqueId'))
|
|
193
|
+
const { uniqueId } = modifiedPropValues()
|
|
194
|
+
await vueWrapper.setProps({ uniqueId })
|
|
195
|
+
expect(vueWrapper.find('.dialog').attributes('id')).toBe(testHelper.modified('uniqueId'))
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it('prop uniqueId sets attribute id on header/content/footer', async () => {
|
|
199
|
+
expect(vueWrapper.find('.dialog__header').attributes('id')).toBe(`${testHelper.default('uniqueId')}-header`)
|
|
200
|
+
expect(vueWrapper.find('.dialog__content').attributes('id')).toBe(`${testHelper.default('uniqueId')}-content`)
|
|
201
|
+
expect(vueWrapper.find('.dialog__footer').attributes('id')).toBe(`${testHelper.default('uniqueId')}-footer`)
|
|
202
|
+
|
|
203
|
+
const { uniqueId } = modifiedPropValues()
|
|
204
|
+
await vueWrapper.setProps({ uniqueId })
|
|
205
|
+
expect(vueWrapper.find('.dialog__header').attributes('id')).toBe(`${testHelper.modified('uniqueId')}-header`)
|
|
206
|
+
expect(vueWrapper.find('.dialog__content').attributes('id')).toBe(`${testHelper.modified('uniqueId')}-content`)
|
|
207
|
+
expect(vueWrapper.find('.dialog__footer').attributes('id')).toBe(`${testHelper.modified('uniqueId')}-footer`)
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
describe('Setting props should update props or attributes of inner components', () => {
|
|
212
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproDialog>>
|
|
213
|
+
|
|
214
|
+
beforeEach(() => {
|
|
215
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
216
|
+
props: { ...requiredPropValues(), hiddenCancelBtn: false, noFooter: false },
|
|
217
|
+
global: {
|
|
218
|
+
stubs: {
|
|
219
|
+
// AmeliproBtn: { template: '<button class="dialog__cancel-btn"><slot /></button>' },
|
|
220
|
+
AmeliproIconBtn: true,
|
|
221
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it('prop cancelBtnLabel sets AmeliproBtn cancel label', async () => {
|
|
228
|
+
expect(vueWrapper.find('.dialog__cancel-btn').text()).toBe(testHelper.default('cancelBtnLabel'))
|
|
229
|
+
const { cancelBtnLabel } = modifiedPropValues()
|
|
230
|
+
await vueWrapper.setProps({ cancelBtnLabel })
|
|
231
|
+
expect(vueWrapper.find('.dialog__cancel-btn').text()).toBe(testHelper.modified('cancelBtnLabel'))
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
describe('Affichage conditionnel du footer', () => {
|
|
236
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproDialog>>
|
|
237
|
+
|
|
238
|
+
beforeEach(() => {
|
|
239
|
+
vueWrapper = mount(AmeliproDialog, {
|
|
240
|
+
props: requiredPropValues(),
|
|
241
|
+
global: {
|
|
242
|
+
stubs: {
|
|
243
|
+
AmeliproBtn: true,
|
|
244
|
+
AmeliproIconBtn: true,
|
|
245
|
+
VDialog: { template: '<div><slot /></div>' },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
it('prop noFooter sets footer visibility', async () => {
|
|
252
|
+
expect(vueWrapper.find('.dialog__footer').exists()).toBe(false)
|
|
253
|
+
await vueWrapper.setProps({ noFooter: false })
|
|
254
|
+
expect(vueWrapper.find('.dialog__footer').exists()).toBe(true)
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
})
|
package/src/components/Amelipro/AmeliproDialog/__tests__/__snapshots__/AmeliproDialog.spec.ts.snap
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`AmeliproDialog > Snapshots > renders the component with all properties filled in 1`] = `
|
|
4
|
+
<v-dialog-stub
|
|
5
|
+
absolute="false"
|
|
6
|
+
activatorprops="[object Object]"
|
|
7
|
+
attach="false"
|
|
8
|
+
class=""
|
|
9
|
+
closeonback="true"
|
|
10
|
+
closeoncontentclick="false"
|
|
11
|
+
contained="false"
|
|
12
|
+
disabled="false"
|
|
13
|
+
eager="false"
|
|
14
|
+
fullscreen="true"
|
|
15
|
+
location="bottom"
|
|
16
|
+
locationstrategy="static"
|
|
17
|
+
modelvalue="true"
|
|
18
|
+
noclickanimation="false"
|
|
19
|
+
openonhover="false"
|
|
20
|
+
origin="center center"
|
|
21
|
+
persistent="true"
|
|
22
|
+
retainfocus="true"
|
|
23
|
+
scrim="true"
|
|
24
|
+
scrollable="false"
|
|
25
|
+
scrollstrategy="none"
|
|
26
|
+
sticktotarget="false"
|
|
27
|
+
transition="[object Object]"
|
|
28
|
+
width="700px"
|
|
29
|
+
zindex="2400"
|
|
30
|
+
></v-dialog-stub>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`AmeliproDialog > Snapshots > renders the component with only required properties filled in 1`] = `
|
|
34
|
+
<v-dialog-stub
|
|
35
|
+
absolute="false"
|
|
36
|
+
activatorprops="[object Object]"
|
|
37
|
+
attach="false"
|
|
38
|
+
class="dialog-radius"
|
|
39
|
+
closeonback="true"
|
|
40
|
+
closeoncontentclick="false"
|
|
41
|
+
contained="false"
|
|
42
|
+
disabled="false"
|
|
43
|
+
eager="false"
|
|
44
|
+
fullscreen="false"
|
|
45
|
+
location="bottom"
|
|
46
|
+
locationstrategy="static"
|
|
47
|
+
modelvalue="false"
|
|
48
|
+
noclickanimation="false"
|
|
49
|
+
openonhover="false"
|
|
50
|
+
origin="center center"
|
|
51
|
+
persistent="false"
|
|
52
|
+
retainfocus="true"
|
|
53
|
+
scrim="true"
|
|
54
|
+
scrollable="false"
|
|
55
|
+
scrollstrategy="none"
|
|
56
|
+
sticktotarget="false"
|
|
57
|
+
transition="[object Object]"
|
|
58
|
+
width="800px"
|
|
59
|
+
zindex="2400"
|
|
60
|
+
></v-dialog-stub>
|
|
61
|
+
`;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type VueWrapper, shallowMount } from '@vue/test-utils'
|
|
2
|
+
import { beforeEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import AmeliproDisclosure from '../AmeliproDisclosure.vue'
|
|
4
|
+
import type { ComponentProps } from 'vue-component-type-helpers'
|
|
5
|
+
import type { ExpectedPropOptions } from '@tests/types'
|
|
6
|
+
import TestHelper from '@tests/helpers/TestHelper'
|
|
7
|
+
|
|
8
|
+
const expectedPropOptions: ExpectedPropOptions<typeof AmeliproDisclosure> = {
|
|
9
|
+
isOpen: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
uniqueId: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Values pour les props "required"
|
|
24
|
+
const requiredPropValues = (): ComponentProps<typeof AmeliproDisclosure> => ({
|
|
25
|
+
title: 'required-title',
|
|
26
|
+
uniqueId: 'required-unique-id',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// Valeurs pour les props "modified"
|
|
30
|
+
const modifiedPropValues = (): ComponentProps<typeof AmeliproDisclosure> => ({
|
|
31
|
+
isOpen: false,
|
|
32
|
+
title: 'Modified title',
|
|
33
|
+
uniqueId: 'modified-unique-id',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const testHelper = new TestHelper(AmeliproDisclosure)
|
|
37
|
+
testHelper.setExpectedPropOptions(expectedPropOptions)
|
|
38
|
+
.setRequiredPropValues(requiredPropValues)
|
|
39
|
+
.setModifiedPropValues(modifiedPropValues)
|
|
40
|
+
|
|
41
|
+
describe('AmeliproDisclosure', () => {
|
|
42
|
+
describe('Snapshots', () => {
|
|
43
|
+
testHelper.snapshots()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('Properties', () => {
|
|
47
|
+
testHelper.properties()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
describe('Setting props should update attributes of inner tags', () => {
|
|
51
|
+
let vueWrapper: VueWrapper<InstanceType<typeof AmeliproDisclosure>>
|
|
52
|
+
|
|
53
|
+
describe('root', () => {
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
vueWrapper = shallowMount(AmeliproDisclosure, { props: requiredPropValues() })
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('prop uniqueId sets attribute id', async () => {
|
|
59
|
+
expect(vueWrapper.attributes('id')).toBe(`${testHelper.default('uniqueId')}-container`)
|
|
60
|
+
|
|
61
|
+
const { uniqueId } = modifiedPropValues()
|
|
62
|
+
await vueWrapper.setProps({ uniqueId })
|
|
63
|
+
expect(vueWrapper.attributes('id')).toBe(`${testHelper.modified('uniqueId')}-container`)
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
describe('Setting props should update props or attributes of inner components', () => {
|
|
69
|
+
describe.skip('AmeliproBtn', () => {
|
|
70
|
+
// TODO: add tests for AmeliproBtn inner component
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe('Slots', () => {
|
|
75
|
+
describe.skip('#default', () => {
|
|
76
|
+
// TODO: add tests for default slot
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
})
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`AmeliproDisclosure > Snapshots > renders the component with all properties filled in 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
class="
|
|
6
|
+
amelipro-disclosure
|
|
7
|
+
mb-3
|
|
8
|
+
w-100
|
|
9
|
+
"
|
|
10
|
+
id="modified-unique-id-container"
|
|
11
|
+
>
|
|
12
|
+
<amelipro-btn-stub
|
|
13
|
+
aria-controls="modified-unique-id"
|
|
14
|
+
aria-expanded="false"
|
|
15
|
+
badge="false"
|
|
16
|
+
badgebgcolor="ap-pink"
|
|
17
|
+
badgecolor="ap-white"
|
|
18
|
+
bordered="false"
|
|
19
|
+
class="
|
|
20
|
+
amelipro-disclosure__btn
|
|
21
|
+
text-none
|
|
22
|
+
"
|
|
23
|
+
color="ap-blue-darken-1"
|
|
24
|
+
disabled="false"
|
|
25
|
+
hovercolor="ap-blue-darken-2"
|
|
26
|
+
hoverunderline="true"
|
|
27
|
+
iconbgcolor="transparent"
|
|
28
|
+
iconbordered="false"
|
|
29
|
+
iconleft="false"
|
|
30
|
+
infoblock="false"
|
|
31
|
+
minheight="2.5rem"
|
|
32
|
+
size="60px"
|
|
33
|
+
text="true"
|
|
34
|
+
textcolor="ap-white"
|
|
35
|
+
type="button"
|
|
36
|
+
underline="false"
|
|
37
|
+
uniqueid="modified-unique-id-open-close-btn"
|
|
38
|
+
></amelipro-btn-stub>
|
|
39
|
+
<div
|
|
40
|
+
class="amelipro-disclosure__content"
|
|
41
|
+
id="modified-unique-id"
|
|
42
|
+
style="display: none;"
|
|
43
|
+
></div>
|
|
44
|
+
</div>
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`AmeliproDisclosure > Snapshots > renders the component with only required properties filled in 1`] = `
|
|
48
|
+
<div
|
|
49
|
+
class="
|
|
50
|
+
amelipro-disclosure
|
|
51
|
+
mb-3
|
|
52
|
+
w-100
|
|
53
|
+
"
|
|
54
|
+
id="required-unique-id-container"
|
|
55
|
+
>
|
|
56
|
+
<amelipro-btn-stub
|
|
57
|
+
aria-controls="required-unique-id"
|
|
58
|
+
aria-expanded="false"
|
|
59
|
+
badge="false"
|
|
60
|
+
badgebgcolor="ap-pink"
|
|
61
|
+
badgecolor="ap-white"
|
|
62
|
+
bordered="false"
|
|
63
|
+
class="
|
|
64
|
+
amelipro-disclosure__btn
|
|
65
|
+
text-none
|
|
66
|
+
"
|
|
67
|
+
color="ap-blue-darken-1"
|
|
68
|
+
disabled="false"
|
|
69
|
+
hovercolor="ap-blue-darken-2"
|
|
70
|
+
hoverunderline="true"
|
|
71
|
+
iconbgcolor="transparent"
|
|
72
|
+
iconbordered="false"
|
|
73
|
+
iconleft="false"
|
|
74
|
+
infoblock="false"
|
|
75
|
+
minheight="2.5rem"
|
|
76
|
+
size="60px"
|
|
77
|
+
text="true"
|
|
78
|
+
textcolor="ap-white"
|
|
79
|
+
type="button"
|
|
80
|
+
underline="false"
|
|
81
|
+
uniqueid="required-unique-id-open-close-btn"
|
|
82
|
+
></amelipro-btn-stub>
|
|
83
|
+
<div
|
|
84
|
+
class="amelipro-disclosure__content"
|
|
85
|
+
id="required-unique-id"
|
|
86
|
+
style="display: none;"
|
|
87
|
+
></div>
|
|
88
|
+
</div>
|
|
89
|
+
`;
|
|
@@ -47,6 +47,16 @@ const meta = {
|
|
|
47
47
|
width: string;
|
|
48
48
|
maxWidth: string;
|
|
49
49
|
descriptionId?: string;
|
|
50
|
+
sort?: {
|
|
51
|
+
ascendant?: {
|
|
52
|
+
label: string,
|
|
53
|
+
disabled: boolean,
|
|
54
|
+
},
|
|
55
|
+
descendant?: {
|
|
56
|
+
label: string,
|
|
57
|
+
disabled: boolean,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
50
60
|
}>`,
|
|
51
61
|
},
|
|
52
62
|
},
|
|
@@ -560,7 +570,42 @@ export const PaginationEtTri: Story = {
|
|
|
560
570
|
name: 'Pagination et tri',
|
|
561
571
|
args: {
|
|
562
572
|
dataList,
|
|
563
|
-
headers
|
|
573
|
+
headers: [
|
|
574
|
+
{
|
|
575
|
+
align: 'left',
|
|
576
|
+
maxWidth: '25%',
|
|
577
|
+
minWidth: '20%',
|
|
578
|
+
name: 'name',
|
|
579
|
+
title: 'Nom',
|
|
580
|
+
width: '25%',
|
|
581
|
+
sort: {
|
|
582
|
+
ascendant: {
|
|
583
|
+
label: 'tri de A vers Z',
|
|
584
|
+
disabled: false,
|
|
585
|
+
},
|
|
586
|
+
descendant: {
|
|
587
|
+
label: 'tri de Z vers A',
|
|
588
|
+
disabled: false,
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
align: 'left',
|
|
594
|
+
maxWidth: '25%',
|
|
595
|
+
minWidth: '20%',
|
|
596
|
+
name: 'firstname',
|
|
597
|
+
title: 'Prénom',
|
|
598
|
+
width: '25%',
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
align: 'left',
|
|
602
|
+
maxWidth: '25%',
|
|
603
|
+
minWidth: '20%',
|
|
604
|
+
name: 'email',
|
|
605
|
+
title: 'E-mail',
|
|
606
|
+
width: '25%',
|
|
607
|
+
},
|
|
608
|
+
],
|
|
564
609
|
title: 'Tableau avec pagination et tri',
|
|
565
610
|
uniqueId: 'table-pagination-tri',
|
|
566
611
|
itemsToDisplayDesktop: 2,
|
|
@@ -597,6 +642,8 @@ export const PaginationEtTri: Story = {
|
|
|
597
642
|
pagination-select-label="Résultats par page"
|
|
598
643
|
pagination-select-placeholder="Sélectionner"
|
|
599
644
|
@change:sort-select="onSortChange"
|
|
645
|
+
@asc-sort="onSortAsc"
|
|
646
|
+
@desc-sort="onSortDesc"
|
|
600
647
|
/>
|
|
601
648
|
</template>
|
|
602
649
|
`,
|
|
@@ -608,7 +655,7 @@ import { ref, computed } from 'vue'
|
|
|
608
655
|
import { AmeliproTable } from '@cnamts/synapse'
|
|
609
656
|
|
|
610
657
|
const headers = [
|
|
611
|
-
{ align: 'left', maxWidth: '25%', minWidth: '20%', name: 'name', title: 'Nom', width: '25%' },
|
|
658
|
+
{ align: 'left', maxWidth: '25%', minWidth: '20%', name: 'name', title: 'Nom', width: '25%', sort: { ascendant: { label: 'Tri de A vers Z', disabled: false }, descedant: {label: 'Tri de Z vers A', disabled: false } } },
|
|
612
659
|
{ align: 'left', maxWidth: '25%', minWidth: '20%', name: 'firstname', title: 'Prénom', width: '25%' },
|
|
613
660
|
{ align: 'left', maxWidth: '25%', minWidth: '20%', name: 'email', title: 'E-mail', width: '25%' },
|
|
614
661
|
]
|
|
@@ -636,8 +683,19 @@ const sortedDataList = computed(() => {
|
|
|
636
683
|
function onSortChange(val: string) {
|
|
637
684
|
sortValue.value = val
|
|
638
685
|
}
|
|
639
|
-
|
|
640
|
-
|
|
686
|
+
|
|
687
|
+
function onSortAsc(event: Event, header: string) {
|
|
688
|
+
if (header === 'name') {
|
|
689
|
+
sortValue.value = 'name-asc'
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
function onSortDesc(event: Event, header: string) {
|
|
694
|
+
if (header === 'name') {
|
|
695
|
+
sortValue.value = 'name-desc'
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
</script>`,
|
|
641
699
|
},
|
|
642
700
|
],
|
|
643
701
|
},
|
|
@@ -658,7 +716,19 @@ function onSortChange(val: string) {
|
|
|
658
716
|
function onSortChange(val: string) {
|
|
659
717
|
sortValue.value = val
|
|
660
718
|
}
|
|
661
|
-
|
|
719
|
+
|
|
720
|
+
function onSortAsc(header: string) {
|
|
721
|
+
if (header === 'name') {
|
|
722
|
+
sortValue.value = 'name-asc'
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function onSortDesc(header: string) {
|
|
727
|
+
if (header === 'name') {
|
|
728
|
+
sortValue.value = 'name-desc'
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return { args, sortedDataList, onSortChange, onSortAsc, onSortDesc }
|
|
662
732
|
},
|
|
663
733
|
template: `
|
|
664
734
|
<p class="mb-2">Tableau avec pagination personnalisée et options de tri. Le tri est appliqué via l'événement <code>change:sort-select</code>.</p>
|
|
@@ -666,6 +736,8 @@ function onSortChange(val: string) {
|
|
|
666
736
|
v-bind="args"
|
|
667
737
|
:data-list="sortedDataList"
|
|
668
738
|
@change:sort-select="onSortChange"
|
|
739
|
+
@asc-sort="onSortAsc"
|
|
740
|
+
@desc-sort="onSortDesc"
|
|
669
741
|
/>
|
|
670
742
|
`,
|
|
671
743
|
}),
|
|
@@ -678,9 +750,9 @@ export const LargeurPersonnalisee: Story = {
|
|
|
678
750
|
headers,
|
|
679
751
|
title: 'Tableau largeur personnalisée',
|
|
680
752
|
uniqueId: 'table-largeur',
|
|
681
|
-
tableMinWidth: '
|
|
753
|
+
tableMinWidth: '1200px',
|
|
682
754
|
tableMaxWidth: '900px',
|
|
683
|
-
tableWidth: '
|
|
755
|
+
tableWidth: '100%',
|
|
684
756
|
},
|
|
685
757
|
parameters: {
|
|
686
758
|
sourceCode: [
|
|
@@ -692,9 +764,9 @@ export const LargeurPersonnalisee: Story = {
|
|
|
692
764
|
:headers="headers"
|
|
693
765
|
title="Tableau largeur personnalisée"
|
|
694
766
|
unique-id="table-largeur"
|
|
695
|
-
table-min-width="
|
|
767
|
+
table-min-width="1200px"
|
|
696
768
|
table-max-width="900px"
|
|
697
|
-
table-width="
|
|
769
|
+
table-width="100%"
|
|
698
770
|
/>
|
|
699
771
|
</template>
|
|
700
772
|
`,
|