@inseefr/lunatic 3.5.6 → 3.5.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.
Files changed (245) hide show
  1. package/components/CheckboxOne/CheckboxOne.spec.js +3 -2
  2. package/components/CheckboxOne/CheckboxOne.spec.js.map +1 -1
  3. package/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  4. package/components/shared/Combobox/Combobox.stories.js +26 -21
  5. package/components/shared/Combobox/Combobox.stories.js.map +1 -1
  6. package/components/type.d.ts +3 -0
  7. package/esm/components/CheckboxOne/CheckboxOne.spec.js +3 -2
  8. package/esm/components/CheckboxOne/CheckboxOne.spec.js.map +1 -1
  9. package/esm/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  10. package/esm/components/shared/Combobox/Combobox.stories.js +28 -24
  11. package/esm/components/shared/Combobox/Combobox.stories.js.map +1 -1
  12. package/esm/components/type.d.ts +3 -0
  13. package/esm/hooks/useLocalStorage.d.ts +1 -0
  14. package/esm/hooks/useLocalStorage.js +31 -0
  15. package/esm/hooks/useLocalStorage.js.map +1 -0
  16. package/esm/type.source.d.ts +6 -0
  17. package/esm/use-lunatic/commons/compile-controls.js +22 -14
  18. package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
  19. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js +4 -1
  20. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  21. package/esm/use-lunatic/hooks/use-page-has-response.js +1 -1
  22. package/esm/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  23. package/esm/use-lunatic/hooks/useOverview.spec.js +2 -2
  24. package/esm/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  25. package/esm/use-lunatic/props/getComponentTypeProps.d.ts +3 -0
  26. package/esm/utils/number.d.ts +4 -0
  27. package/esm/utils/number.js +12 -0
  28. package/esm/utils/number.js.map +1 -1
  29. package/esm/utils/object.d.ts +10 -0
  30. package/esm/utils/object.js +26 -0
  31. package/esm/utils/object.js.map +1 -1
  32. package/hooks/useLocalStorage.d.ts +1 -0
  33. package/hooks/useLocalStorage.js +34 -0
  34. package/hooks/useLocalStorage.js.map +1 -0
  35. package/package.json +76 -137
  36. package/src/components/CheckboxOne/CheckboxOne.spec.tsx +3 -0
  37. package/src/components/shared/Combobox/Combobox.stories.tsx +48 -49
  38. package/src/components/type.ts +1 -0
  39. package/src/hooks/useLocalStorage.ts +37 -0
  40. package/src/json.d.ts +16 -0
  41. package/src/stories/accordion/accordion.stories.tsx +21 -0
  42. package/src/stories/behaviour/cleaning/cleaning.stories.tsx +40 -0
  43. package/src/stories/behaviour/controls/controls.stories.tsx +51 -0
  44. package/src/stories/behaviour/disabled/disabled.stories.tsx +29 -0
  45. package/src/stories/behaviour/filter/filter.stories.tsx +34 -0
  46. package/src/stories/behaviour/missing/missing.stories.tsx +31 -0
  47. package/src/stories/behaviour/overview/overview.stories.tsx +61 -0
  48. package/src/stories/{overview/sourceWithHierarchy.json → behaviour/overview/source.json} +1 -1
  49. package/src/stories/{overview → behaviour/overview}/sourceLoop.json +1 -1
  50. package/src/stories/behaviour/performance/performance.stories.tsx +29 -0
  51. package/src/stories/behaviour/resizing/resizing.stories.tsx +34 -0
  52. package/src/stories/behaviour/slots.stories.tsx +34 -0
  53. package/src/stories/checkbox/checkbox.stories.tsx +75 -0
  54. package/src/stories/{checkbox-group/sourceLoop.json → checkbox/sourceGroupLoop.json} +1 -1
  55. package/src/stories/datepicker/datepicker.stories.tsx +21 -0
  56. package/src/stories/declaration/declaration.stories.tsx +27 -0
  57. package/src/stories/dropdown/dropdown.stories.tsx +27 -0
  58. package/src/stories/duration/duration.stories.tsx +27 -0
  59. package/src/stories/filter-description/filter-description.stories.tsx +28 -0
  60. package/src/stories/input/input.stories.tsx +21 -0
  61. package/src/stories/input-number/input-number.stories.tsx +35 -0
  62. package/src/stories/loop/loop.stories.tsx +35 -0
  63. package/src/stories/loop/roster-for-loop.stories.tsx +59 -0
  64. package/src/stories/pairwise/pairwise.stories.tsx +30 -0
  65. package/src/stories/paste.stories.tsx +85 -0
  66. package/src/stories/question/question.stories.tsx +21 -0
  67. package/src/stories/questionnaires/logement/logement.stories.tsx +26 -0
  68. package/src/stories/questionnaires/recensement/recensement.stories.tsx +28 -0
  69. package/src/stories/questionnaires/rp/rp.stories.tsx +21 -0
  70. package/src/stories/questionnaires/simpsons/simpsons.stories.tsx +31 -0
  71. package/src/stories/radio/radio.stories.tsx +53 -0
  72. package/src/stories/roundabout/roundabout.stories.tsx +37 -0
  73. package/src/stories/roundabout/source.json +1 -0
  74. package/src/stories/sequence/sequence.stories.tsx +28 -0
  75. package/src/stories/suggester/source-option-responses.json +1 -1
  76. package/src/stories/suggester/suggester.stories.tsx +68 -0
  77. package/src/stories/summary/source.json +22 -1
  78. package/src/stories/summary/summary.stories.tsx +31 -0
  79. package/src/stories/table/table.stories.tsx +35 -0
  80. package/src/stories/text/text.stories.tsx +38 -0
  81. package/src/stories/textarea/textarea.stories.tsx +21 -0
  82. package/src/stories/utils/Orchestrator.tsx +310 -0
  83. package/src/stories/utils/OrchestratorData.tsx +176 -0
  84. package/src/stories/utils/OrchestratorOverview.tsx +70 -0
  85. package/src/stories/utils/OrchestratorSidebar.tsx +119 -0
  86. package/src/stories/utils/SchemaValidator.tsx +29 -0
  87. package/src/stories/utils/referentiel.ts +9 -0
  88. package/src/type.source.ts +6 -0
  89. package/src/use-lunatic/commons/compile-controls.ts +36 -18
  90. package/src/use-lunatic/commons/fill-components/fill-component-expressions.ts +4 -1
  91. package/src/use-lunatic/hooks/use-page-has-response.ts +1 -1
  92. package/src/use-lunatic/hooks/useOverview.spec.ts +3 -2
  93. package/src/use-lunatic/use-lunatic.test.ts +53 -40
  94. package/src/utils/number.ts +13 -0
  95. package/src/utils/object.ts +40 -0
  96. package/tsconfig.build.tsbuildinfo +1 -1
  97. package/type.source.d.ts +6 -0
  98. package/use-lunatic/commons/compile-controls.js +21 -13
  99. package/use-lunatic/commons/compile-controls.js.map +1 -1
  100. package/use-lunatic/commons/fill-components/fill-component-expressions.js +5 -2
  101. package/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  102. package/use-lunatic/hooks/use-page-has-response.js +2 -2
  103. package/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  104. package/use-lunatic/hooks/useOverview.spec.js +8 -8
  105. package/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  106. package/use-lunatic/props/getComponentTypeProps.d.ts +3 -0
  107. package/utils/number.d.ts +4 -0
  108. package/utils/number.js +13 -0
  109. package/utils/number.js.map +1 -1
  110. package/utils/object.d.ts +10 -0
  111. package/utils/object.js +30 -0
  112. package/utils/object.js.map +1 -1
  113. package/esm/stories/overview/sourceWithHierarchy.json +0 -5151
  114. package/esm/tests/utils/lunatic.d.ts +0 -15
  115. package/esm/tests/utils/lunatic.js +0 -27
  116. package/esm/tests/utils/lunatic.js.map +0 -1
  117. package/esm/use-lunatic/replace-component-sequence.d.ts +0 -36
  118. package/esm/use-lunatic/replace-component-sequence.js +0 -19
  119. package/esm/use-lunatic/replace-component-sequence.js.map +0 -1
  120. package/esm/use-lunatic/test.utils.d.ts +0 -2
  121. package/esm/use-lunatic/test.utils.js +0 -13
  122. package/esm/use-lunatic/test.utils.js.map +0 -1
  123. package/esm/utils/is-object.d.ts +0 -4
  124. package/esm/utils/is-object.js +0 -7
  125. package/esm/utils/is-object.js.map +0 -1
  126. package/esm/utils/to-number.d.ts +0 -4
  127. package/esm/utils/to-number.js +0 -13
  128. package/esm/utils/to-number.js.map +0 -1
  129. package/src/stories/accordion/accordion.stories.jsx +0 -17
  130. package/src/stories/behaviour/cleaning/cleaning.stories.jsx +0 -69
  131. package/src/stories/behaviour/controls/controls.stories.jsx +0 -81
  132. package/src/stories/behaviour/filter/dataLoop.json +0 -14
  133. package/src/stories/behaviour/filter/filter.stories.jsx +0 -36
  134. package/src/stories/behaviour/missing/missing.stories.jsx +0 -69
  135. package/src/stories/behaviour/others/V2_DeclarationsSimples.json +0 -908
  136. package/src/stories/behaviour/others/V2_MinMaxSum_Boucles.json +0 -489
  137. package/src/stories/behaviour/others/V2_QuestSimple_Boucles.json +0 -3919
  138. package/src/stories/behaviour/others/V2_TCMRallyeGames.json +0 -2760
  139. package/src/stories/behaviour/others/test-dylan.json +0 -538
  140. package/src/stories/behaviour/others/test.stories.jsx +0 -78
  141. package/src/stories/behaviour/paste/source.json +0 -32
  142. package/src/stories/behaviour/paste/test.stories.jsx +0 -62
  143. package/src/stories/behaviour/performance/performance.stories.jsx +0 -26
  144. package/src/stories/behaviour/resizing/resizing.stories.jsx +0 -60
  145. package/src/stories/behaviour/slots.stories.jsx +0 -32
  146. package/src/stories/checkbox-boolean/checkboxBoolean.stories.jsx +0 -17
  147. package/src/stories/checkbox-group/checkbox-group.stories.jsx +0 -77
  148. package/src/stories/checkbox-one/checkboxOne.stories.jsx +0 -53
  149. package/src/stories/date-picker/data.json +0 -3
  150. package/src/stories/date-picker/datepicker.stories.jsx +0 -26
  151. package/src/stories/declaration/data.json +0 -1
  152. package/src/stories/declaration/input.stories.jsx +0 -18
  153. package/src/stories/disabled/data.json +0 -16
  154. package/src/stories/disabled/disabled.stories.jsx +0 -18
  155. package/src/stories/dropdown/data.json +0 -8
  156. package/src/stories/dropdown/dropdown.stories.jsx +0 -25
  157. package/src/stories/duration/duration.stories.jsx +0 -25
  158. package/src/stories/filter-description/filter-description.stories.jsx +0 -37
  159. package/src/stories/input/data.json +0 -1
  160. package/src/stories/input/input.stories.jsx +0 -18
  161. package/src/stories/input-number/input-number.stories.jsx +0 -23
  162. package/src/stories/loop/loop.stories.jsx +0 -29
  163. package/src/stories/loop/roster-for-loop.stories.jsx +0 -46
  164. package/src/stories/markdown/markdown.stories.jsx +0 -20
  165. package/src/stories/overview/data.json +0 -1
  166. package/src/stories/overview/dataLoop.json +0 -93
  167. package/src/stories/overview/overview.stories.jsx +0 -44
  168. package/src/stories/overview/source.json +0 -25
  169. package/src/stories/pairwise/data.json +0 -12
  170. package/src/stories/pairwise/pairwise-links.stories.jsx +0 -48
  171. package/src/stories/question/question.stories.jsx +0 -16
  172. package/src/stories/questionnaires/logement/logement.stories.jsx +0 -59
  173. package/src/stories/questionnaires/recensement/data.json +0 -12
  174. package/src/stories/questionnaires/recensement/recensement.stories.jsx +0 -35
  175. package/src/stories/questionnaires/rp/data.json +0 -5
  176. package/src/stories/questionnaires/rp/rp.stories.jsx +0 -23
  177. package/src/stories/questionnaires/simpsons/simpsons.stories.jsx +0 -246
  178. package/src/stories/radio/radio.stories.jsx +0 -78
  179. package/src/stories/roundabout/data1.json +0 -13
  180. package/src/stories/roundabout/data2.json +0 -16
  181. package/src/stories/roundabout/roundabout.stories.jsx +0 -32
  182. package/src/stories/sequence/sequence.stories.jsx +0 -29
  183. package/src/stories/suggester/suggester.stories.jsx +0 -71
  184. package/src/stories/summary/data.json +0 -16
  185. package/src/stories/summary/summary.stories.jsx +0 -23
  186. package/src/stories/switch/README.md +0 -29
  187. package/src/stories/switch/data-forced.json +0 -40
  188. package/src/stories/switch/source.json +0 -64
  189. package/src/stories/switch/switch.stories.jsx +0 -17
  190. package/src/stories/table/data.json +0 -1
  191. package/src/stories/table/table.stories.jsx +0 -30
  192. package/src/stories/text/data-roster.json +0 -5
  193. package/src/stories/text/text.stories.jsx +0 -20
  194. package/src/stories/textarea/data.json +0 -1
  195. package/src/stories/textarea/textarea.stories.jsx +0 -18
  196. package/src/stories/utils/SchemaValidator.jsx +0 -40
  197. package/src/stories/utils/default-arg-types.js +0 -39
  198. package/src/stories/utils/default-args.js +0 -3
  199. package/src/stories/utils/options.js +0 -19
  200. package/src/stories/utils/orchestrator.jsx +0 -267
  201. package/src/stories/utils/orchestrator.scss +0 -66
  202. package/src/stories/utils/overview.jsx +0 -39
  203. package/src/stories/utils/overview.scss +0 -37
  204. package/src/stories/utils/referentiel.js +0 -7
  205. package/src/tests/utils/e2e.js +0 -91
  206. package/src/tests/utils/lunatic.ts +0 -33
  207. package/src/use-lunatic/replace-component-sequence.ts +0 -25
  208. package/src/use-lunatic/test.utils.ts +0 -17
  209. package/src/utils/is-object.ts +0 -6
  210. package/src/utils/to-number.ts +0 -12
  211. package/stories/overview/sourceWithHierarchy.json +0 -5151
  212. package/tests/utils/lunatic.d.ts +0 -15
  213. package/tests/utils/lunatic.js +0 -31
  214. package/tests/utils/lunatic.js.map +0 -1
  215. package/use-lunatic/replace-component-sequence.d.ts +0 -36
  216. package/use-lunatic/replace-component-sequence.js +0 -22
  217. package/use-lunatic/replace-component-sequence.js.map +0 -1
  218. package/use-lunatic/test.utils.d.ts +0 -2
  219. package/use-lunatic/test.utils.js +0 -17
  220. package/use-lunatic/test.utils.js.map +0 -1
  221. package/utils/is-object.d.ts +0 -4
  222. package/utils/is-object.js +0 -10
  223. package/utils/is-object.js.map +0 -1
  224. package/utils/to-number.d.ts +0 -4
  225. package/utils/to-number.js +0 -16
  226. package/utils/to-number.js.map +0 -1
  227. /package/src/stories/behaviour/cleaning/{loop.json → source-loop-scopes.json} +0 -0
  228. /package/src/stories/behaviour/controls/{boucles-n.json → source-boucles-n.json} +0 -0
  229. /package/src/stories/behaviour/controls/{loop.json → source-loop.json} +0 -0
  230. /package/src/stories/behaviour/controls/{roundabout.json → source-roundabout.json} +0 -0
  231. /package/src/stories/behaviour/controls/{simple-numeric.json → source-simple-numeric.json} +0 -0
  232. /package/src/stories/behaviour/controls/{simple.json → source-simple.json} +0 -0
  233. /package/src/stories/{disabled → behaviour/disabled}/source.json +0 -0
  234. /package/src/stories/{checkbox-boolean → checkbox}/source.json +0 -0
  235. /package/src/stories/{checkbox-group/source.json → checkbox/sourceGroup.json} +0 -0
  236. /package/src/stories/{checkbox-group/sourceCondition.json → checkbox/sourceGroupCondition.json} +0 -0
  237. /package/src/stories/{checkbox-group/sourceDetail.json → checkbox/sourceGroupDetail.json} +0 -0
  238. /package/src/stories/{checkbox-one/source.json → checkbox/sourceOne.json} +0 -0
  239. /package/src/stories/{checkbox-one/sourceDetail.json → checkbox/sourceOneDetail.json} +0 -0
  240. /package/src/stories/{date-picker → datepicker}/source.json +0 -0
  241. /package/src/stories/{markdown/source.json → declaration/sourceMarkdown.json} +0 -0
  242. /package/src/stories/duration/{mois.json → sourceMonths.json} +0 -0
  243. /package/src/stories/duration/{time.json → sourceTime.json} +0 -0
  244. /package/src/stories/filter-description/{source-options.json → sourceOptions.json} +0 -0
  245. /package/src/stories/table/{table-dynamique.json → source-dynamic.json} +0 -0
