@coorpacademy/app-review 0.2.7 → 0.2.9-alpha.5

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 (104) 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/services/index.js +2 -0
  24. package/es/test/util/services.mock.d.ts +1 -0
  25. package/es/test/util/services.mock.js +21 -1
  26. package/es/types/common.d.ts +1 -0
  27. package/es/views/skills/test/skills.test.js +4 -2
  28. package/es/views/slides/index.d.ts +21 -19
  29. package/es/views/slides/index.js +29 -3
  30. package/es/views/slides/test/fixtures/qcm-graphic.js +190 -28
  31. package/es/views/slides/test/index.test.js +200 -19
  32. package/es/views/slides/test/slide.free-text.on-change.test.js +4 -1
  33. package/es/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  34. package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  35. package/es/views/slides/test/slide.qcm.on-click.test.js +4 -1
  36. package/es/views/slides/test/slide.slider.on-change.test.js +4 -1
  37. package/es/views/slides/test/slide.template.on-change.test.js +6 -1
  38. package/lib/actions/api/fetch-rank.d.ts +32 -0
  39. package/lib/actions/api/fetch-rank.js +32 -0
  40. package/lib/actions/api/test/fetch-correction.test.js +2 -1
  41. package/lib/actions/api/test/fetch-rank.test.d.ts +1 -0
  42. package/lib/actions/api/test/fetch-rank.test.js +171 -0
  43. package/lib/actions/api/test/fetch-skills.test.js +2 -1
  44. package/lib/actions/api/test/fetch-slide.test.js +2 -1
  45. package/lib/actions/api/test/post-answer.test.js +2 -1
  46. package/lib/actions/api/test/post-progression.test.js +2 -1
  47. package/lib/actions/data/test/token.test.js +2 -1
  48. package/lib/actions/ui/test/answers.test.js +2 -1
  49. package/lib/actions/ui/test/slides.test.js +2 -1
  50. package/lib/reducers/data/corrections.d.ts +1 -1
  51. package/lib/reducers/data/index.d.ts +4 -1
  52. package/lib/reducers/data/index.js +2 -1
  53. package/lib/reducers/data/rank.d.ts +7 -0
  54. package/lib/reducers/data/rank.js +37 -0
  55. package/lib/reducers/data/test/rank.test.d.ts +1 -0
  56. package/lib/reducers/data/test/rank.test.js +59 -0
  57. package/lib/reducers/index.d.ts +4 -3
  58. package/lib/reducers/ui/slide.d.ts +1 -0
  59. package/lib/reducers/ui/slide.js +1 -1
  60. package/lib/services/index.js +2 -0
  61. package/lib/test/util/services.mock.d.ts +1 -0
  62. package/lib/test/util/services.mock.js +12 -1
  63. package/lib/types/common.d.ts +1 -0
  64. package/lib/views/skills/test/skills.test.js +4 -2
  65. package/lib/views/slides/index.d.ts +21 -19
  66. package/lib/views/slides/index.js +29 -3
  67. package/lib/views/slides/test/fixtures/qcm-graphic.js +190 -28
  68. package/lib/views/slides/test/index.test.js +211 -22
  69. package/lib/views/slides/test/slide.free-text.on-change.test.js +4 -1
  70. package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  71. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  72. package/lib/views/slides/test/slide.qcm.on-click.test.js +4 -1
  73. package/lib/views/slides/test/slide.slider.on-change.test.js +4 -1
  74. package/lib/views/slides/test/slide.template.on-change.test.js +6 -1
  75. package/package.json +4 -4
  76. package/src/actions/api/fetch-rank.ts +84 -0
  77. package/src/actions/api/test/fetch-correction.test.ts +2 -1
  78. package/src/actions/api/test/fetch-rank.test.ts +130 -0
  79. package/src/actions/api/test/fetch-skills.test.ts +2 -1
  80. package/src/actions/api/test/fetch-slide.test.ts +2 -1
  81. package/src/actions/api/test/post-answer.test.ts +2 -1
  82. package/src/actions/api/test/post-progression.test.ts +2 -1
  83. package/src/actions/data/test/token.test.ts +2 -1
  84. package/src/actions/ui/test/answers.test.ts +2 -1
  85. package/src/actions/ui/test/slides.test.ts +2 -1
  86. package/src/reducers/data/corrections.ts +1 -1
  87. package/src/reducers/data/index.ts +3 -1
  88. package/src/reducers/data/rank.ts +60 -0
  89. package/src/reducers/data/test/rank.test.ts +78 -0
  90. package/src/reducers/index.ts +2 -2
  91. package/src/reducers/ui/slide.ts +2 -1
  92. package/src/services/index.ts +2 -0
  93. package/src/test/util/services.mock.ts +23 -1
  94. package/src/types/common.ts +1 -0
  95. package/src/views/skills/test/skills.test.ts +4 -2
  96. package/src/views/slides/index.ts +65 -22
  97. package/src/views/slides/test/fixtures/qcm-graphic.ts +196 -29
  98. package/src/views/slides/test/index.test.ts +210 -21
  99. package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -1
  100. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -1
  101. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +6 -4
  102. package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -1
  103. package/src/views/slides/test/slide.slider.on-change.test.ts +4 -1
  104. package/src/views/slides/test/slide.template.on-change.test.ts +6 -1
