@coorpacademy/app-review 0.2.8 → 0.2.9

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 (98) hide show
  1. package/es/actions/api/fetch-rank.d.ts +32 -0
  2. package/es/actions/api/fetch-rank.js +30 -0
  3. package/es/actions/api/test/fetch-correction.test.js +2 -1
  4. package/es/actions/api/test/fetch-rank.test.d.ts +1 -0
  5. package/es/actions/api/test/fetch-rank.test.js +100 -0
  6. package/es/actions/api/test/fetch-skills.test.js +2 -1
  7. package/es/actions/api/test/fetch-slide.test.js +2 -1
  8. package/es/actions/api/test/post-answer.test.js +2 -1
  9. package/es/actions/api/test/post-progression.test.js +2 -1
  10. package/es/actions/data/test/token.test.js +2 -1
  11. package/es/actions/ui/test/answers.test.js +2 -1
  12. package/es/actions/ui/test/slides.test.js +2 -1
  13. package/es/reducers/data/corrections.d.ts +1 -1
  14. package/es/reducers/data/index.d.ts +4 -1
  15. package/es/reducers/data/index.js +2 -1
  16. package/es/reducers/data/rank.d.ts +7 -0
  17. package/es/reducers/data/rank.js +36 -0
  18. package/es/reducers/data/test/rank.test.d.ts +1 -0
  19. package/es/reducers/data/test/rank.test.js +59 -0
  20. package/es/reducers/index.d.ts +4 -3
  21. package/es/reducers/ui/slide.d.ts +1 -0
  22. package/es/reducers/ui/slide.js +1 -1
  23. package/es/test/util/services.mock.d.ts +1 -0
  24. package/es/test/util/services.mock.js +16 -0
  25. package/es/views/skills/test/skills.test.js +4 -2
  26. package/es/views/slides/index.d.ts +21 -19
  27. package/es/views/slides/index.js +29 -3
  28. package/es/views/slides/test/fixtures/qcm-graphic.js +190 -28
  29. package/es/views/slides/test/index.test.js +200 -19
  30. package/es/views/slides/test/slide.free-text.on-change.test.js +4 -1
  31. package/es/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  32. package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  33. package/es/views/slides/test/slide.qcm.on-click.test.js +4 -1
  34. package/es/views/slides/test/slide.slider.on-change.test.js +4 -1
  35. package/es/views/slides/test/slide.template.on-change.test.js +6 -1
  36. package/lib/actions/api/fetch-rank.d.ts +32 -0
  37. package/lib/actions/api/fetch-rank.js +32 -0
  38. package/lib/actions/api/test/fetch-correction.test.js +2 -1
  39. package/lib/actions/api/test/fetch-rank.test.d.ts +1 -0
  40. package/lib/actions/api/test/fetch-rank.test.js +171 -0
  41. package/lib/actions/api/test/fetch-skills.test.js +2 -1
  42. package/lib/actions/api/test/fetch-slide.test.js +2 -1
  43. package/lib/actions/api/test/post-answer.test.js +2 -1
  44. package/lib/actions/api/test/post-progression.test.js +2 -1
  45. package/lib/actions/data/test/token.test.js +2 -1
  46. package/lib/actions/ui/test/answers.test.js +2 -1
  47. package/lib/actions/ui/test/slides.test.js +2 -1
  48. package/lib/reducers/data/corrections.d.ts +1 -1
  49. package/lib/reducers/data/index.d.ts +4 -1
  50. package/lib/reducers/data/index.js +2 -1
  51. package/lib/reducers/data/rank.d.ts +7 -0
  52. package/lib/reducers/data/rank.js +37 -0
  53. package/lib/reducers/data/test/rank.test.d.ts +1 -0
  54. package/lib/reducers/data/test/rank.test.js +59 -0
  55. package/lib/reducers/index.d.ts +4 -3
  56. package/lib/reducers/ui/slide.d.ts +1 -0
  57. package/lib/reducers/ui/slide.js +1 -1
  58. package/lib/test/util/services.mock.d.ts +1 -0
  59. package/lib/test/util/services.mock.js +7 -0
  60. package/lib/views/skills/test/skills.test.js +4 -2
  61. package/lib/views/slides/index.d.ts +21 -19
  62. package/lib/views/slides/index.js +29 -3
  63. package/lib/views/slides/test/fixtures/qcm-graphic.js +190 -28
  64. package/lib/views/slides/test/index.test.js +211 -22
  65. package/lib/views/slides/test/slide.free-text.on-change.test.js +4 -1
  66. package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  67. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  68. package/lib/views/slides/test/slide.qcm.on-click.test.js +4 -1
  69. package/lib/views/slides/test/slide.slider.on-change.test.js +4 -1
  70. package/lib/views/slides/test/slide.template.on-change.test.js +6 -1
  71. package/package.json +3 -3
  72. package/src/actions/api/fetch-rank.ts +84 -0
  73. package/src/actions/api/test/fetch-correction.test.ts +2 -1
  74. package/src/actions/api/test/fetch-rank.test.ts +130 -0
  75. package/src/actions/api/test/fetch-skills.test.ts +2 -1
  76. package/src/actions/api/test/fetch-slide.test.ts +2 -1
  77. package/src/actions/api/test/post-answer.test.ts +2 -1
  78. package/src/actions/api/test/post-progression.test.ts +2 -1
  79. package/src/actions/data/test/token.test.ts +2 -1
  80. package/src/actions/ui/test/answers.test.ts +2 -1
  81. package/src/actions/ui/test/slides.test.ts +2 -1
  82. package/src/reducers/data/corrections.ts +1 -1
  83. package/src/reducers/data/index.ts +3 -1
  84. package/src/reducers/data/rank.ts +60 -0
  85. package/src/reducers/data/test/rank.test.ts +78 -0
  86. package/src/reducers/index.ts +2 -2
  87. package/src/reducers/ui/slide.ts +2 -1
  88. package/src/test/util/services.mock.ts +17 -0
  89. package/src/views/skills/test/skills.test.ts +4 -2
  90. package/src/views/slides/index.ts +65 -22
  91. package/src/views/slides/test/fixtures/qcm-graphic.ts +196 -29
  92. package/src/views/slides/test/index.test.ts +210 -21
  93. package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -1
  94. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -1
  95. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +6 -4
  96. package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -1
  97. package/src/views/slides/test/slide.slider.on-change.test.ts +4 -1
  98. package/src/views/slides/test/slide.template.on-change.test.ts +6 -1