@@ -1,93 +0,0 @@
1
- {
2
- "id": "",
3
- "questionnaireId": "",
4
- "data": {
5
- "EXTERNAL": {},
6
- "CALCULATED": {
7
- "T_NBHAB": 3,
8
- "PRENOMREFB": "Quentin",
9
- "PRENOMREF": "Quentin",
10
- "PRENOM": ["Quentin", "Luna", "Paul"],
11
- "PRENOMB": ["Quentin", "Luna", "Paul"]
12
- },
13
- "COLLECTED": {
14
- "ETAT": {
15
- "COLLECTED": "1"
16
- },
17
- "SATISFAIT": {
18
- "COLLECTED": "1"
19
- },
20
- "T_NHAB": {
21
- "COLLECTED": 3
22
- },
23
- "T_PRENOM": {
24
- "COLLECTED": ["Quentin", "Luna", "Paul"]
25
- },
26
- "COMMCOMPO": {
27
- "COLLECTED": "super"
28
- },
29
- "T_SEXE": {
30
- "COLLECTED": ["1", "2", "1"]
31
- },
32
- "T_DATENAIS": {
33
- "COLLECTED": [null, null, null]
34
- },
35
- "REMARQUES": {
36
- "COLLECTED": [null, "a", "b"]
37
- },
38
- "SUPERQUEST": {
39
- "COLLECTED": ["ok", "ok", null]
40
- },
41
- "AUTRESUPERQUEST": {
42
- "COLLECTED": ["a", "c", "ras"]
43
- },
44
- "ENCOREUNEQ": {
45
- "COLLECTED": ["wow", "b", null]
46
- },
47
- "COMMENT_QE": {
48
- "COLLECTED": null
49
- },
50
- "ETAT_MISSING": {
51
- "COLLECTED": null
52
- },
53
- "SATISFAIT_MISSING": {
54
- "COLLECTED": null
55
- },
56
- "T_NHAB_MISSING": {
57
- "COLLECTED": null
58
- },
59
- "T_PRENOM_MISSING": {
60
- "COLLECTED": null
61
- },
62
- "COMMCOMPO_MISSING": {
63
- "COLLECTED": null
64
- },
65
- "T_SEXE_MISSING": {
66
- "COLLECTED": null
67
- },
68
- "T_DATENAIS_MISSING": {
69
- "COLLECTED": [null, "DK", "RF"]
70
- },
71
- "REMARQUES_MISSING": {
72
- "COLLECTED": [null, null, null]
73
- },
74
- "SUPERQUEST_MISSING": {
75
- "COLLECTED": [null, null, "DK"]
76
- },
77
- "ENCOREUNEQ_MISSING": {
78
- "COLLECTED": [null, null, "RF"]
79
- },
80
- "AUTRESUPERQUEST_MISSING": {
81
- "COLLECTED": null
82
- },
83
- "COMMENT_QE_MISSING": {
84
- "COLLECTED": null
85
- }
86
- }
87
- },
88
- "stateData": {
89
- "state": "INIT",
90
- "date": 1712306743767,
91
- "currentPage": "14"
92
- }
93
- }
@@ -1,44 +0,0 @@
1
- import Orchestrator from '../utils/orchestrator';
2
- import React from 'react';
3
- import data from './data';
4
- import defaultArgTypes from '../utils/default-arg-types';
5
- import source from './sourceWithHierarchy';
6
- import sourceLoop from './sourceLoop.json';
7
- import dataLoop from './dataLoop.json';
8
-
9
- const stories = {
10
- title: 'Behaviour/Overview',
11
- component: Orchestrator,
12
- argTypes: {
13
- ...defaultArgTypes,
14
- showOverview: {
15
- table: { disable: false },
16
- control: 'boolean',
17
- defaultValue: true,
18
- },
19
- },
20
- };
21
-
22
- export default stories;
23
-
24
- const Template = (args) => <Orchestrator {...args} />;
25
- export const Default = Template.bind({});
26
-
27
- Default.args = { id: 'overview', source, showOverview: true, data };
28
-
29
- export const WithLoop = Template.bind({});
30
- WithLoop.args = {
31
- source: sourceLoop,
32
- showOverview: true,
33
- data: dataLoop.data,
34
- lastReachedPage: '11.2#2',
35
- };
36
-
37
- export const DisableFilterOverview = Template.bind({});
38
- DisableFilterOverview.args = {
39
- id: 'overview-disableFilter',
40
- source,
41
- showOverview: true,
42
- disableFilters: true,
43
- data,
44
- };
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "../../../../lunatic-schema.json",
3
- "components": [
4
- {
5
- "componentType": "Overview",
6
- "label": { "value": "\"What's your name?\"", "type": "VTL|MD" },
7
- "conditionFilter": { "value": "true", "type": "VTL" },
8
- "maxLength": 30,
9
- "id": "name",
10
- "response": {
11
- "name": "NAME"
12
- }
13
- }
14
- ],
15
- "variables": [
16
- {
17
- "variableType": "COLLECTED",
18
- "name": "NAME",
19
- "componentRef": "name",
20
- "values": {
21
- "COLLECTED": null
22
- }
23
- }
24
- ]
25
- }
@@ -1,12 +0,0 @@
1
- {
2
- "COLLECTED": {
3
- "PRENOM": { "COLLECTED": ["Dad", "Mom", "Unknow"] },
4
- "AGE": { "COLLECTED": [30, 29, 5] },
5
- "LINKS": {
6
- "COLLECTED": [[null]]
7
- },
8
- "OTHER": {
9
- "COLLECTED": [[null]]
10
- }
11
- }
12
- }
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import Orchestrator from '../utils/orchestrator';
3
- import source from './source.json';
4
- import data from './data';
5
- import defaultArgTypes from '../utils/default-arg-types';
6
- import { playwrightToUserEvent } from '../../tests/utils/e2e';
7
- import { sleep } from '../../tests/utils/timer';
8
-
9
- const stories = {
10
- title: 'Components/PairwiseLinks',
11
- component: Orchestrator,
12
- argTypes: defaultArgTypes,
13
- };
14
-
15
- export default stories;
16
-
17
- const Template = (args) => <Orchestrator {...args} />;
18
- export const Default = Template.bind({});
19
- Default.args = {
20
- id: 'links',
21
- source: source,
22
- pagination: true,
23
- data,
24
- initialPage: '3',
25
- };
26
-
27
- export const Filled = Template.bind({});
28
- Filled.args = { ...Default.args, id: 'links-filled' };
29
- Filled.play = async ({ args, canvasElement }) => {
30
- const page = playwrightToUserEvent(canvasElement);
31
- await sleep(100);
32
- await page.getByLabel('Prénom', { index: 2 }).fill('Marc');
33
- await page.getByRole('button', { name: 'Ajouter un individu' }).click();
34
- await page.getByLabel('Prénom', { index: 3 }).fill('Jane');
35
- await page.getByRole('button', { name: 'Next' }).click();
36
- await page.getByRole('button', { name: 'Next' }).click();
37
- await page.getByRole('button', { name: 'Next' }).click();
38
- await page.getByRole('button', { name: 'Next' }).click();
39
- await page.getByLabel('Âge de Jane').click();
40
- await page.getByLabel('Âge de Jane').fill('20');
41
- await page.getByRole('button', { name: 'Next' }).click();
42
- await page.getByText('Commencez votre saisie...', { index: 0 }).click();
43
- await page.getByText('Sa mère, son père').click();
44
- await page.getByText('Sa fille, son fils').shouldBeVisible();
45
- await page.getByRole('button', { name: 'Next' }).click();
46
- await page.getByRole('button', { name: 'Next' }).click();
47
- await page.getByText('END').shouldBeVisible();
48
- };
@@ -1,16 +0,0 @@
1
- import Orchestrator from '../utils/orchestrator';
2
- import source from './source.json';
3
-
4
- import defaultArgTypes from '../utils/default-arg-types';
5
-
6
- const meta = {
7
- title: 'Components/Question',
8
- component: Orchestrator,
9
- argTypes: {
10
- ...defaultArgTypes,
11
- },
12
- };
13
-
14
- export default meta;
15
-
16
- export const Default = { args: { id: 'sequence-simple', source } };
@@ -1,59 +0,0 @@
1
- import Orchestrator from '../../utils/orchestrator';
2
- import React from 'react';
3
- import data from './data';
4
- import defaultArgTypes from '../../utils/default-arg-types';
5
- import logement from './source';
6
- import logementSequence from './source-sequence';
7
- import logementSum from './source-sum';
8
-
9
- const stories = {
10
- title: 'Questionnaires/Logement',
11
- component: Orchestrator,
12
- argTypes: {
13
- ...defaultArgTypes,
14
- missing: {
15
- table: { disable: false },
16
- control: 'boolean',
17
- defaultValue: true,
18
- },
19
- management: {
20
- table: { disable: false },
21
- control: 'boolean',
22
- defaultValue: false,
23
- },
24
- showOverview: {
25
- table: { disable: false },
26
- control: 'boolean',
27
- defaultValue: false,
28
- },
29
- },
30
- };
31
-
32
- export default stories;
33
-
34
- const Template = (args) => <Orchestrator {...args} />;
35
- export const Default = Template.bind({});
36
-
37
- Default.args = {
38
- id: 'logement-default',
39
- source: logement,
40
- data,
41
- pagination: true,
42
- };
43
-
44
- export const DefaultSum = Template.bind({});
45
-
46
- DefaultSum.args = {
47
- id: 'logement-sum',
48
- source: logementSum,
49
- pagination: true,
50
- };
51
-
52
- export const Sequence = Template.bind({});
53
-
54
- Sequence.args = {
55
- id: 'logement-sequence',
56
- source: logementSequence,
57
- data,
58
- pagination: true,
59
- };
@@ -1,12 +0,0 @@
1
- {
2
- "COLLECTED": {
3
- "PRENOM": { "COLLECTED": [null] },
4
- "AGE": { "COLLECTED": [null] },
5
- "LINKS": {
6
- "COLLECTED": [[null]]
7
- },
8
- "OTHER": {
9
- "COLLECTED": [[null]]
10
- }
11
- }
12
- }
@@ -1,35 +0,0 @@
1
- import Orchestrator from '../../utils/orchestrator';
2
- import React from 'react';
3
- import data from './data';
4
- import defaultArgTypes from '../../utils/default-arg-types';
5
- import source from './source';
6
-
7
- const stories = {
8
- title: 'Questionnaires/Recensement',
9
- component: Orchestrator,
10
- argTypes: {
11
- ...defaultArgTypes,
12
- missing: {
13
- table: { disable: false },
14
- control: 'boolean',
15
- defaultValue: true,
16
- },
17
- management: {
18
- table: { disable: false },
19
- control: 'boolean',
20
- defaultValue: false,
21
- },
22
- },
23
- };
24
-
25
- export default stories;
26
-
27
- const Template = (args) => <Orchestrator {...args} />;
28
- export const Default = Template.bind({});
29
-
30
- Default.args = {
31
- id: 'logement-default',
32
- source,
33
- data,
34
- pagination: true,
35
- };
@@ -1,5 +0,0 @@
1
- {
2
- "EXTERNAL": {},
3
- "COLLECTED": {},
4
- "CALCULATED": {}
5
- }
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import Orchestrator from '../../utils/orchestrator';
3
- import data from './data';
4
- import source from './source';
5
- import defaultArgTypes from '../../utils/default-arg-types';
6
-
7
- const stories = {
8
- title: 'Questionnaires/RP',
9
- component: Orchestrator,
10
- argTypes: { ...defaultArgTypes },
11
- };
12
-
13
- export default stories;
14
-
15
- const Template = (args) => <Orchestrator {...args} />;
16
- export const Default = Template.bind({});
17
-
18
- Default.args = {
19
- id: 'rp-default',
20
- source,
21
- data,
22
- pagination: true,
23
- };
@@ -1,246 +0,0 @@
1
- import React from 'react';
2
- import { playwrightToUserEvent } from '../../../tests/utils/e2e';
3
- import { sleep } from '../../../tests/utils/timer';
4
- import { Logger } from '../../../utils/logger';
5
- import defaultArgTypes from '../../utils/default-arg-types';
6
- import Orchestrator from '../../utils/orchestrator';
7
- import simpsons from './source';
8
-
9
- const stories = {
10
- title: 'Questionnaires/Simpsons',
11
- component: Orchestrator,
12
- argTypes: {
13
- ...defaultArgTypes,
14
- missing: {
15
- table: { disable: false },
16
- control: 'boolean',
17
- defaultValue: true,
18
- },
19
- management: {
20
- table: { disable: false },
21
- control: 'boolean',
22
- defaultValue: false,
23
- },
24
- shortcut: {
25
- table: { disable: false },
26
- control: 'boolean',
27
- defaultValue: true,
28
- },
29
- },
30
- };
31
-
32
- export default stories;
33
-
34
- const Template = (args) => <Orchestrator {...args} />;
35
- export const Default = Template.bind({});
36
-
37
- Default.args = {
38
- id: 'Default',
39
- source: simpsons,
40
- pagination: true,
41
- };
42
-
43
- export const Filled = Template.bind({});
44
- Filled.args = {
45
- source: simpsons,
46
- pagination: true,
47
- missing: true,
48
- missingShortcut: { dontKnow: 'x', refused: 'f4' },
49
- };
50
-
51
- Filled.play = async ({ args, canvasElement }) => {
52
- const page = playwrightToUserEvent(canvasElement);
53
- await sleep(100);
54
- await page.getByRole('button', { name: 'Next' }).click();
55
- await page
56
- .getByLabel(
57
- '➡ Before starting, do you have any comments about the Simpsons family?'
58
- )
59
- .fill('They are yellow');
60
- await page.getByRole('button', { name: 'Next' }).click();
61
- await page
62
- .getByRole('checkbox', {
63
- name: '➡ If you agree to answer this questionnaire, please check the box If not, this is unfortunately the end of this questionnaire.',
64
- })
65
- .click();
66
- await page.getByRole('button', { name: 'Next' }).click();
67
- await page.getByLabel('➡ Who is the producer?').fill('Matt Groening');
68
- await page.getByRole('button', { name: 'Next' }).click();
69
- await page.getByLabel('➡ What is the current season number?').fill('20');
70
- await page.getByRole('button', { name: 'Next' }).click();
71
- await page.getByRole('button', { name: 'Next' }).click();
72
- await page.getByRole('button', { name: 'Next' }).click();
73
- await page.getByRole('button', { name: 'Next' }).click();
74
- await page.getByLabel('➡ How long does an episode last?').fill('2');
75
- await page.getByRole('button', { name: 'Next' }).click();
76
- await page
77
- .getByLabel('➡ How long does it take to write a new episode?')
78
- .fill('10');
79
- await page.getByRole('button', { name: 'Next' }).click();
80
- await page.getByRole('button', { name: 'Next' }).click();
81
- await page.getByRole('button', { name: 'Next' }).click();
82
- await page.getByRole('button', { name: 'Next' }).click();
83
- await page.getByRole('button', { name: 'Next' }).click();
84
- await page.getByRole('radio', { name: '1 Springfield' }).click();
85
- await page.getByRole('button', { name: 'Next' }).click();
86
- await page.getByRole('radio', { name: '3 Joe Quimby' }).click();
87
- await page.getByRole('button', { name: 'Next' }).click();
88
- await page
89
- .getByRole('combobox', { name: '➡ In which state do The Simpsons reside?' })
90
- // .locator('div')
91
- .click();
92
- await page.getByText('Not in any state, you fool!').click();
93
- await page.getByRole('button', { name: 'Next' }).click();
94
- await page.getByRole('button', { name: 'Next' }).click();
95
- await page.getByRole('checkbox', { name: '1 Santa’s Little Helper' }).click();
96
- await page.getByRole('button', { name: 'Next' }).click();
97
- await page.getByRole('button', { name: 'Next' }).click();
98
- await page.getByRole('button', { name: 'Next' }).click();
99
- await page
100
- .getByRole('row', { name: 'Selma Bouvier' })
101
- .getByRole('radio', { name: 'Springfield' })
102
- .click();
103
- await page
104
- .getByRole('row', { name: 'Kent Brockman' })
105
- .getByRole('radio', { name: 'Springfield' })
106
- .click();
107
- await page
108
- .getByRole('row', { name: 'Milhouse Van Houten' })
109
- .getByRole('radio', { name: 'Springfield' })
110
- .click();
111
- await page
112
- .getByRole('row', { name: 'Nelson Muntz' })
113
- .getByRole('radio', { name: 'Springfield' })
114
- .click();
115
- await page
116
- .getByRole('row', { name: 'Crazy Cat Lady' })
117
- .getByRole('radio', { name: 'Springfield' })
118
- .click();
119
- await page.getByRole('button', { name: 'Next' }).click();
120
- await page.getByRole('button', { name: 'Next' }).click();
121
- await page.getByRole('button', { name: 'Next' }).click();
122
- await page
123
- .getByRole('row', { name: 'Frozen products Ice creams' })
124
- .getByRole('radio', { name: 'Yes' })
125
- .click();
126
- await page
127
- .getByRole('row', { name: 'Jasper Beardly' })
128
- .getByRole('radio', { name: 'Yes' })
129
- .click();
130
- await page
131
- .getByRole('row', { name: 'Meat Bacon' })
132
- .getByRole('radio', { name: 'No' })
133
- .click();
134
- await page
135
- .getByRole('row', { name: 'Pork chop' })
136
- .getByRole('radio', { name: 'No' })
137
- .click();
138
- await page
139
- .getByRole('row', { name: 'Total' })
140
- .getByRole('radio', { name: 'Yes' })
141
- .click();
142
- await page.getByRole('button', { name: 'Next' }).click();
143
- await sleep(1000);
144
- await page
145
- .getByRole('row', {
146
- name: /Break the windows of the whole city/,
147
- })
148
- .getByRole('combobox')
149
- .click();
150
- await page.getByText('Krusty the clown').click();
151
- await page
152
- .getByRole('row', {
153
- name: /Loose the violin of his daughter playing poker/,
154
- })
155
- .getByRole('combobox')
156
- .click();
157
- await page.getByText('Jay').click();
158
- await page
159
- .getByRole('row', { name: /Kill Mr Burns/ })
160
- .getByRole('combobox')
161
- .click();
162
- await page.getByText('Other').click();
163
- await page.getByRole('button', { name: 'Next' }).click();
164
- await page.getByRole('button', { name: 'Next' }).click();
165
- await page.getByRole('button', { name: 'Next' }).click();
166
- await page.getByRole('button', { name: 'Next' }).click();
167
- await page
168
- .getByRole('row', { name: 'Jay' })
169
- .getByRole('radio', { name: 'Up' })
170
- .click();
171
- await page
172
- .getByRole('row', { name: 'Bart' })
173
- .getByRole('radio', { name: 'Steady' })
174
- .click();
175
- await page
176
- .getByRole('row', { name: 'Krusty the clown' })
177
- .getByRole('radio', { name: 'Up' })
178
- .click();
179
- await page
180
- .getByRole('row', { name: 'Other' })
181
- .getByRole('radio', { name: 'Down' })
182
- .click();
183
- await page.getByRole('button', { name: 'Next' }).click();
184
- await page
185
- .getByRole('row', { name: /Leave with pay/ })
186
- .getByText('Commencez votre saisie...')
187
- .click();
188
- await page.getByText('Calendar days').click();
189
- await page.getByRole('button', { name: 'Next' }).click();
190
- await page.getByRole('button', { name: 'Next' }).click();
191
- await page
192
- .getByLabel(
193
- '➡ How many characters from the Simpsons family could you precisely describe?'
194
- )
195
- .click();
196
- await page
197
- .getByLabel(
198
- '➡ How many characters from the Simpsons family could you precisely describe?'
199
- )
200
- .fill('2');
201
- await page.getByRole('button', { name: 'Next' }).click();
202
- await page
203
- .getByLabel('➡ What is the first name of this character?', { index: 0 })
204
- .fill('Bart');
205
- await page
206
- .getByLabel(
207
- '➡ How old is this character in the first episode of the Simpsons family?',
208
- { index: 0 }
209
- )
210
- .fill('14');
211
- await page
212
- .getByLabel('➡ What is the first name of this character?', { index: 1 })
213
- .fill('Bart');
214
- await page.getByRole('button', { name: 'Next' }).click();
215
- await page.getByRole('button', { name: 'Next' }).click();
216
- await page.getByRole('radio', { name: '1 Yes' }).click();
217
- await page.getByRole('button', { name: 'Next' }).click();
218
- await page.getByRole('button', { name: 'Next' }).click();
219
- await page.getByRole('button', { name: 'Next' }).click();
220
- await page.getByRole('radio', { name: '1 Yes' }).click();
221
- await page.getByRole('button', { name: 'Next' }).click();
222
- await page.getByRole('button', { name: 'Next' }).click();
223
- await page.getByRole('button', { name: 'Next' }).click();
224
- await page.getByLabel('➡ Do you have any comment about the survey?').click();
225
- // should be catched by Missing component and trigger missingStrategy after handleChange with missingResponse 'DK'
226
- await page.keyPress('x');
227
- await page.getByRole('button', { name: 'Next' }).click();
228
- await page.getByRole('button', { name: 'Next' }).click();
229
- await page.getByText('PAGE: 39').shouldBeVisible();
230
- };
231
-
232
- export const With_Missing = Template.bind({});
233
-
234
- With_Missing.args = {
235
- id: 'With-missing',
236
- source: simpsons,
237
- pagination: true,
238
- missing: true,
239
- missingStrategy: () => {
240
- Logger.info('your strategy has been applied');
241
- },
242
- dontKnowButton: 'I dunno',
243
- refusedButton: 'Oh no!',
244
- missingShortcut: { dontKnow: 'f2', refused: 'f4' },
245
- data: { COLLECTED: { READY: { COLLECTED: true } } },
246
- };