@@ -12,10 +12,10 @@ export var 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 var 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 var 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 var qcmGraphicSlide = {
64
184
  }
65
185
  };
66
186
  export var 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
  }
@@ -1,14 +1,45 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import test from 'ava';
2
13
  import identity from 'lodash/fp/identity';
3
14
  import omit from 'lodash/fp/omit';
4
15
  import set from 'lodash/fp/set';
5
- import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide } from '../../../test/util/services.mock';
16
+ import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide, getChoicesCorrection, incorrectFreeTextPostAnswerResponse } from '../../../test/util/services.mock';
6
17
  import { mapStateToSlidesProps } from '..';
7
18
  import { freeTextSlide } from './fixtures/free-text';
8
19
  import { qcmGraphicSlide } from './fixtures/qcm-graphic';
9
20
  import { templateSlide } from './fixtures/template';
10
21
  import { qcmSlide } from './fixtures/qcm';
11
22
  import { sliderSlide } from './fixtures/slider';
23
+ var popinPropsRightAnswer = {
24
+ resultLabel: '_right',
25
+ information: {
26
+ label: '_klf',
27
+ 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.'
28
+ },
29
+ klf: undefined,
30
+ next: {
31
+ ariaLabel: '_correctionNextAriaLabel',
32
+ label: '_correctionNextLabel'
33
+ },
34
+ type: 'right'
35
+ };
36
+ var popinPropsWrongAnswer = __assign(__assign({}, popinPropsRightAnswer), { klf: {
37
+ label: '_klf',
38
+ 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.'
39
+ }, type: 'wrong', resultLabel: '_wrong', information: {
40
+ label: '_correctAnswer',
41
+ message: 'Benchmark'
42
+ } });
12
43
  test('should create initial props when fetched slide is not still received', function (t) {
13
44
  // SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
14
45
  var state = {
@@ -19,7 +50,8 @@ test('should create initial props when fetched slide is not still received', fun
19
50
  sli_N1XACJobn: null
20
51
  },
21
52
  token: '1234',
22
- corrections: {}
53
+ corrections: {},
54
+ rank: {}
23
55
  },
24
56
  ui: {
25
57
  currentSlideRef: '',
@@ -107,7 +139,8 @@ test('should create props when first slide is on the state', function (t) {
107
139
  sli_VJYjJnJhg: freeTextSlide
108
140
  },
109
141
  token: '1234',
110
- corrections: {}
142
+ corrections: {},
143
+ rank: {}
111
144
  },
112
145
  ui: {
113
146
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -158,6 +191,8 @@ test('should create props when first slide is on the state', function (t) {
158
191
  endReview: false
159
192
  });
160
193
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
194
+ animateCorrectionPopin: false,
195
+ showCorrectionPopin: false,
161
196
  hidden: false,
162
197
  position: 0,
163
198
  loading: false,
@@ -206,7 +241,8 @@ test('should create props when slide is on the state and user has selected answe
206
241
  sli_VJYjJnJhg: freeTextSlide
207
242
  },
208
243
  token: '1234',
209
- corrections: {}
244
+ corrections: {},
245
+ rank: {}
210
246
  },
211
247
  ui: {
212
248
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -257,6 +293,8 @@ test('should create props when slide is on the state and user has selected answe
257
293
  endReview: false
258
294
  });
259
295
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
296
+ animateCorrectionPopin: false,
297
+ showCorrectionPopin: false,
260
298
  hidden: false,
261
299
  position: 0,
262
300
  loading: false,
@@ -306,7 +344,8 @@ test('should verify props when first slide was answered correctly and next slide
306
344
  sli_VkSQroQnx: null
307
345
  },
308
346
  token: '1234',
309
- corrections: {}
347
+ corrections: {},
348
+ rank: {}
310
349
  },
311
350
  ui: {
312
351
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -357,6 +396,8 @@ test('should verify props when first slide was answered correctly and next slide
357
396
  endReview: false
358
397
  });
359
398
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
399
+ animateCorrectionPopin: false,
400
+ showCorrectionPopin: false,
360
401
  hidden: false,
361
402
  position: 0,
362
403
  loading: false,
@@ -406,7 +447,8 @@ test('should verify props when first slide was answered with error and next slid
406
447
  sli_VkSQroQnx: null
407
448
  },
408
449
  token: '1234',
409
- corrections: {}
450
+ corrections: {},
451
+ rank: {}
410
452
  },
411
453
  ui: {
412
454
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -453,7 +495,8 @@ test('should verify props when first slide was answered with error and next slid
453
495
  ]
454
496
  });