@@ -15,10 +15,10 @@ export const qcmGraphicSlide: SlideFromAPI = {
15
15
  media: {
16
16
  src: [
17
17
  {
18
- _id: '624efd915948a7013083e986',
18
+ _id: '616dbbb61a50f8051c1971ba',
19
19
  mimeType: 'image/jpeg',
20
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
21
- id: '624efd915948a7013083e986'
20
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
21
+ id: '616dbbb61a50f8051c1971ba'
22
22
  }
23
23
  ],
24
24
  posters: [],
@@ -26,19 +26,19 @@ export const qcmGraphicSlide: SlideFromAPI = {
26
26
  type: 'img'
27
27
  },
28
28
  items: [],
29
- _id: '624efd915948a7013083e985',
30
- label: 'Vrai',
31
- value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
32
- id: '624efd915948a7013083e985'
29
+ _id: '616dbbb61a50f8051c1971b9',
30
+ label: 'La consolidation des acquis',
31
+ value: 'sli_4k5O3zaN5.choice_E1ebZYyF8q',
32
+ id: '616dbbb61a50f8051c1971b9'
33
33
  },
34
34
  {
35
35
  media: {
36
36
  src: [
37
37
  {
38
- _id: '624efd915948a7013083e988',
38
+ _id: '616dbbb61a50f8051c1971bc',
39
39
  mimeType: 'image/jpeg',
40
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
41
- id: '624efd915948a7013083e988'
40
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
41
+ id: '616dbbb61a50f8051c1971bc'
42
42
  }
43
43
  ],
44
44
  posters: [],
@@ -46,19 +46,139 @@ export const qcmGraphicSlide: SlideFromAPI = {
46
46
  type: 'img'
47
47
  },
48
48
  items: [],
49
- _id: '624efd915948a7013083e987',
50
- label: 'Faux',
51
- value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
52
- id: '624efd915948a7013083e987'
49
+ _id: '616dbbb61a50f8051c1971bb',
50
+ label: 'Le retour d’information',
51
+ value: 'sli_4k5O3zaN5.choice_NygF~FJFIc',
52
+ id: '616dbbb61a50f8051c1971bb'
53
+ },
54
+ {
55
+ media: {
56
+ src: [
57
+ {
58
+ _id: '616dbbb61a50f8051c1971be',
59
+ mimeType: 'image/jpeg',
60
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
61
+ id: '616dbbb61a50f8051c1971be'
62
+ }
63
+ ],
64
+ posters: [],
65
+ subtitles: [],
66
+ type: 'img'
67
+ },
68
+ items: [],
69
+ _id: '616dbbb61a50f8051c1971bd',
70
+ label: 'L’engagement actif',
71
+ value: 'sli_4k5O3zaN5.choice_4yx5bKJKIc',
72
+ id: '616dbbb61a50f8051c1971bd'
73
+ },
74
+ {
75
+ media: {
76
+ src: [
77
+ {
78
+ _id: '616dbbb61a50f8051c1971c0',
79
+ mimeType: 'image/jpeg',
80
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
81
+ id: '616dbbb61a50f8051c1971c0'
82
+ }
83
+ ],
84
+ posters: [],
85
+ subtitles: [],
86
+ type: 'img'
87
+ },
88
+ items: [],
89
+ _id: '616dbbb61a50f8051c1971bf',
90
+ label: 'La motivation',
91
+ value: 'sli_4k5O3zaN5.choice_VkzcZY1F8q',
92
+ id: '616dbbb61a50f8051c1971bf'
93
+ },
94
+ {
95
+ media: {
96
+ src: [
97
+ {
98
+ _id: '616dbbb61a50f8051c1971c2',
99
+ mimeType: 'image/jpeg',
100
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
101
+ id: '616dbbb61a50f8051c1971c2'
102
+ }
103
+ ],
104
+ posters: [],
105
+ subtitles: [],
106
+ type: 'img'
107
+ },
108
+ items: [],
109
+ _id: '616dbbb61a50f8051c1971c1',
110
+ label: 'L’attention',
111
+ value: 'sli_4k5O3zaN5.choice_Vken~YJFI5',
112
+ id: '616dbbb61a50f8051c1971c1'
113
+ },
114
+ {
115
+ media: {
116
+ src: [
117
+ {
118
+ _id: '616dbbb61a50f8051c1971c4',
119
+ mimeType: 'image/jpeg',
120
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
121
+ id: '616dbbb61a50f8051c1971c4'
122
+ }
123
+ ],
124
+ posters: [],
125
+ subtitles: [],
126
+ type: 'img'
127
+ },
128
+ items: [],
129
+ _id: '616dbbb61a50f8051c1971c3',
130
+ label: 'La confiance en soi',
131
+ value: 'sli_4k5O3zaN5.choice_4JgpWKkFLq',
132
+ id: '616dbbb61a50f8051c1971c3'
133
+ },
134
+ {
135
+ media: {
136
+ src: [
137
+ {
138
+ _id: '616dbbb61a50f8051c1971c6',
139
+ mimeType: 'image/jpeg',
140
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
141
+ id: '616dbbb61a50f8051c1971c6'
142
+ }
143
+ ],
144
+ posters: [],
145
+ subtitles: [],
146
+ type: 'img'
147
+ },
148
+ items: [],
149
+ _id: '616dbbb61a50f8051c1971c5',
150
+ label: 'La capacité d’abstraction',
151
+ value: 'sli_4k5O3zaN5.choice_NJfabKkK8q',
152
+ id: '616dbbb61a50f8051c1971c5'
153
+ },
154
+ {
155
+ media: {
156
+ src: [
157
+ {
158
+ _id: '616dbbb61a50f8051c1971c8',
159
+ mimeType: 'image/jpeg',
160
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
161
+ id: '616dbbb61a50f8051c1971c8'
162
+ }
163
+ ],
164
+ posters: [],
165
+ subtitles: [],
166
+ type: 'img'
167
+ },
168
+ items: [],
169
+ _id: '616dbbb61a50f8051c1971c7',
170
+ label: 'L’abnégation',
171
+ value: 'sli_4k5O3zaN5.choice_41xAWYJYI9',
172
+ id: '616dbbb61a50f8051c1971c7'
53
173
  }
54
174
  ]
55
175
  },
