@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
@@ -12,10 +12,10 @@ export const qcmGraphicSlide = {
12
12
  media: {
13
13
  src: [
14
14
  {
15
- _id: '624efd915948a7013083e986',
15
+ _id: '616dbbb61a50f8051c1971ba',
16
16
  mimeType: 'image/jpeg',
17
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
18
- id: '624efd915948a7013083e986'
17
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
18
+ id: '616dbbb61a50f8051c1971ba'
19
19
  }
20
20
  ],
21
21
  posters: [],
@@ -23,19 +23,19 @@ export const qcmGraphicSlide = {
23
23
  type: 'img'
24
24
  },
25
25
  items: [],
26
- _id: '624efd915948a7013083e985',
27
- label: 'Vrai',
28
- value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
29
- id: '624efd915948a7013083e985'
26
+ _id: '616dbbb61a50f8051c1971b9',
27
+ label: 'La consolidation des acquis',
28
+ value: 'sli_4k5O3zaN5.choice_E1ebZYyF8q',
29
+ id: '616dbbb61a50f8051c1971b9'
30
30
  },
31
31
  {
32
32
  media: {
33
33
  src: [
34
34
  {
35
- _id: '624efd915948a7013083e988',
35
+ _id: '616dbbb61a50f8051c1971bc',
36
36
  mimeType: 'image/jpeg',
37
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
38
- id: '624efd915948a7013083e988'
37
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
38
+ id: '616dbbb61a50f8051c1971bc'
39
39
  }
40
40
  ],
41
41
  posters: [],
@@ -43,19 +43,139 @@ export const qcmGraphicSlide = {
43
43
  type: 'img'
44
44
  },
45
45
  items: [],
46
- _id: '624efd915948a7013083e987',
47
- label: 'Faux',
48
- value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
49
- id: '624efd915948a7013083e987'
46
+ _id: '616dbbb61a50f8051c1971bb',
47
+ label: 'Le retour d’information',
48
+ value: 'sli_4k5O3zaN5.choice_NygF~FJFIc',
49
+ id: '616dbbb61a50f8051c1971bb'
50
+ },
51
+ {
52
+ media: {
53
+ src: [
54
+ {
55
+ _id: '616dbbb61a50f8051c1971be',
56
+ mimeType: 'image/jpeg',
57
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
58
+ id: '616dbbb61a50f8051c1971be'
59
+ }
60
+ ],
61
+ posters: [],
62
+ subtitles: [],
63
+ type: 'img'
64
+ },
65
+ items: [],
66
+ _id: '616dbbb61a50f8051c1971bd',
67
+ label: 'L’engagement actif',
68
+ value: 'sli_4k5O3zaN5.choice_4yx5bKJKIc',
69
+ id: '616dbbb61a50f8051c1971bd'
70
+ },
71
+ {
72
+ media: {
73
+ src: [
74
+ {
75
+ _id: '616dbbb61a50f8051c1971c0',
76
+ mimeType: 'image/jpeg',
77
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
78
+ id: '616dbbb61a50f8051c1971c0'
79
+ }
80
+ ],
81
+ posters: [],
82
+ subtitles: [],
83
+ type: 'img'
84
+ },
85
+ items: [],
86
+ _id: '616dbbb61a50f8051c1971bf',
87
+ label: 'La motivation',
88
+ value: 'sli_4k5O3zaN5.choice_VkzcZY1F8q',
89
+ id: '616dbbb61a50f8051c1971bf'
90
+ },
91
+ {
92
+ media: {
93
+ src: [
94
+ {
95
+ _id: '616dbbb61a50f8051c1971c2',
96
+ mimeType: 'image/jpeg',
97
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
98
+ id: '616dbbb61a50f8051c1971c2'
99
+ }
100
+ ],
101
+ posters: [],
102
+ subtitles: [],
103
+ type: 'img'
104
+ },
105
+ items: [],
106
+ _id: '616dbbb61a50f8051c1971c1',
107
+ label: 'L’attention',
108
+ value: 'sli_4k5O3zaN5.choice_Vken~YJFI5',
109
+ id: '616dbbb61a50f8051c1971c1'
110
+ },
111
+ {
112
+ media: {
113
+ src: [
114
+ {
115
+ _id: '616dbbb61a50f8051c1971c4',
116
+ mimeType: 'image/jpeg',
117
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
118
+ id: '616dbbb61a50f8051c1971c4'
119
+ }
120
+ ],
121
+ posters: [],
122
+ subtitles: [],
123
+ type: 'img'
124
+ },
125
+ items: [],
126
+ _id: '616dbbb61a50f8051c1971c3',
127
+ label: 'La confiance en soi',
128
+ value: 'sli_4k5O3zaN5.choice_4JgpWKkFLq',
129
+ id: '616dbbb61a50f8051c1971c3'
130
+ },
131
+ {
132
+ media: {
133
+ src: [
134
+ {
135
+ _id: '616dbbb61a50f8051c1971c6',
136
+ mimeType: 'image/jpeg',
137
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
138
+ id: '616dbbb61a50f8051c1971c6'
139
+ }
140
+ ],
141
+ posters: [],
142
+ subtitles: [],
143
+ type: 'img'
144
+ },
145
+ items: [],
146
+ _id: '616dbbb61a50f8051c1971c5',
147
+ label: 'La capacité d’abstraction',
148
+ value: 'sli_4k5O3zaN5.choice_NJfabKkK8q',
149
+ id: '616dbbb61a50f8051c1971c5'
150
+ },
151
+ {
152
+ media: {
153
+ src: [
154
+ {
155
+ _id: '616dbbb61a50f8051c1971c8',
156
+ mimeType: 'image/jpeg',
157
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
158
+ id: '616dbbb61a50f8051c1971c8'
159
+ }
160
+ ],
161
+ posters: [],
162
+ subtitles: [],
163
+ type: 'img'
164
+ },
165
+ items: [],
166
+ _id: '616dbbb61a50f8051c1971c7',
167
+ label: 'L’abnégation',
168
+ value: 'sli_4k5O3zaN5.choice_41xAWYJYI9',
169
+ id: '616dbbb61a50f8051c1971c7'
50
170
  }
51
171
  ]
52
172
  },