455
497
  });
456
- test('should verify props when first slide was answered and next slide is fecthed', function (t) {
498
+ test('should verify props when first slide was answered, next slide is fetched & correction is fetched', function (t) {
499
+ var _a;
457
500
  // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
458
501
  var state = {
459
502
  data: {
@@ -464,14 +507,19 @@ test('should verify props when first slide was answered and next slide is fecthe
464
507
  sli_VkSQroQnx: qcmGraphicSlide
465
508
  },
466
509
  token: '1234',
467
- corrections: {}
510
+ corrections: (_a = {},
511
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
512
+ _a),
513
+ rank: {}
468
514
  },
469
515
  ui: {
470
516
  currentSlideRef: 'sli_VJYjJnJhg',
471
517
  navigation: ['loader', 'slides'],
472
518
  answers: ['My value'],
473
519
  slide: {
474
- validateButton: false
520
+ validateButton: false,
521
+ animateCorrectionPopin: true,
522
+ showCorrectionPopin: true
475
523
  }
476
524
  }
477
525
  };
@@ -510,11 +558,13 @@ test('should verify props when first slide was answered and next slide is fecthe
510
558
  }
511
559
  ]
512
560
  });
513
- t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
514
- correctionPopinProps: undefined,
561
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
562
+ correctionPopinProps: popinPropsRightAnswer,
515
563
  endReview: false
516
564
  });
517
565
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
566
+ animateCorrectionPopin: true,
567
+ showCorrectionPopin: true,
518
568
  hidden: false,
519
569
  position: 0,
520
570
  loading: false,
@@ -530,11 +580,13 @@ test('should verify props when first slide was answered and next slide is fecthe
530
580
  }
531
581
  });
532
582
  t.deepEqual(omit('answerUI', props.stack.slides['1']), {
583
+ animateCorrectionPopin: false,
584
+ showCorrectionPopin: false,
533
585
  hidden: false,
534
586
  position: 1,
535
587
  loading: false,
536
588
  parentContentTitle: 'From "Developing the review app" course',
537
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
589
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
538
590
  });
539
591
  t.is(props.stack.validateButton.disabled, true);
540
592
  t.deepEqual(omit(['0', '1'], props.stack.slides), {
@@ -555,7 +607,120 @@ test('should verify props when first slide was answered and next slide is fecthe
555
607
  }
556
608
  });
557
609
  });