56
176
  type: 'qcmGraphic',
57
- header: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
58
- explanation: 'Sélectionnez la bonne réponse.'
177
+ header: 'Quels sont les 4 piliers de l’apprentissage ?',
178
+ explanation: 'Sélectionnez les 4 bonnes réponses.'
59
179
  },
60
- klf: "Il ne faut pas prendre la négociation comme une affaire personnelle, afin de rester centré sur son sujet. Mais cela ne signifie pas être dépourvu de toute émotion, car celles-ci peuvent être de vrais atouts. À condition de réussir à les exprimer sans accuser l'autre d'en être à l'origine.",
61
- tips: "Pour gérer ses émotions, il faut d'abord les identifier, notamment en analysant ses ressentis physiques et en trouvant l'élément déclencheur.",
180
+ klf: 'Avec l’engagement actif, le retour d’information et la consolidation des acquis, l’attention est le premier des quatre piliers de l’apprentissage, identifiés par les chercheurs en neuroscience, spécialistes de l’éducation.',
181
+ tips: 'Une configuration idéale pour l’apprentissage, mettant en œuvre ces 4 piliers : présenter à un apprenant un contenu de durée raisonnable, qui respecte le temps d’attention qu’il peut lui accorder ; proposer ensuite un exercice sur le contenu qui vient d’être expliqué ; puis donner à l’apprenant un retour en direct sur sa production.',
62
182
  universalRef: 'sli_VkSQroQnx',