53
173
  type: 'qcmGraphic',
54
- header: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
55
- explanation: 'Sélectionnez la bonne réponse.'
174
+ header: 'Quels sont les 4 piliers de l’apprentissage ?',
175
+ explanation: 'Sélectionnez les 4 bonnes réponses.'
56
176
  },
57
- 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.",
58
- 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.",
177
+ 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.',
178
+ 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.',
59
179
  universalRef: 'sli_VkSQroQnx',
60
180
  _id: 'sli_VkSQroQnx',
61
181
  parentContentTitle: {
@@ -64,25 +184,67 @@ export const qcmGraphicSlide = {
64
184
  }
65
185
  };
66
186
  export const qcmGraphicUISlide = {
67
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
187
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?',
68
188
  answerUI: {
69
- help: 'Sélectionnez la bonne réponse.',
189
+ help: 'Sélectionnez les 4 bonnes réponses.',
70
190
  model: {
71
191
  type: 'qcmGraphic',
72
192
  answers: [
73
193
  {
74
- title: 'Vrai',
75
- image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
194
+ title: 'La consolidation des acquis',
195
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
196
+ selected: false,
197
+ ariaLabel: 'La consolidation des acquis',
198
+ onClick: noop
199
+ },
200
+ {
201
+ title: 'Le retour d’information',
202
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
203
+ selected: false,
204
+ ariaLabel: 'Le retour d’information',
205
+ onClick: noop
206
+ },
207
+ {
208
+ title: 'L’engagement actif',
209
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
210
+ selected: false,
211
+ ariaLabel: 'L’engagement actif',
212
+ onClick: noop
213
+ },
214
+ {
215
+ title: 'La motivation',
216
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
217
+ selected: false,
218
+ ariaLabel: 'La motivation',
219
+ onClick: noop
220
+ },
221
+ {
222
+ title: 'L’attention',
223
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
224
+ selected: false,
225
+ ariaLabel: 'L’attention',
226
+ onClick: noop
227
+ },
228
+ {
229
+ title: 'La confiance en soi',
230
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
231
+ selected: false,
232
+ ariaLabel: 'La confiance en soi',
233
+ onClick: noop
234
+ },
235
+ {
236
+ title: 'La capacité d’abstraction',
237
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
76
238
  selected: false,
77
- onClick: noop,
78
- ariaLabel: 'Vrai'
239
+ ariaLabel: 'La capacité d’abstraction',
240
+ onClick: noop
79
241
  },
80
242
  {
81
- title: 'Faux',
82
- image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
243
+ title: 'L’abnégation',
244
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
83
245
  selected: false,
84
- onClick: noop,
85
- ariaLabel: 'Faux'
246
+ ariaLabel: 'L’abnégation',
247
+ onClick: noop
86
248
  }
87
249
  ]
88
250
  }
@@ -2,13 +2,39 @@ import test from 'ava';
2
2
  import identity from 'lodash/fp/identity';
3
3
  import omit from 'lodash/fp/omit';
4
4
  import set from 'lodash/fp/set';
5
- import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide } from '../../../test/util/services.mock';
5
+ import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide, getChoicesCorrection, incorrectFreeTextPostAnswerResponse } from '../../../test/util/services.mock';
6
6
  import { mapStateToSlidesProps } from '..';