558
- test('should verify props when currentSlideRef has changed to nextContent of progression after first asnwered question', function (t) {
610
+ test('should verify props when first slide was answered incorrectly, next slide is fetched & correction is fetched', function (t) {
611
+ var _a;
612
+ // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
613
+ var state = {
614
+ data: {
615
+ progression: incorrectFreeTextPostAnswerResponse,
616
+ skills: [],
617
+ slides: {
618
+ sli_VJYjJnJhg: freeTextSlide,
619
+ sli_VkSQroQnx: qcmGraphicSlide
620
+ },
621
+ token: '1234',
622
+ corrections: (_a = {},
623
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id, true),
624
+ _a),
625
+ rank: {}
626
+ },
627
+ ui: {
628
+ currentSlideRef: 'sli_VJYjJnJhg',
629
+ navigation: ['loader', 'slides'],
630
+ answers: ['My value'],
631
+ slide: {
632
+ validateButton: false,
633
+ animateCorrectionPopin: true,
634
+ showCorrectionPopin: true
635
+ }
636
+ }
637
+ };
638
+ var props = mapStateToSlidesProps(state, identity);
639
+ t.is(props.congratsProps, undefined);
640
+ t.deepEqual(omit(['onQuitClick'], props.header), {
641
+ 'aria-label': 'aria-header-wrapper',
642
+ closeButtonAriaLabel: 'aria-close-button',
643
+ mode: '__revision_mode',
644
+ skillName: '__agility',
645
+ steps: [
646
+ {
647
+ current: true,
648
+ icon: 'wrong',
649
+ value: '1'
650
+ },
651
+ {
652
+ current: false,
653
+ icon: 'no-answer',
654
+ value: '2'
655
+ },
656
+ {
657
+ current: false,
658
+ icon: 'no-answer',
659
+ value: '3'
660
+ },
661
+ {
662
+ current: false,
663
+ icon: 'no-answer',
664
+ value: '4'
665
+ },
666
+ {
667
+ current: false,
668
+ icon: 'no-answer',
669
+ value: '5'
670
+ }
671
+ ]
672
+ });
673
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
674
+ correctionPopinProps: popinPropsWrongAnswer,
675
+ endReview: false
676
+ });
677
+ t.deepEqual(omit('answerUI', props.stack.slides['0']), {
678
+ animateCorrectionPopin: true,
679
+ showCorrectionPopin: true,
680
+ hidden: false,
681
+ position: 0,
682
+ loading: false,
683
+ parentContentTitle: 'From "Developing the review app" course',
684
+ questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
685
+ });
686
+ t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
687
+ help: 'Type your answer.',
688
+ model: {
689
+ placeholder: 'Type here',
690
+ type: 'freeText',
691
+ value: 'My value'
692
+ }
693
+ });
694
+ t.deepEqual(omit('answerUI', props.stack.slides['1']), {
695
+ animateCorrectionPopin: false,
696
+ showCorrectionPopin: false,
697
+ hidden: false,
698
+ position: 1,
699
+ loading: false,
700
+ parentContentTitle: 'From "Developing the review app" course',
701
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
702
+ });
703
+ t.is(props.stack.validateButton.disabled, true);
704
+ t.deepEqual(omit(['0', '1'], props.stack.slides), {
705
+ '2': {
706
+ hidden: false,
707
+ position: 2,
708
+ loading: true
709
+ },
710
+ '3': {
711
+ hidden: false,
712
+ position: 3,
713
+ loading: true
714
+ },
715
+ '4': {
716
+ hidden: false,
717
+ position: 4,
718
+ loading: true
719
+ }
720
+ });
721
+ });
722
+ test('should verify props when currentSlideRef has changed to nextContent of progression after first answered question', function (t) {
723
+ var _a;
559
724
  // state after click on NEXT_SLIDE
560
725
  var state = {
561
726
  data: {
@@ -566,7 +731,10 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
566
731
  sli_VkSQroQnx: qcmGraphicSlide
567
732
  },
568
733
  token: '1234',
569
- corrections: {}
734
+ corrections: (_a = {},
735
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
736
+ _a),
737
+ rank: {}
570
738
  },
571
739
  ui: {
572
740
  currentSlideRef: 'sli_VkSQroQnx',
@@ -615,7 +783,7 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
615
783
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
616
784
  });
617
785
  test('should verify props when progression is in success', function (t) {
618
- var _a;
786
+ var _a, _b;
619
787
  // state after receive last POST_ANSWER_SUCCESS and before last NEXT_SLIDE
620
788
  var state = {
621
789
  data: {
@@ -629,7 +797,14 @@ test('should verify props when progression is in success', function (t) {
629
797
  _a[templateSlide.universalRef] = templateSlide,
630
798
  _a),
631
799
  token: '1234',
632
- corrections: {}
800
+ corrections: (_b = {},
801
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
802
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
803
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id),
804
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
805
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
806
+ _b),
807
+ rank: {}
633
808
  },
634
809
  ui: {
635
810
  currentSlideRef: templateSlide.universalRef,
@@ -677,8 +852,8 @@ test('should verify props when progression is in success', function (t) {
677
852
  });
678
853
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
679
854
  });
680
- test('should verify props when progression has answered a current pendingslide', function (t) {
681
- var _a;
855
+ test('should verify props when progression has answered a current pendingSlide', function (t) {
856
+ var _a, _b;
682
857
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains but not yet the currentSlideRef
683
858
  var state = {
684
859
  data: {
@@ -692,7 +867,14 @@ test('should verify props when progression has answered a current pendingslide',
692
867
  _a[templateSlide.universalRef] = templateSlide,
693
868
  _a),
694
869
  token: '1234',
695
- corrections: {}
870
+ corrections: (_b = {},
871
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
872
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
873
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id, true),
874
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
875
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
876
+ _b),
877
+ rank: {}
696
878
  },
697
879
  ui: {
698
880
  currentSlideRef: freeTextSlide.universalRef,
@@ -738,8 +920,8 @@ test('should verify props when progression has answered a current pendingslide',
738
920
  ]
739
921
  });
740
922
  });
741
- test('should verify props when progression has still pendingslide', function (t) {
742
- var _a;
923
+ test('should verify props when progression still has a pendingSlide', function (t) {
924
+ var _a, _b;
743
925
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains and it is the currentSlideRef
744
926
  var state = {
745
927
  data: {
@@ -753,7 +935,14 @@ test('should verify props when progression has still pendingslide', function (t)
753
935
  _a[templateSlide.universalRef] = templateSlide,
754
936
  _a),
755
937
  token: '1234',
756
- corrections: {}
938
+ corrections: (_b = {},
939
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
940
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
941
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id, true),
942
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
943
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
944
+ _b),
945
+ rank: {}
757
946
  },
758
947
  ui: {
759
948
  currentSlideRef: qcmSlide.universalRef,