63
183
  _id: 'sli_VkSQroQnx',
64
184
  parentContentTitle: {
@@ -68,28 +188,75 @@ export const qcmGraphicSlide: SlideFromAPI = {
68
188
  };
69
189
 
70
190
  export const qcmGraphicUISlide: Partial<UISlide> = {
71
- questionText:
72
- 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
191
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?',
73
192
  answerUI: {
74
- help: 'Sélectionnez la bonne réponse.',
193
+ help: 'Sélectionnez les 4 bonnes réponses.',
75
194
  model: {
76
195
  type: 'qcmGraphic',
77
196
  answers: [
78
197
  {
79
- title: 'Vrai',
198
+ title: 'La consolidation des acquis',
199
+ image:
200
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
201
+ selected: false,
202
+ ariaLabel: 'La consolidation des acquis',
203
+ onClick: noop
204
+ },
205
+ {
206
+ title: 'Le retour d’information',
207
+ image:
208
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
209
+ selected: false,
210
+ ariaLabel: 'Le retour d’information',
211
+ onClick: noop
212
+ },
213
+ {
214
+ title: 'L’engagement actif',
215
+ image:
216
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
217
+ selected: false,
218
+ ariaLabel: 'L’engagement actif',
219
+ onClick: noop
220
+ },
221
+ {
222
+ title: 'La motivation',
223
+ image:
224
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
225
+ selected: false,
226
+ ariaLabel: 'La motivation',
227
+ onClick: noop
228
+ },
229
+ {
230
+ title: 'L’attention',
231
+ image:
232
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
233
+ selected: false,
234
+ ariaLabel: 'L’attention',
235
+ onClick: noop
236
+ },
237
+ {
238
+ title: 'La confiance en soi',
239
+ image:
240
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
241
+ selected: false,
242
+ ariaLabel: 'La confiance en soi',
243
+ onClick: noop
244
+ },
245
+ {
246
+ title: 'La capacité d’abstraction',
80
247
  image:
81
- '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
248
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
82
249
  selected: false,
83
- onClick: noop,
84
- ariaLabel: 'Vrai'
250
+ ariaLabel: 'La capacité d’abstraction',
251
+ onClick: noop
85
252
  },
86
253
  {
87
- title: 'Faux',
254
+ title: 'L’abnégation',
88
255
  image:
89
- '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
256
+ '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
90
257
  selected: false,
91
- onClick: noop,
92
- ariaLabel: 'Faux'
258
+ ariaLabel: 'L’abnégation',
259
+ onClick: noop
93
260
  }
94
261
  ]
95
262
  }
@@ -5,16 +5,48 @@ import set from 'lodash/fp/set';
5
5
  import {
6
6
  postProgressionResponse as createdProgression,
7
7
  postAnswerResponses,
8
- progressionSlideWithPendingSlide
8
+ progressionSlideWithPendingSlide,
9
+ getChoicesCorrection,
10
+ incorrectFreeTextPostAnswerResponse
9
11
  } from '../../../test/util/services.mock';
10
- import {mapStateToSlidesProps} from '..';
11
- import {StoreState} from '../../../reducers';
12
+ import {type CorrectionPopinProps, mapStateToSlidesProps} from '..';
13
+ import type {StoreState} from '../../../reducers';
12
14
  import {freeTextSlide} from './fixtures/free-text';
13
15
  import {qcmGraphicSlide} from './fixtures/qcm-graphic';
14
16
  import {templateSlide} from './fixtures/template';
15
17
  import {qcmSlide} from './fixtures/qcm';
16
18
  import {sliderSlide} from './fixtures/slider';
17
19
 
20
+ const popinPropsRightAnswer: CorrectionPopinProps = {
21
+ resultLabel: '_right',
22
+ information: {
23
+ label: '_klf',
24
+ message:
25
+ 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
26
+ },
27
+ klf: undefined,
28
+ next: {
29
+ ariaLabel: '_correctionNextAriaLabel',
30
+ label: '_correctionNextLabel'
31
+ },
32
+ type: 'right'
33
+ };
34
+
35
+ const popinPropsWrongAnswer: CorrectionPopinProps = {
36
+ ...popinPropsRightAnswer,
37
+ klf: {
38
+ label: '_klf',
39
+ tooltip:
40
+ 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
41
+ },
42
+ type: 'wrong',
43
+ resultLabel: '_wrong',
44
+ information: {
45
+ label: '_correctAnswer',
46
+ message: 'Benchmark'
47
+ }
48
+ };
49
+
18
50
  test('should create initial props when fetched slide is not still received', t => {
19
51
  // SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
20
52
  const state: StoreState = {
@@ -25,7 +57,8 @@ test('should create initial props when fetched slide is not still received', t =
25
57
  sli_N1XACJobn: null
26
58
  },
27
59
  token: '1234',
28
- corrections: {}
60
+ corrections: {},
61
+ rank: {}
29
62
  },
30
63
  ui: {
31
64
  currentSlideRef: '',
@@ -115,7 +148,8 @@ test('should create props when first slide is on the state', t => {
115
148
  sli_VJYjJnJhg: freeTextSlide
116
149
  },
117
150
  token: '1234',
118
- corrections: {}
151
+ corrections: {},
152
+ rank: {}
119
153
  },
120
154
  ui: {
121
155
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -167,6 +201,8 @@ test('should create props when first slide is on the state', t => {
167
201
  endReview: false
168
202
  });
169
203
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
204
+ animateCorrectionPopin: false,
205
+ showCorrectionPopin: false,
170
206
  hidden: false,
171
207
  position: 0,
172
208
  loading: false,
@@ -217,7 +253,8 @@ test('should create props when slide is on the state and user has selected answe
217
253
  sli_VJYjJnJhg: freeTextSlide
218
254
  },
219
255
  token: '1234',
220
- corrections: {}
256
+ corrections: {},
257
+ rank: {}
221
258
  },
222
259
  ui: {
223
260
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -269,6 +306,8 @@ test('should create props when slide is on the state and user has selected answe
269
306
  endReview: false
270
307
  });
271
308
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
309
+ animateCorrectionPopin: false,
310
+ showCorrectionPopin: false,
272
311
  hidden: false,
273
312
  position: 0,
274
313
  loading: false,
@@ -320,7 +359,8 @@ test('should verify props when first slide was answered correctly and next slide
320
359
  sli_VkSQroQnx: null
321
360
  },
322
361
  token: '1234',
323
- corrections: {}
362
+ corrections: {},
363
+ rank: {}
324
364
  },
325
365
  ui: {
326
366
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -372,6 +412,8 @@ test('should verify props when first slide was answered correctly and next slide
372
412
  endReview: false
373
413
  });
374
414
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
415
+ animateCorrectionPopin: false,
416
+ showCorrectionPopin: false,
375
417
  hidden: false,
376
418
  position: 0,
377
419
  loading: false,
@@ -427,7 +469,8 @@ test('should verify props when first slide was answered with error and next slid
427
469
  sli_VkSQroQnx: null
428
470
  },
429
471
  token: '1234',
430
- corrections: {}
472
+ corrections: {},
473
+ rank: {}
431
474
  },
432
475
  ui: {
433
476
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -476,7 +519,7 @@ test('should verify props when first slide was answered with error and next slid
476
519
  });
477
520
  });
478
521
 
479
- test('should verify props when first slide was answered and next slide is fecthed', t => {
522
+ test('should verify props when first slide was answered, next slide is fetched & correction is fetched', t => {
480
523
  // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
481
524
  const state: StoreState = {
482
525
  data: {
@@ -487,14 +530,19 @@ test('should verify props when first slide was answered and next slide is fecthe
487
530
  sli_VkSQroQnx: qcmGraphicSlide
488
531
  },
489
532
  token: '1234',
490
- corrections: {}
533
+ corrections: {
534
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
535
+ },
536
+ rank: {}
491
537
  },
492
538
  ui: {
493
539
  currentSlideRef: 'sli_VJYjJnJhg',
494
540
  navigation: ['loader', 'slides'],
495
541
  answers: ['My value'],
496
542
  slide: {
497
- validateButton: false
543
+ validateButton: false,
544
+ animateCorrectionPopin: true,
545
+ showCorrectionPopin: true
498
546
  }
499
547
  }
500
548
  };
@@ -534,11 +582,13 @@ test('should verify props when first slide was answered and next slide is fecthe
534
582
  }
535
583
  ]
536
584
  });
537
- t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
538
- correctionPopinProps: undefined,
585
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
586
+ correctionPopinProps: popinPropsRightAnswer,
539
587
  endReview: false
540
588
  });
541
589
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
590
+ animateCorrectionPopin: true,
591
+ showCorrectionPopin: true,
542
592
  hidden: false,
543
593
  position: 0,
544
594
  loading: false,
@@ -555,12 +605,127 @@ test('should verify props when first slide was answered and next slide is fecthe
555
605
  }
556
606
  });
