@coorpacademy/player-web 4.2.11 → 4.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/es/map-state-to-props/test/answer.js +390 -0
  2. package/es/map-state-to-props/test/answer.js.map +1 -0
  3. package/es/map-state-to-props/test/fixtures/player/clue.json +131 -0
  4. package/es/map-state-to-props/test/fixtures/player/loading-clue.json +131 -0
  5. package/es/map-state-to-props/test/fixtures/player/no-clue.json +118 -0
  6. package/es/map-state-to-props/test/fixtures/player/slide-no-lessons.json +115 -0
  7. package/es/map-state-to-props/test/fixtures/player/slide.json +127 -0
  8. package/es/map-state-to-props/test/fixtures/popin-correction/popin-extra-life.json +139 -0
  9. package/es/map-state-to-props/test/fixtures/popin-correction/popin-failure.json +145 -0
  10. package/es/map-state-to-props/test/fixtures/popin-correction/popin-next-level.json +282 -0
  11. package/es/map-state-to-props/test/fixtures/popin-correction/popin-revival.json +140 -0
  12. package/es/map-state-to-props/test/fixtures/popin-correction/popin-success-node.json +154 -0
  13. package/es/map-state-to-props/test/fixtures/popin-correction/popin-success.json +268 -0
  14. package/es/map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers.json +473 -0
  15. package/es/map-state-to-props/test/fixtures/popin-end/fail.json +205 -0
  16. package/es/map-state-to-props/test/fixtures/popin-end/learner-adaptive-failure.json +209 -0
  17. package/es/map-state-to-props/test/fixtures/popin-end/learner-failure-with-redirection.json +211 -0
  18. package/es/map-state-to-props/test/fixtures/popin-end/learner-failure.json +211 -0
  19. package/es/map-state-to-props/test/fixtures/popin-end/learner-success-with-redirection.json +278 -0
  20. package/es/map-state-to-props/test/fixtures/popin-end/learner-success.json +275 -0
  21. package/es/map-state-to-props/test/fixtures/popin-end/success.json +223 -0
  22. package/es/map-state-to-props/test/fixtures/progression-learner.json +102 -0
  23. package/es/map-state-to-props/test/fixtures/progression-state.json +45 -0
  24. package/es/map-state-to-props/test/fixtures/slides/basic.json +60 -0
  25. package/es/map-state-to-props/test/fixtures/slides/plop.json +56 -0
  26. package/es/map-state-to-props/test/fixtures/slides/qcm-drag.json +56 -0
  27. package/es/map-state-to-props/test/fixtures/slides/qcm-graphic.json +49 -0
  28. package/es/map-state-to-props/test/fixtures/slides/qcm.json +43 -0
  29. package/es/map-state-to-props/test/fixtures/slides/slider.json +57 -0
  30. package/es/map-state-to-props/test/fixtures/slides/template.json +49 -0
  31. package/es/map-state-to-props/test/fixtures/slides/videos.json +163 -0
  32. package/es/map-state-to-props/test/fixtures/slides/with-context.json +69 -0
  33. package/es/map-state-to-props/test/header.js +131 -0
  34. package/es/map-state-to-props/test/header.js.map +1 -0
  35. package/es/map-state-to-props/test/index.js +107 -0
  36. package/es/map-state-to-props/test/index.js.map +1 -0
  37. package/es/map-state-to-props/test/player.js +680 -0
  38. package/es/map-state-to-props/test/player.js.map +1 -0
  39. package/es/map-state-to-props/test/popin-correction.create-header-cta.js +301 -0
  40. package/es/map-state-to-props/test/popin-correction.create-header-cta.js.map +1 -0
  41. package/es/map-state-to-props/test/popin-correction.js +80 -0
  42. package/es/map-state-to-props/test/popin-correction.js.map +1 -0
  43. package/es/map-state-to-props/test/popin-end.js +313 -0
  44. package/es/map-state-to-props/test/popin-end.js.map +1 -0
  45. package/es/map-state-to-props/test/popin-error.js +77 -0
  46. package/es/map-state-to-props/test/popin-error.js.map +1 -0
  47. package/es/map-state-to-props/test/resources.js +31 -0
  48. package/es/map-state-to-props/test/resources.js.map +1 -0
  49. package/es/test/add-timeout.js +8 -0
  50. package/es/test/add-timeout.js.map +1 -0
  51. package/es/test/helpers/css-register.js +3 -0
  52. package/es/test/helpers/css-register.js.map +1 -0
  53. package/es/test/helpers/macro.js +6 -0
  54. package/es/test/helpers/macro.js.map +1 -0
  55. package/es/test/index.js +39 -0
  56. package/es/test/index.js.map +1 -0
  57. package/es/test/init-reducers.js +50 -0
  58. package/es/test/init-reducers.js.map +1 -0
  59. package/es/test/locales.js +8 -0
  60. package/es/test/locales.js.map +1 -0
  61. package/es/test/run-app.js +20 -0
  62. package/es/test/run-app.js.map +1 -0
  63. package/es/test/store.js +38 -0
  64. package/es/test/store.js.map +1 -0
  65. package/es/views/test/helpers/render.js +13 -0
  66. package/es/views/test/helpers/render.js.map +1 -0
  67. package/es/views/test/helpers/state-to-vnode.js +7 -0
  68. package/es/views/test/helpers/state-to-vnode.js.map +1 -0
  69. package/es/views/test/loading.js +15 -0
  70. package/es/views/test/loading.js.map +1 -0
  71. package/es/views/test/popin-correction.js +223 -0
  72. package/es/views/test/popin-correction.js.map +1 -0
  73. package/es/views/test/popin-end.js +93 -0
  74. package/es/views/test/popin-end.js.map +1 -0
  75. package/es/views/test/router.js +22 -0
  76. package/es/views/test/router.js.map +1 -0
  77. package/es/views/test/slide.js +335 -0
  78. package/es/views/test/slide.js.map +1 -0
  79. package/lib/map-state-to-props/test/answer.js +408 -0
  80. package/lib/map-state-to-props/test/answer.js.map +1 -0
  81. package/lib/map-state-to-props/test/fixtures/player/clue.json +131 -0
  82. package/lib/map-state-to-props/test/fixtures/player/loading-clue.json +131 -0
  83. package/lib/map-state-to-props/test/fixtures/player/no-clue.json +118 -0
  84. package/lib/map-state-to-props/test/fixtures/player/slide-no-lessons.json +115 -0
  85. package/lib/map-state-to-props/test/fixtures/player/slide.json +127 -0
  86. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-extra-life.json +139 -0
  87. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-failure.json +145 -0
  88. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-next-level.json +282 -0
  89. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-revival.json +140 -0
  90. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-success-node.json +154 -0
  91. package/lib/map-state-to-props/test/fixtures/popin-correction/popin-success.json +268 -0
  92. package/lib/map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers.json +473 -0
  93. package/lib/map-state-to-props/test/fixtures/popin-end/fail.json +205 -0
  94. package/lib/map-state-to-props/test/fixtures/popin-end/learner-adaptive-failure.json +209 -0
  95. package/lib/map-state-to-props/test/fixtures/popin-end/learner-failure-with-redirection.json +211 -0
  96. package/lib/map-state-to-props/test/fixtures/popin-end/learner-failure.json +211 -0
  97. package/lib/map-state-to-props/test/fixtures/popin-end/learner-success-with-redirection.json +278 -0
  98. package/lib/map-state-to-props/test/fixtures/popin-end/learner-success.json +275 -0
  99. package/lib/map-state-to-props/test/fixtures/popin-end/success.json +223 -0
  100. package/lib/map-state-to-props/test/fixtures/progression-learner.json +102 -0
  101. package/lib/map-state-to-props/test/fixtures/progression-state.json +45 -0
  102. package/lib/map-state-to-props/test/fixtures/slides/basic.json +60 -0
  103. package/lib/map-state-to-props/test/fixtures/slides/plop.json +56 -0
  104. package/lib/map-state-to-props/test/fixtures/slides/qcm-drag.json +56 -0
  105. package/lib/map-state-to-props/test/fixtures/slides/qcm-graphic.json +49 -0
  106. package/lib/map-state-to-props/test/fixtures/slides/qcm.json +43 -0
  107. package/lib/map-state-to-props/test/fixtures/slides/slider.json +57 -0
  108. package/lib/map-state-to-props/test/fixtures/slides/template.json +49 -0
  109. package/lib/map-state-to-props/test/fixtures/slides/videos.json +163 -0
  110. package/lib/map-state-to-props/test/fixtures/slides/with-context.json +69 -0
  111. package/lib/map-state-to-props/test/header.js +143 -0
  112. package/lib/map-state-to-props/test/header.js.map +1 -0
  113. package/lib/map-state-to-props/test/index.js +100 -0
  114. package/lib/map-state-to-props/test/index.js.map +1 -0
  115. package/lib/map-state-to-props/test/player.js +714 -0
  116. package/lib/map-state-to-props/test/player.js.map +1 -0
  117. package/lib/map-state-to-props/test/popin-correction.create-header-cta.js +315 -0
  118. package/lib/map-state-to-props/test/popin-correction.create-header-cta.js.map +1 -0
  119. package/lib/map-state-to-props/test/popin-correction.js +85 -0
  120. package/lib/map-state-to-props/test/popin-correction.js.map +1 -0
  121. package/lib/map-state-to-props/test/popin-end.js +328 -0
  122. package/lib/map-state-to-props/test/popin-end.js.map +1 -0
  123. package/lib/map-state-to-props/test/popin-error.js +85 -0
  124. package/lib/map-state-to-props/test/popin-error.js.map +1 -0
  125. package/lib/map-state-to-props/test/resources.js +42 -0
  126. package/lib/map-state-to-props/test/resources.js.map +1 -0
  127. package/lib/test/add-timeout.js +14 -0
  128. package/lib/test/add-timeout.js.map +1 -0
  129. package/lib/test/helpers/css-register.js +8 -0
  130. package/lib/test/helpers/css-register.js.map +1 -0
  131. package/lib/test/helpers/macro.js +12 -0
  132. package/lib/test/helpers/macro.js.map +1 -0
  133. package/lib/test/index.js +53 -0
  134. package/lib/test/index.js.map +1 -0
  135. package/lib/test/init-reducers.js +57 -0
  136. package/lib/test/init-reducers.js.map +1 -0
  137. package/lib/test/locales.js +18 -0
  138. package/lib/test/locales.js.map +1 -0
  139. package/lib/test/run-app.js +27 -0
  140. package/lib/test/run-app.js.map +1 -0
  141. package/lib/test/store.js +45 -0
  142. package/lib/test/store.js.map +1 -0
  143. package/lib/views/test/helpers/render.js +24 -0
  144. package/lib/views/test/helpers/render.js.map +1 -0
  145. package/lib/views/test/helpers/state-to-vnode.js +14 -0
  146. package/lib/views/test/helpers/state-to-vnode.js.map +1 -0
  147. package/lib/views/test/loading.js +22 -0
  148. package/lib/views/test/loading.js.map +1 -0
  149. package/lib/views/test/popin-correction.js +237 -0
  150. package/lib/views/test/popin-correction.js.map +1 -0
  151. package/lib/views/test/popin-end.js +105 -0
  152. package/lib/views/test/popin-end.js.map +1 -0
  153. package/lib/views/test/router.js +32 -0
  154. package/lib/views/test/router.js.map +1 -0
  155. package/lib/views/test/slide.js +359 -0
  156. package/lib/views/test/slide.js.map +1 -0
  157. package/package.json +4 -3