7
7
  import { freeTextSlide } from './fixtures/free-text';
8
8
  import { qcmGraphicSlide } from './fixtures/qcm-graphic';
9
9
  import { templateSlide } from './fixtures/template';
10
10
  import { qcmSlide } from './fixtures/qcm';
11
11
  import { sliderSlide } from './fixtures/slider';
12
+ const popinPropsRightAnswer = {
13
+ resultLabel: '_right',
14
+ information: {
15
+ label: '_klf',
16
+ message: '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.'
17
+ },
18
+ klf: undefined,
19
+ next: {
20
+ ariaLabel: '_correctionNextAriaLabel',
21
+ label: '_correctionNextLabel'
22
+ },
23
+ type: 'right'
24
+ };
25
+ const popinPropsWrongAnswer = {
26
+ ...popinPropsRightAnswer,
27
+ klf: {
28
+ label: '_klf',
29
+ tooltip: '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.'
30
+ },
31
+ type: 'wrong',
32
+ resultLabel: '_wrong',
33
+ information: {
34
+ label: '_correctAnswer',
35
+ message: 'Benchmark'
36
+ }
37
+ };
12
38
  test('should create initial props when fetched slide is not still received', t => {
13
39
  // SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
14
40
  const state = {
@@ -19,7 +45,8 @@ test('should create initial props when fetched slide is not still received', t =
19
45
  sli_N1XACJobn: null
20
46
  },
21
47
  token: '1234',
22
- corrections: {}
48
+ corrections: {},
49
+ rank: {}
23
50
  },
24
51
  ui: {
25
52
  currentSlideRef: '',
@@ -107,7 +134,8 @@ test('should create props when first slide is on the state', t => {
107
134
  sli_VJYjJnJhg: freeTextSlide
108
135
  },
109
136
  token: '1234',
110
- corrections: {}
137
+ corrections: {},
138
+ rank: {}
111
139
  },
112
140
  ui: {
113
141
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -158,6 +186,8 @@ test('should create props when first slide is on the state', t => {
158
186
  endReview: false
159
187
  });
160
188
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
189
+ animateCorrectionPopin: false,
190
+ showCorrectionPopin: false,
161
191
  hidden: false,
162
192
  position: 0,
163
193
  loading: false,
@@ -206,7 +236,8 @@ test('should create props when slide is on the state and user has selected answe
206
236
  sli_VJYjJnJhg: freeTextSlide
207
237
  },
208
238
  token: '1234',
209
- corrections: {}
239
+ corrections: {},
240
+ rank: {}
210
241
  },
211
242
  ui: {
212
243
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -257,6 +288,8 @@ test('should create props when slide is on the state and user has selected answe
257
288
  endReview: false
258
289
  });
259
290
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
291
+ animateCorrectionPopin: false,
292
+ showCorrectionPopin: false,
260
293
  hidden: false,
261
294
  position: 0,
262
295
  loading: false,
@@ -306,7 +339,8 @@ test('should verify props when first slide was answered correctly and next slide
306
339
  sli_VkSQroQnx: null
307
340
  },
308
341
  token: '1234',
309
- corrections: {}
342
+ corrections: {},
343
+ rank: {}
310
344
  },
311
345
  ui: {
312
346
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -357,6 +391,8 @@ test('should verify props when first slide was answered correctly and next slide
357
391
  endReview: false
358
392
  });
359
393
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
394
+ animateCorrectionPopin: false,
395
+ showCorrectionPopin: false,
360
396
  hidden: false,
361
397
  position: 0,
362
398
  loading: false,
@@ -406,7 +442,8 @@ test('should verify props when first slide was answered with error and next slid
406
442
  sli_VkSQroQnx: null
407
443
  },
408
444
  token: '1234',
409
- corrections: {}
445
+ corrections: {},
446
+ rank: {}
410
447
  },
411
448
  ui: {
412
449
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -453,7 +490,7 @@ test('should verify props when first slide was answered with error and next slid
453
490
  ]
454
491
  });
455
492
  });