557
607
  t.deepEqual(omit('answerUI', props.stack.slides['1']), {
608
+ animateCorrectionPopin: false,
609
+ showCorrectionPopin: false,
558
610
  hidden: false,
559
611
  position: 1,
560
612
  loading: false,
561
613
  parentContentTitle: 'From "Developing the review app" course',
614
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
615
+ });
616
+ t.is(props.stack.validateButton.disabled, true);
617
+ t.deepEqual(omit(['0', '1'], props.stack.slides), {
618
+ '2': {
619
+ hidden: false,
620
+ position: 2,
621
+ loading: true
622
+ },
623
+ '3': {
624
+ hidden: false,
625
+ position: 3,
626
+ loading: true
627
+ },
628
+ '4': {
629
+ hidden: false,
630
+ position: 4,
631
+ loading: true
632
+ }
633
+ });
634
+ });
635
+
636
+ test('should verify props when first slide was answered incorrectly, next slide is fetched & correction is fetched', t => {
637
+ // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
638
+ const state: StoreState = {
639
+ data: {
640
+ progression: incorrectFreeTextPostAnswerResponse,
641
+ skills: [],
642
+ slides: {
643
+ sli_VJYjJnJhg: freeTextSlide,
644
+ sli_VkSQroQnx: qcmGraphicSlide
645
+ },
646
+ token: '1234',
647
+ corrections: {
648
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id, true)
649
+ },
650
+ rank: {}
651
+ },
652
+ ui: {
653
+ currentSlideRef: 'sli_VJYjJnJhg',
654
+ navigation: ['loader', 'slides'],
655
+ answers: ['My value'],
656
+ slide: {
657
+ validateButton: false,
658
+ animateCorrectionPopin: true,
659
+ showCorrectionPopin: true
660
+ }
661
+ }
662
+ };
663
+
664
+ const props = mapStateToSlidesProps(state, identity);
665
+ t.is(props.congratsProps, undefined);
666
+ t.deepEqual(omit(['onQuitClick'], props.header), {
667
+ 'aria-label': 'aria-header-wrapper',
668
+ closeButtonAriaLabel: 'aria-close-button',
669
+ mode: '__revision_mode',
670
+ skillName: '__agility',
671
+ steps: [
672
+ {
673
+ current: true,
674
+ icon: 'wrong',
675
+ value: '1'
676
+ },
677
+ {
678
+ current: false,
679
+ icon: 'no-answer',
680
+ value: '2'
681
+ },
682
+ {
683
+ current: false,
684
+ icon: 'no-answer',
685
+ value: '3'
686
+ },
687
+ {
688
+ current: false,
689
+ icon: 'no-answer',
690
+ value: '4'
691
+ },
692
+ {
693
+ current: false,
694
+ icon: 'no-answer',
695
+ value: '5'
696
+ }
697
+ ]
698
+ });
699
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
700
+ correctionPopinProps: popinPropsWrongAnswer,
701
+ endReview: false
702
+ });
703
+ t.deepEqual(omit('answerUI', props.stack.slides['0']), {
704
+ animateCorrectionPopin: true,
705
+ showCorrectionPopin: true,
706
+ hidden: false,
707
+ position: 0,
708
+ loading: false,
709
+ parentContentTitle: 'From "Developing the review app" course',
562
710
  questionText:
563
- 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
711
+ 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
712
+ });
713
+ t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
714
+ help: 'Type your answer.',
715
+ model: {
716
+ placeholder: 'Type here',
717
+ type: 'freeText',
718
+ value: 'My value'
719
+ }
720
+ });
721
+ t.deepEqual(omit('answerUI', props.stack.slides['1']), {
722
+ animateCorrectionPopin: false,
723
+ showCorrectionPopin: false,
724
+ hidden: false,
725
+ position: 1,
726
+ loading: false,
727
+ parentContentTitle: 'From "Developing the review app" course',
728
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
564
729
  });