@@ -0,0 +1,408 @@
1
+ "use strict";
2
+
3
+ var _pick2 = _interopRequireDefault(require("lodash/fp/pick"));
4
+
5
+ var _map2 = _interopRequireDefault(require("lodash/fp/map"));
6
+
7
+ var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
8
+
9
+ var _sortBy2 = _interopRequireDefault(require("lodash/fp/sortBy"));
10
+
11
+ var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
12
+
13
+ var _isFunction2 = _interopRequireDefault(require("lodash/fp/isFunction"));
14
+
15
+ var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
16
+
17
+ var _ava = _interopRequireDefault(require("ava"));
18
+
19
+ var _translate = require("@coorpacademy/translate");
20
+
21
+ var _answer = require("../answer");
22
+
23
+ var _basic = _interopRequireDefault(require("./fixtures/slides/basic"));
24
+
25
+ var _qcm = _interopRequireDefault(require("./fixtures/slides/qcm"));
26
+
27
+ var _qcmDrag = _interopRequireDefault(require("./fixtures/slides/qcm-drag"));
28
+
29
+ var _qcmGraphic = _interopRequireDefault(require("./fixtures/slides/qcm-graphic"));
30
+
31
+ var _template = _interopRequireDefault(require("./fixtures/slides/template"));
32
+
33
+ var _slider = _interopRequireDefault(require("./fixtures/slides/slider"));
34
+
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
+
37
+ const options = {
38
+ translate: _translate.mockTranslate
39
+ };
40
+ const store = {
41
+ dispatch: _identity2.default
42
+ };
43
+ const getAnswerProps = (0, _answer.createGetAnswerProps)(options, store);
44
+ const getHelp = (0, _answer.createGetHelp)(options, store);
45
+ (0, _ava.default)('should create initial qcm props', t => {
46
+ t.plan(3);
47
+ const state = {
48
+ ui: {
49
+ current: {
50
+ progressionId: '1234'
51
+ }
52
+ }
53
+ };
54
+
55
+ const _getAnswerProps = (0, _answer.createGetAnswerProps)(options, {
56
+ dispatch: thunk => {
57
+ t.true((0, _isFunction2.default)(thunk));
58
+ }
59
+ });
60
+
61
+ const props = _getAnswerProps(state, _qcm.default);
62
+
63
+ t.is(props.type, 'qcm');
64
+ t.true(props.answers.every(answer => answer.selected === false));
65
+ props.answers[0].onClick();
66
+ });
67
+ (0, _ava.default)('should create edited qcm props', t => {
68
+ const state = {
69
+ ui: {
70
+ answers: {
71
+ 1234: {
72
+ value: ['Case 1', 'Case 3']
73
+ }
74
+ },
75
+ current: {
76
+ progressionId: '1234'
77
+ }
78
+ }
79
+ };
80
+ const props = getAnswerProps(state, _qcm.default);
81
+ t.is(props.type, 'qcm');
82
+ t.is(props.answers.length, 4);
83
+ t.is(props.answers[0].title, 'Case 1');
84
+ t.true(props.answers[0].selected);
85
+ t.is(props.answers[1].title, 'Case 2');
86
+ t.false(props.answers[1].selected);
87
+ t.is(props.answers[2].title, 'Case 3');
88
+ t.true(props.answers[2].selected);
89
+ t.is(props.answers[3].title, 'Case 4');
90
+ t.false(props.answers[3].selected);
91
+ t.true((0, _isFunction2.default)(props.answers[0].onClick));
92
+ });
93
+ (0, _ava.default)('should create edited template props', t => {
94
+ t.plan(23);
95
+ const state = {
96
+ ui: {
97
+ answers: {
98
+ 1234: {
99
+ value: ['foo', 'exclusive']
100
+ }
101
+ },
102
+ current: {
103
+ progressionId: '1234'
104
+ }
105
+ }
106
+ };
107
+
108
+ const _getAnswerProps = (0, _answer.createGetAnswerProps)(options, {
109
+ dispatch: thunk => {
110
+ t.true((0, _isFunction2.default)(thunk));
111
+ }
112
+ });
113
+
114
+ const props = _getAnswerProps(state, _template.default);
115
+
116
+ t.is(props.type, 'template');
117
+ t.is(props.template, 'The answer is {{inp81438}} {{sel31191}}');
118
+ t.true(Array.isArray(props.answers));
119
+ t.is(props.answers.length, 2);
120
+ t.is(props.answers[0].type, 'text');
121
+ t.is(props.answers[0].name, 'inp81438');
122
+ t.is(props.answers[0].placeholder, '__Type here');
123
+ t.is(props.answers[0].value, 'foo');
124
+ t.true((0, _isFunction2.default)(props.answers[0].onChange));
125
+ t.is(props.answers[1].type, 'select');
126
+ t.is(props.answers[1].name, 'sel31191');
127
+ t.true((0, _isFunction2.default)(props.answers[1].onChange));
128
+ const selectOptions = props.answers[1].options;
129
+ t.true(Array.isArray(selectOptions));
130
+ t.is(selectOptions.length, 2);
131
+ t.is(selectOptions[0].name, 'temporary');
132
+ t.is(selectOptions[0].value, 'temporary');
133
+ t.false(selectOptions[0].selected);
134
+ t.true(selectOptions[0].validOption);
135
+ t.is(selectOptions[1].name, 'exclusive');
136
+ t.is(selectOptions[1].value, 'exclusive');
137
+ t.true(selectOptions[1].selected);
138
+ t.true(selectOptions[1].validOption);
139
+ props.answers[1].onChange();
140
+ });
141
+ (0, _ava.default)('should add an invalid `select an answer` choice for a select field in a template question if there are no answers for it', t => {
142
+ t.plan(13);
143
+ const state = {
144
+ ui: {
145
+ answers: {},
146
+ current: {
147
+ progressionId: '1234'
148
+ }
149
+ }
150
+ };
151
+
152
+ const _getAnswerProps = (0, _answer.createGetAnswerProps)(options, {
153
+ dispatch: thunk => {
154
+ t.true((0, _isFunction2.default)(thunk));
155
+ }
156
+ });
157
+
158
+ const props = _getAnswerProps(state, _template.default);
159
+
160
+ const selectOptions = props.answers[1].options;
161
+ t.is(selectOptions.length, 3);
162
+ t.is(selectOptions[0].name, '__Select an answer');
163
+ t.true(selectOptions[0].selected);
164
+ t.false(selectOptions[0].validOption);
165
+ t.is(selectOptions[1].name, 'temporary');
166
+ t.is(selectOptions[1].value, 'temporary');
167
+ t.false(selectOptions[1].selected);
168
+ t.true(selectOptions[1].validOption);
169
+ t.is(selectOptions[2].name, 'exclusive');
170
+ t.is(selectOptions[2].value, 'exclusive');
171
+ t.false(selectOptions[2].selected);
172
+ t.true(selectOptions[2].validOption);
173
+ props.answers[1].onChange();
174
+ });
175
+ (0, _ava.default)('should create initial qcmGraphic props', t => {
176
+ const state = {
177
+ ui: {
178
+ answers: {},
179
+ current: {
180
+ progressionId: '1234'
181
+ }
182
+ }
183
+ };
184
+ const props = getAnswerProps(state, _qcmGraphic.default);
185
+ t.is(props.type, 'qcmGraphic');
186
+ t.is(props.answers.length, 2);
187
+ t.true(props.answers.every(answer => answer.selected === false));
188
+ });
189
+ (0, _ava.default)('should create edited qcmGraphic props', t => {
190
+ t.plan(5);
191
+ const state = {
192
+ data: {
193
+ configs: {
194
+ entities: {
195
+ 'learner@2': {
196
+ version: '2',
197
+ shuffleChoices: true
198
+ }
199
+ }
200
+ },
201
+ progressions: {
202
+ entities: {
203
+ 1234: {
204
+ engine: {
205
+ ref: 'learner',
206
+ version: '2'
207
+ }
208
+ }
209
+ }
210
+ }
211
+ },
212
+ ui: {
213
+ answers: {
214
+ 1234: {
215
+ value: ['Vrai']
216
+ }
217
+ },
218
+ current: {
219
+ progressionId: '1234'
220
+ }
221
+ }
222
+ };
223
+
224
+ const _getAnswerProps = (0, _answer.createGetAnswerProps)(options, {
225
+ dispatch: thunk => {
226
+ t.true((0, _isFunction2.default)(thunk));
227
+ }
228
+ });
229
+
230
+ const props = _getAnswerProps(state, _qcmGraphic.default);
231
+
232
+ t.is(props.type, 'qcmGraphic');
233
+ t.is(props.answers.length, 2);
234
+ const answers = (0, _pipe2.default)((0, _map2.default)((0, _pick2.default)(['title', 'selected'])), (0, _sortBy2.default)('title'))(props.answers);
235
+ t.deepEqual(answers, [{
236
+ title: 'Faux',
237
+ selected: false
238
+ }, {
239
+ title: 'Vrai',
240
+ selected: true
241
+ }]);
242
+ t.true((0, _isFunction2.default)(props.answers[0].onClick));
243
+ props.answers[0].onClick();
244
+ });
245
+ (0, _ava.default)('should create initial qcmDrag props', t => {
246
+ const state = {
247
+ ui: {
248
+ answers: {},
249
+ current: {
250
+ progressionId: '1234'
251
+ }
252
+ }
253
+ };
254
+ const props = getAnswerProps(state, _qcmDrag.default);
255
+ t.is(props.type, 'qcmDrag');
256
+ t.is(props.answers.length, 3);
257
+ t.is(props.answers[0].title, "L'ordinateur");
258
+ t.false(props.answers[0].selected);
259
+ t.true((0, _isFunction2.default)(props.answers[0].onClick));
260
+ t.is(props.answers[1].title, 'La tablette');
261
+ t.false(props.answers[1].selected);
262
+ t.true((0, _isFunction2.default)(props.answers[1].onClick));
263
+ t.is(props.answers[2].title, 'Le smartphone');
264
+ t.false(props.answers[2].selected);
265
+ t.true((0, _isFunction2.default)(props.answers[2].onClick));
266
+ });
267
+ (0, _ava.default)('should create edited qcmDrag props', t => {
268
+ t.plan(14);
269
+ const state = {
270
+ ui: {
271
+ answers: {
272
+ 1234: {
273
+ value: ['Le smartphone', "L'ordinateur"]
274
+ }
275
+ },
276
+ current: {
277
+ progressionId: '1234'
278
+ }
279
+ }
280
+ };
281
+
282
+ const _getAnswerProps = (0, _answer.createGetAnswerProps)(options, {
283
+ dispatch: thunk => {
284
+ t.true((0, _isFunction2.default)(thunk));
285
+ }
286
+ });
287
+
288
+ const props = _getAnswerProps(state, _qcmDrag.default);
289
+
290
+ t.is(props.type, 'qcmDrag');
291
+ t.is(props.answers.length, 3);
292
+ t.is(props.answers[0].title, "L'ordinateur");
293
+ t.true(props.answers[0].selected);
294
+ t.is(props.answers[0].order, 1);
295
+ t.true((0, _isFunction2.default)(props.answers[0].onClick));
296
+ t.is(props.answers[1].title, 'La tablette');
297
+ t.false(props.answers[1].selected);
298
+ t.true((0, _isFunction2.default)(props.answers[1].onClick));
299
+ t.is(props.answers[2].title, 'Le smartphone');
300
+ t.true(props.answers[2].selected);
301
+ t.is(props.answers[2].order, 0);
302
+ t.true((0, _isFunction2.default)(props.answers[2].onClick));
303
+ props.answers[2].onClick();
304
+ });
305
+ (0, _ava.default)('should create initial slider props', t => {
306
+ t.plan(8);
307
+ const state = {
308
+ ui: {
309
+ answers: {},
310
+ current: {
311
+ progressionId: '1234'
312
+ }
313
+ }
314
+ };
315
+
316
+ const dispatch = action => {
317
+ t.pass();
318
+ };
319
+
320
+ const props = (0, _answer.createGetAnswerProps)(options, {
321
+ dispatch
322
+ })(state, _slider.default);
323
+ t.is(props.type, 'slider');
324
+ t.is(props.placeholder, 'Déplacez le curseur.');
325
+ t.is(props.minLabel, '0 an(s)');
326
+ t.is(props.maxLabel, '1000 an(s)');
327
+ t.is(props.title, '500 an(s)');
328
+ t.is(props.value, 0.5);
329
+ t.true((0, _isFunction2.default)(props.onChange));
330
+ props.onChange(0.87);
331
+ });
332
+ (0, _ava.default)('should default slider step to 1', t => {
333
+ t.plan(2);
334
+ const state = {
335
+ ui: {
336
+ answers: {},
337
+ current: {
338
+ progressionId: '1234'
339
+ }
340
+ }
341
+ };
342
+
343
+ const dispatch = action => {
344
+ t.pass();
345
+ };
346
+
347
+ const props = (0, _answer.createGetAnswerProps)(options, {
348
+ dispatch
349
+ })(state, (0, _omit2.default)('question.content.step', _slider.default));
350
+ t.true((0, _isFunction2.default)(props.onChange));
351
+ props.onChange(0.87);
352
+ });
353
+ (0, _ava.default)('should create edited slider props', t => {
354
+ const state = {
355
+ ui: {
356
+ answers: {
357
+ 1234: {
358
+ value: ['300']
359
+ }
360
+ },
361
+ current: {
362
+ progressionId: '1234'
363
+ }
364
+ }
365
+ };
366
+ const props = getAnswerProps(state, _slider.default);
367
+ t.is(props.title, '300 an(s)');
368
+ t.is(props.value, 0.3);
369
+ });
370
+ (0, _ava.default)('should create initial basic props', t => {
371
+ const state = {
372
+ ui: {
373
+ answers: {},
374
+ current: {
375
+ progressionId: null
376
+ }
377
+ }
378
+ };
379
+ const props = getAnswerProps(state, _basic.default);
380
+ t.is(props.type, 'freeText');
381
+ });
382
+ (0, _ava.default)('should create edited basic props', t => {
383
+ const state = {
384
+ ui: {
385
+ answers: {
386
+ 1234: {
387
+ value: ['foo']
388
+ }
389
+ },
390
+ current: {
391
+ progressionId: '1234'
392
+ }
393
+ }
394
+ };
395
+ const props = getAnswerProps(state, _basic.default);
396
+ t.is(props.type, 'freeText');
397
+ t.is(props.value, 'foo');
398
+ t.true((0, _isFunction2.default)(props.onChange));
399
+ });
400
+ (0, _ava.default)('should provide an help subtitle depending on question.type', t => {
401
+ const help = getHelp(_qcmDrag.default);
402
+ t.is(help, 'Cliquez sur les réponses dans le bon ordre.');
403
+ const help1 = getHelp(_template.default);
404
+ t.is(help1, 'Type your answers');
405
+ const help2 = getHelp(_qcm.default);
406
+ t.is(help2, '__Select something below');
407
+ });
408
+ //# sourceMappingURL=answer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer.js","names":["options","translate","mockTranslate","store","dispatch","getAnswerProps","createGetAnswerProps","getHelp","createGetHelp","test","t","plan","state","ui","current","progressionId","_getAnswerProps","thunk","true","props","qcm","is","type","answers","every","answer","selected","onClick","value","length","title","false","template","Array","isArray","name","placeholder","onChange","selectOptions","validOption","qcmGraphic","data","configs","entities","version","shuffleChoices","progressions","engine","ref","deepEqual","qcmDrag","order","action","pass","slider","minLabel","maxLabel","basic","help","help1","help2"],"sources":["../../../src/map-state-to-props/test/answer.js"],"sourcesContent":["import test from 'ava';\nimport {omit, isFunction, identity, sortBy, pipe, map, pick} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {createGetAnswerProps, createGetHelp} from '../answer';\nimport basic from './fixtures/slides/basic';\nimport qcm from './fixtures/slides/qcm';\nimport qcmDrag from './fixtures/slides/qcm-drag';\nimport qcmGraphic from './fixtures/slides/qcm-graphic';\nimport template from './fixtures/slides/template';\nimport slider from './fixtures/slides/slider';\n\nconst options = {translate: mockTranslate};\nconst store = {dispatch: identity};\nconst getAnswerProps = createGetAnswerProps(options, store);\nconst getHelp = createGetHelp(options, store);\n\ntest('should create initial qcm props', t => {\n t.plan(3);\n\n const state = {\n ui: {\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.true(props.answers.every(answer => answer.selected === false));\n\n props.answers[0].onClick();\n});\n\ntest('should create edited qcm props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['Case 1', 'Case 3']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.is(props.answers.length, 4);\n t.is(props.answers[0].title, 'Case 1');\n t.true(props.answers[0].selected);\n t.is(props.answers[1].title, 'Case 2');\n t.false(props.answers[1].selected);\n t.is(props.answers[2].title, 'Case 3');\n t.true(props.answers[2].selected);\n t.is(props.answers[3].title, 'Case 4');\n t.false(props.answers[3].selected);\n t.true(isFunction(props.answers[0].onClick));\n});\n\ntest('should create edited template props', t => {\n t.plan(23);\n\n const state = {\n ui: {\n answers: {1234: {value: ['foo', 'exclusive']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n t.is(props.type, 'template');\n t.is(props.template, 'The answer is {{inp81438}} {{sel31191}}');\n t.true(Array.isArray(props.answers));\n t.is(props.answers.length, 2);\n t.is(props.answers[0].type, 'text');\n t.is(props.answers[0].name, 'inp81438');\n t.is(props.answers[0].placeholder, '__Type here');\n t.is(props.answers[0].value, 'foo');\n t.true(isFunction(props.answers[0].onChange));\n t.is(props.answers[1].type, 'select');\n t.is(props.answers[1].name, 'sel31191');\n t.true(isFunction(props.answers[1].onChange));\n const selectOptions = props.answers[1].options;\n t.true(Array.isArray(selectOptions));\n t.is(selectOptions.length, 2);\n t.is(selectOptions[0].name, 'temporary');\n t.is(selectOptions[0].value, 'temporary');\n t.false(selectOptions[0].selected);\n t.true(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'exclusive');\n t.is(selectOptions[1].value, 'exclusive');\n t.true(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should add an invalid `select an answer` choice for a select field in a template question if there are no answers for it', t => {\n t.plan(13);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n const selectOptions = props.answers[1].options;\n\n t.is(selectOptions.length, 3);\n t.is(selectOptions[0].name, '__Select an answer');\n t.true(selectOptions[0].selected);\n t.false(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'temporary');\n t.is(selectOptions[1].value, 'temporary');\n t.false(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n t.is(selectOptions[2].name, 'exclusive');\n t.is(selectOptions[2].value, 'exclusive');\n t.false(selectOptions[2].selected);\n t.true(selectOptions[2].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should create initial qcmGraphic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmGraphic);\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n t.true(props.answers.every(answer => answer.selected === false));\n});\n\ntest('should create edited qcmGraphic props', t => {\n t.plan(5);\n const state = {\n data: {\n configs: {\n entities: {\n 'learner@2': {\n version: '2',\n shuffleChoices: true\n }\n }\n },\n progressions: {\n entities: {\n 1234: {\n engine: {\n ref: 'learner',\n version: '2'\n }\n }\n }\n }\n },\n ui: {\n answers: {1234: {value: ['Vrai']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmGraphic);\n\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n\n const answers = pipe(map(pick(['title', 'selected'])), sortBy('title'))(props.answers);\n t.deepEqual(answers, [\n {title: 'Faux', selected: false},\n {title: 'Vrai', selected: true}\n ]);\n\n t.true(isFunction(props.answers[0].onClick));\n\n props.answers[0].onClick();\n});\n\ntest('should create initial qcmDrag props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmDrag);\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.false(props.answers[0].selected);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.false(props.answers[2].selected);\n t.true(isFunction(props.answers[2].onClick));\n});\n\ntest('should create edited qcmDrag props', t => {\n t.plan(14);\n const state = {\n ui: {\n answers: {1234: {value: ['Le smartphone', \"L'ordinateur\"]}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmDrag);\n\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.true(props.answers[0].selected);\n t.is(props.answers[0].order, 1);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.true(props.answers[2].selected);\n t.is(props.answers[2].order, 0);\n t.true(isFunction(props.answers[2].onClick));\n\n props.answers[2].onClick();\n});\n\ntest('should create initial slider props', t => {\n t.plan(8);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(state, slider);\n\n t.is(props.type, 'slider');\n t.is(props.placeholder, 'Déplacez le curseur.');\n t.is(props.minLabel, '0 an(s)');\n t.is(props.maxLabel, '1000 an(s)');\n t.is(props.title, '500 an(s)');\n t.is(props.value, 0.5);\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should default slider step to 1', t => {\n t.plan(2);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(\n state,\n omit('question.content.step', slider)\n );\n\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should create edited slider props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['300']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, slider);\n t.is(props.title, '300 an(s)');\n t.is(props.value, 0.3);\n});\n\ntest('should create initial basic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: null}\n }\n };\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n});\n\ntest('should create edited basic props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['foo']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n t.is(props.value, 'foo');\n t.true(isFunction(props.onChange));\n});\n\ntest('should provide an help subtitle depending on question.type', t => {\n const help = getHelp(qcmDrag);\n t.is(help, 'Cliquez sur les réponses dans le bon ordre.');\n const help1 = getHelp(template);\n t.is(help1, 'Type your answers');\n const help2 = getHelp(qcm);\n t.is(help2, '__Select something below');\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,GAAG;EAACC,SAAS,EAAEC;AAAZ,CAAhB;AACA,MAAMC,KAAK,GAAG;EAACC,QAAQ;AAAT,CAAd;AACA,MAAMC,cAAc,GAAG,IAAAC,4BAAA,EAAqBN,OAArB,EAA8BG,KAA9B,CAAvB;AACA,MAAMI,OAAO,GAAG,IAAAC,qBAAA,EAAcR,OAAd,EAAuBG,KAAvB,CAAhB;AAEA,IAAAM,YAAA,EAAK,iCAAL,EAAwCC,CAAC,IAAI;EAC3CA,CAAC,CAACC,IAAF,CAAO,CAAP;EAEA,MAAMC,KAAK,GAAG;IACZC,EAAE,EAAE;MACFC,OAAO,EAAE;QAACC,aAAa,EAAE;MAAhB;IADP;EADQ,CAAd;;EAMA,MAAMC,eAAe,GAAG,IAAAV,4BAAA,EAAqBN,OAArB,EAA8B;IACpDI,QAAQ,EAAEa,KAAK,IAAI;MACjBP,CAAC,CAACQ,IAAF,CAAO,0BAAWD,KAAX,CAAP;IACD;EAHmD,CAA9B,CAAxB;;EAMA,MAAME,KAAK,GAAGH,eAAe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AZ;EACA,MAAMC,KAAK,GAAGrD,OAAO,CAACa,YAAD,CAArB;EACAV,CAAC,CAACW,EAAF,CAAKuC,KAAL,EAAY,0BAAZ;AACD,CAPD"}
@@ -0,0 +1,131 @@
1
+ {
2
+ "data": {
3
+ "configs": {
4
+ "entities": {
5
+ "microlearning@1": {
6
+ "version": 1
7
+ }
8
+ }
9
+ },
10
+ "clues": {
11
+ "entities": {
12
+ "0": {
13
+ "1.B2.4": "Clue"
14
+ }
15
+ }
16
+ },
17
+ "contents": {
18
+ "chapter": {
19
+ "entities": {
20
+ "cha_Ny1BTxRp~": {
21
+ "info": {
22
+ "nbSlides": 4
23
+ }
24
+ }
25
+ }
26
+ },
27
+ "slide": {
28
+ "entities": {
29
+ "1.B2.4": {
30
+ "_id": "1.B2.4",
31
+ "klf": "Some KLF",
32
+ "tips": "XXX",
33
+ "hasClue": true,
34
+ "chapter_id": "cha_Ny1BTxRp~",
35
+ "authors": [],
36
+ "context": {
37
+ "media": {
38
+ "subtitles": [],
39
+ "posters": [],
40
+ "src": []
41
+ }
42
+ },
43
+ "lessons": [
44
+ {
45
+ "type": "video",
46
+ "poster": "//static.coorpacademy.com/content/digital/miniatures_cours/base/1B2.png",
47
+ "description": "Anatomie d'une page de résultats",
48
+ "mimeType": "application/vimeo",
49
+ "videoId": "88393119\n",
50
+ "_id": "590b862e2e967f64333ad456",
51
+ "subtitles": [],
52
+ "posters": [],
53
+ "src": []
54
+ }
55
+ ],
56
+ "question": {
57
+ "type": "basic",
58
+ "header": "Écrivez le mot Text dans l'input.\n",
59
+ "explanation": "Saisissez votre réponse.",
60
+ "content": {
61
+ "label": "Saisissez votre réponse.",
62
+ "placeholder": " ",
63
+ "maxTypos": null,
64
+ "choices": [],
65
+ "answers": [["Text"]],
66
+ "media": {
67
+ "subtitles": [],
68
+ "posters": [],
69
+ "src": []
70
+ }
71
+ },
72
+ "medias": []
73
+ }
74
+ }
75
+ }
76
+ }
77
+ },
78
+ "progressions": {
79
+ "entities": {
80
+ "0": {
81
+ "_id": "0",
82
+ "engine": {
83
+ "ref": "microlearning",
84
+ "version": "1"
85
+ },
86
+ "content": {
87
+ "ref": "cha_Ny1BTxRp~",
88
+ "type": "chapter"
89
+ },
90
+ "state": {
91
+ "slides": ["1.B2.3"],
92
+ "content": {
93
+ "ref": "1.B2.3",
94
+ "type": "slide"
95
+ },
96
+ "nextContent": {
97
+ "ref": "1.B2.4",
98
+ "type": "slide"
99
+ },
100
+ "lives": 1,
101
+ "step": {
102
+ "current": 2
103
+ },
104
+ "isCorrect": false,
105
+ "stars": 0,
106
+ "requestedClues": [],
107
+ "viewedResources": []
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "exitNodes": {
113
+ "entities": {}
114
+ }
115
+ },
116
+ "ui": {
117
+ "answers": {
118
+ "0": {
119
+ "isCorrect": false,
120
+ "correction": [["Text"]]
121
+ }
122
+ },
123
+ "current": {
124
+ "progressionId": "0"
125
+ },
126
+ "corrections": {},
127
+ "route": {
128
+ "0": "clue"
129
+ }
130
+ }
131
+ }