456
- test('should verify props when first slide was answered and next slide is fecthed', t => {
493
+ test('should verify props when first slide was answered, next slide is fetched & correction is fetched', t => {
457
494
  // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
458
495
  const state = {
459
496
  data: {
@@ -464,14 +501,19 @@ test('should verify props when first slide was answered and next slide is fecthe
464
501
  sli_VkSQroQnx: qcmGraphicSlide
465
502
  },
466
503
  token: '1234',
467
- corrections: {}
504
+ corrections: {
505
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
506
+ },
507
+ rank: {}
468
508
  },
469
509
  ui: {
470
510
  currentSlideRef: 'sli_VJYjJnJhg',
471
511
  navigation: ['loader', 'slides'],
472
512
  answers: ['My value'],
473
513
  slide: {
474
- validateButton: false
514
+ validateButton: false,
515
+ animateCorrectionPopin: true,
516
+ showCorrectionPopin: true
475
517
  }
476
518
  }
477
519
  };
@@ -510,11 +552,13 @@ test('should verify props when first slide was answered and next slide is fecthe
510
552
  }
511
553
  ]
512
554
  });
513
- t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
514
- correctionPopinProps: undefined,
555
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
556
+ correctionPopinProps: popinPropsRightAnswer,
515
557
  endReview: false
516
558
  });
517
559
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
560
+ animateCorrectionPopin: true,
561
+ showCorrectionPopin: true,
518
562
  hidden: false,
519
563
  position: 0,
520
564
  loading: false,
@@ -530,11 +574,13 @@ test('should verify props when first slide was answered and next slide is fecthe
530
574
  }
531
575
  });
532
576
  t.deepEqual(omit('answerUI', props.stack.slides['1']), {
577
+ animateCorrectionPopin: false,
578
+ showCorrectionPopin: false,
533
579
  hidden: false,
534
580
  position: 1,
535
581
  loading: false,
536
582
  parentContentTitle: 'From "Developing the review app" course',
537
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
583
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
538
584
  });
539
585
  t.is(props.stack.validateButton.disabled, true);
540
586
  t.deepEqual(omit(['0', '1'], props.stack.slides), {
@@ -555,7 +601,118 @@ test('should verify props when first slide was answered and next slide is fecthe
555
601
  }
556
602
  });
557
603
  });