565
730
  t.is(props.stack.validateButton.disabled, true);
566
731
  t.deepEqual(omit(['0', '1'], props.stack.slides), {
@@ -582,7 +747,7 @@ test('should verify props when first slide was answered and next slide is fecthe
582
747
  });
583
748
  });
584
749
 
585
- test('should verify props when currentSlideRef has changed to nextContent of progression after first asnwered question', t => {
750
+ test('should verify props when currentSlideRef has changed to nextContent of progression after first answered question', t => {
586
751
  // state after click on NEXT_SLIDE
587
752
  const state: StoreState = {
588
753
  data: {
@@ -593,7 +758,10 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
593
758
  sli_VkSQroQnx: qcmGraphicSlide
594
759
  },
595
760
  token: '1234',
596
- corrections: {}
761
+ corrections: {
762
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
763
+ },
764
+ rank: {}
597
765
  },
598
766
  ui: {
599
767
  currentSlideRef: 'sli_VkSQroQnx',
@@ -658,7 +826,14 @@ test('should verify props when progression is in success', t => {
658
826
  [templateSlide.universalRef]: templateSlide
659
827
  },
660
828
  token: '1234',
661
- corrections: {}
829
+ corrections: {
830
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
831
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
832
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id),
833
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
834
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
835
+ },
836
+ rank: {}
662
837
  },
663
838
  ui: {
664
839
  currentSlideRef: templateSlide.universalRef,
@@ -709,7 +884,7 @@ test('should verify props when progression is in success', t => {
709
884
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
710
885
  });
711
886
 
712
- test('should verify props when progression has answered a current pendingslide', t => {
887
+ test('should verify props when progression has answered a current pendingSlide', t => {
713
888
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains but not yet the currentSlideRef
714
889
  const state: StoreState = {
715
890
  data: {
@@ -723,7 +898,14 @@ test('should verify props when progression has answered a current pendingslide',
723
898
  [templateSlide.universalRef]: templateSlide
724
899
  },
725
900
  token: '1234',
726
- corrections: {}
901
+ corrections: {
902
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
903
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
904
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
905
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
906
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
907
+ },
908
+ rank: {}
727
909
  },
728
910
  ui: {
729
911
  currentSlideRef: freeTextSlide.universalRef,
@@ -771,7 +953,7 @@ test('should verify props when progression has answered a current pendingslide',
771
953
  });
772
954
  });
773
955
 
774
- test('should verify props when progression has still pendingslide', t => {
956
+ test('should verify props when progression still has a pendingSlide', t => {
775
957
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains and it is the currentSlideRef
776
958
  const state: StoreState = {
777
959
  data: {
@@ -785,7 +967,14 @@ test('should verify props when progression has still pendingslide', t => {
785
967
  [templateSlide.universalRef]: templateSlide
786
968
  },
787
969
  token: '1234',
788
- corrections: {}
970
+ corrections: {
971
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
972
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
973
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
974
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
975
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
976
+ },
977
+ rank: {}
789
978
  },
790
979
  ui: {
791
980
  currentSlideRef: qcmSlide.universalRef,
@@ -40,7 +40,8 @@ const initialState: StoreState = {
40
40
  },
41
41
  skills: [],
42
42
  token: '1234',
43
- corrections: {}
43
+ corrections: {},
44
+ rank: {}
44
45
  },
45
46
  ui: {
46
47
  currentSlideRef: freeTextSlide._id,
@@ -65,6 +66,8 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
65
66
 
66
67
  const props = mapStateToSlidesProps(getState(), dispatch);
67
68
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
69
+ animateCorrectionPopin: false,
70
+ showCorrectionPopin: false,
68
71
  hidden: false,
69
72
  position: 0,
70
73
  loading: false,