558
- test('should verify props when currentSlideRef has changed to nextContent of progression after first asnwered question', t => {
604
+ test('should verify props when first slide was answered incorrectly, next slide is fetched & correction is fetched', t => {
605
+ // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
606
+ const state = {
607
+ data: {
608
+ progression: incorrectFreeTextPostAnswerResponse,
609
+ skills: [],
610
+ slides: {
611
+ sli_VJYjJnJhg: freeTextSlide,
612
+ sli_VkSQroQnx: qcmGraphicSlide
613
+ },
614
+ token: '1234',
615
+ corrections: {
616
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id, true)
617
+ },
618
+ rank: {}
619
+ },
620
+ ui: {
621
+ currentSlideRef: 'sli_VJYjJnJhg',
622
+ navigation: ['loader', 'slides'],
623
+ answers: ['My value'],
624
+ slide: {
625
+ validateButton: false,
626
+ animateCorrectionPopin: true,
627
+ showCorrectionPopin: true
628
+ }
629
+ }
630
+ };
631
+ const props = mapStateToSlidesProps(state, identity);
632
+ t.is(props.congratsProps, undefined);
633
+ t.deepEqual(omit(['onQuitClick'], props.header), {
634
+ 'aria-label': 'aria-header-wrapper',
635
+ closeButtonAriaLabel: 'aria-close-button',
636
+ mode: '__revision_mode',
637
+ skillName: '__agility',
638
+ steps: [
639
+ {
640
+ current: true,
641
+ icon: 'wrong',
642
+ value: '1'
643
+ },
644
+ {
645
+ current: false,
646
+ icon: 'no-answer',
647
+ value: '2'
648
+ },
649
+ {
650
+ current: false,
651
+ icon: 'no-answer',
652
+ value: '3'
653
+ },
654
+ {
655
+ current: false,
656
+ icon: 'no-answer',
657
+ value: '4'
658
+ },
659
+ {
660
+ current: false,
661
+ icon: 'no-answer',
662
+ value: '5'
663
+ }
664
+ ]
665
+ });
666
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
667
+ correctionPopinProps: popinPropsWrongAnswer,
668
+ endReview: false
669
+ });
670
+ t.deepEqual(omit('answerUI', props.stack.slides['0']), {
671
+ animateCorrectionPopin: true,
672
+ showCorrectionPopin: true,
673
+ hidden: false,
674
+ position: 0,
675
+ loading: false,
676
+ parentContentTitle: 'From "Developing the review app" course',
677
+ questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
678
+ });
679
+ t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
680
+ help: 'Type your answer.',
681
+ model: {
682
+ placeholder: 'Type here',
683
+ type: 'freeText',
684
+ value: 'My value'
685
+ }
686
+ });
687
+ t.deepEqual(omit('answerUI', props.stack.slides['1']), {
688
+ animateCorrectionPopin: false,
689
+ showCorrectionPopin: false,
690
+ hidden: false,
691
+ position: 1,
692
+ loading: false,
693
+ parentContentTitle: 'From "Developing the review app" course',
694
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
695
+ });
696
+ t.is(props.stack.validateButton.disabled, true);
697
+ t.deepEqual(omit(['0', '1'], props.stack.slides), {
698
+ '2': {
699
+ hidden: false,
700
+ position: 2,
701
+ loading: true
702
+ },
703
+ '3': {
704
+ hidden: false,
705
+ position: 3,
706
+ loading: true
707
+ },
708
+ '4': {
709
+ hidden: false,
710
+ position: 4,
711
+ loading: true
712
+ }
713
+ });
714
+ });
715
+ test('should verify props when currentSlideRef has changed to nextContent of progression after first answered question', t => {
559
716
  // state after click on NEXT_SLIDE
560
717
  const state = {
561
718
  data: {
@@ -566,7 +723,10 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
566
723
  sli_VkSQroQnx: qcmGraphicSlide
567
724
  },
568
725
  token: '1234',
569
- corrections: {}
726
+ corrections: {
727
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
728
+ },
729
+ rank: {}
570
730
  },
571
731
  ui: {
572
732
  currentSlideRef: 'sli_VkSQroQnx',
@@ -628,7 +788,14 @@ test('should verify props when progression is in success', t => {
628
788
  [templateSlide.universalRef]: templateSlide
629
789
  },
630
790
  token: '1234',
631
- corrections: {}
791
+ corrections: {
792
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
793
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
794
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id),
795
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
796
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
797
+ },
798
+ rank: {}
632
799
  },
633
800
  ui: {
634
801
  currentSlideRef: templateSlide.universalRef,
@@ -676,7 +843,7 @@ test('should verify props when progression is in success', t => {
676
843
  });
677
844
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
678
845
  });
679
- test('should verify props when progression has answered a current pendingslide', t => {
846
+ test('should verify props when progression has answered a current pendingSlide', t => {
680
847
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains but not yet the currentSlideRef
681
848
  const state = {
682
849
  data: {
@@ -690,7 +857,14 @@ test('should verify props when progression has answered a current pendingslide',
690
857
  [templateSlide.universalRef]: templateSlide
691
858
  },
692
859
  token: '1234',
693
- corrections: {}
860
+ corrections: {
861
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
862
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
863
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
864
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
865
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
866
+ },
867
+ rank: {}
694
868
  },
695
869
  ui: {
696
870
  currentSlideRef: freeTextSlide.universalRef,
@@ -736,7 +910,7 @@ test('should verify props when progression has answered a current pendingslide',
736
910
  ]
737
911
  });
738
912
  });
739
- test('should verify props when progression has still pendingslide', t => {
913
+ test('should verify props when progression still has a pendingSlide', t => {
740
914
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains and it is the currentSlideRef
741
915
  const state = {
742
916
  data: {
@@ -750,7 +924,14 @@ test('should verify props when progression has still pendingslide', t => {
750
924
  [templateSlide.universalRef]: templateSlide
751
925
  },
752
926
  token: '1234',
753
- corrections: {}
927
+ corrections: {
928
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
929
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
930
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
931
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
932
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
933
+ },
934
+ rank: {}
754
935
  },
755
936
  ui: {
756
937
  currentSlideRef: qcmSlide.universalRef,
@@ -35,7 +35,8 @@ const initialState = {
35
35
  },
36
36
  skills: [],
37
37
  token: '1234',
38
- corrections: {}
38
+ corrections: {},
39
+ rank: {}
39
40
  },
40
41
  ui: {
41
42
  currentSlideRef: freeTextSlide._id,
@@ -57,6 +58,8 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
57
58
  const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
58
59
  const props = mapStateToSlidesProps(getState(), dispatch);
59
60
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
61
+ animateCorrectionPopin: false,
62
+ showCorrectionPopin: false,
60
63
  hidden: false,
61
64
  position: 0,
62
65
  loading: false,