@coorpacademy/app-review 0.4.5 → 0.5.1-alpha.26
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.
- package/es/actions/ui/next-slide.d.ts +4 -2
- package/es/actions/ui/next-slide.js +7 -4
- package/es/actions/ui/quit-popin.d.ts +8 -0
- package/es/actions/ui/quit-popin.js +8 -0
- package/es/actions/ui/slides.d.ts +2 -3
- package/es/common/index.d.ts +2 -0
- package/es/common/index.js +9 -0
- package/es/reducers/index.d.ts +7 -1
- package/es/reducers/ui/answers.d.ts +2 -2
- package/es/reducers/ui/current-slide-ref.d.ts +3 -2
- package/es/reducers/ui/current-slide-ref.js +3 -0
- package/es/reducers/ui/index.d.ts +11 -1
- package/es/reducers/ui/index.js +5 -1
- package/es/reducers/ui/positions.d.ts +5 -0
- package/es/reducers/ui/positions.js +25 -0
- package/es/reducers/ui/quit-popin.d.ts +4 -0
- package/es/reducers/ui/quit-popin.js +16 -0
- package/es/reducers/ui/slide.d.ts +2 -2
- package/es/views/slides/index.d.ts +19 -2
- package/es/views/slides/index.js +45 -25
- package/lib/actions/ui/next-slide.d.ts +4 -2
- package/lib/actions/ui/next-slide.js +7 -4
- package/lib/actions/ui/quit-popin.d.ts +8 -0
- package/lib/actions/ui/quit-popin.js +8 -0
- package/lib/actions/ui/slides.d.ts +2 -3
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +9 -0
- package/lib/reducers/index.d.ts +7 -1
- package/lib/reducers/ui/answers.d.ts +2 -2
- package/lib/reducers/ui/current-slide-ref.d.ts +3 -2
- package/lib/reducers/ui/current-slide-ref.js +3 -0
- package/lib/reducers/ui/index.d.ts +11 -1
- package/lib/reducers/ui/index.js +5 -1
- package/lib/reducers/ui/positions.d.ts +5 -0
- package/lib/reducers/ui/positions.js +26 -0
- package/lib/reducers/ui/quit-popin.d.ts +4 -0
- package/lib/reducers/ui/quit-popin.js +17 -0
- package/lib/reducers/ui/slide.d.ts +2 -2
- package/lib/views/slides/index.d.ts +19 -2
- package/lib/views/slides/index.js +47 -26
- package/package.json +10 -11
- package/src/actions/api/test/fetch-correction.test.ts +3 -1
- package/src/actions/api/test/fetch-rank.test.ts +3 -1
- package/src/actions/api/test/fetch-skills.test.ts +3 -1
- package/src/actions/api/test/fetch-slide.test.ts +3 -1
- package/src/actions/api/test/post-answer.test.ts +6 -2
- package/src/actions/api/test/post-progression.test.ts +3 -1
- package/src/actions/data/test/token.test.ts +3 -1
- package/src/actions/ui/next-slide.ts +15 -9
- package/src/actions/ui/quit-popin.ts +10 -0
- package/src/actions/ui/slides.ts +2 -4
- package/src/actions/ui/test/answers.test.ts +3 -1
- package/src/actions/ui/test/next-slide.test.ts +9 -3
- package/src/actions/ui/test/quit-popin.test.ts +38 -0
- package/src/actions/ui/test/slides.test.ts +3 -1
- package/src/common/index.ts +12 -0
- package/src/common/test/get-progression-slide-ref.test.ts +35 -0
- package/src/reducers/ui/answers.ts +2 -2
- package/src/reducers/ui/current-slide-ref.ts +5 -2
- package/src/reducers/ui/index.ts +7 -1
- package/src/reducers/ui/positions.ts +32 -0
- package/src/reducers/ui/quit-popin.ts +22 -0
- package/src/reducers/ui/slide.ts +7 -2
- package/src/reducers/ui/test/answers.test.ts +3 -1
- package/src/reducers/ui/test/current-slide-ref.test.ts +2 -2
- package/src/reducers/ui/test/positions.test.ts +68 -0
- package/src/reducers/ui/test/quit-popin.test.ts +24 -0
- package/src/reducers/ui/test/slide.test.ts +3 -1
- package/src/types/common.ts +0 -1
- package/src/views/skills/test/skills.test.ts +6 -2
- package/src/views/slides/index.ts +70 -32
- package/src/views/slides/test/header.on-click.test.ts +42 -0
- package/src/views/slides/test/index.test.ts +90 -42
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +64 -0
- package/src/views/slides/test/slide.free-text.on-change.test.ts +3 -2
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +10 -2
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-change.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +17 -4
- package/src/views/slides/test/slide.template.on-change.test.ts +11 -11
- package/es/actions/ui/is-fetching.d.ts +0 -10
- package/es/actions/ui/is-fetching.js +0 -4
- package/lib/actions/ui/is-fetching.d.ts +0 -10
- package/lib/actions/ui/is-fetching.js +0 -4
- package/src/actions/ui/is-fetching.ts +0 -13
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import omit from 'lodash/fp/omit';
|
|
4
|
+
import pick from 'lodash/fp/pick';
|
|
4
5
|
import set from 'lodash/fp/set';
|
|
5
6
|
import {
|
|
6
7
|
postProgressionResponse as createdProgression,
|
|
@@ -34,13 +35,15 @@ test('should create initial props when fetched slide is not still received', t =
|
|
|
34
35
|
currentSlideRef: '',
|
|
35
36
|
navigation: ['loader', 'slides'],
|
|
36
37
|
answers: {},
|
|
38
|
+
positions: [0, 1, 2, 3, 4],
|
|
37
39
|
slide: {
|
|
38
40
|
sli_N1XACJobn: {
|
|
39
41
|
validateButton: false,
|
|
40
42
|
animateCorrectionPopin: false,
|
|
41
43
|
showCorrectionPopin: false
|
|
42
44
|
}
|
|
43
|
-
}
|
|
45
|
+
},
|
|
46
|
+
showQuitPopin: false
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
|
|
@@ -84,27 +87,22 @@ test('should create initial props when fetched slide is not still received', t =
|
|
|
84
87
|
endReview: false,
|
|
85
88
|
slides: {
|
|
86
89
|
'0': {
|
|
87
|
-
hidden: false,
|
|
88
90
|
position: 0,
|
|
89
91
|
loading: true
|
|
90
92
|
},
|
|
91
93
|
'1': {
|
|
92
|
-
hidden: false,
|
|
93
94
|
position: 1,
|
|
94
95
|
loading: true
|
|
95
96
|
},
|
|
96
97
|
'2': {
|
|
97
|
-
hidden: false,
|
|
98
98
|
position: 2,
|
|
99
99
|
loading: true
|
|
100
100
|
},
|
|
101
101
|
'3': {
|
|
102
|
-
hidden: false,
|
|
103
102
|
position: 3,
|
|
104
103
|
loading: true
|
|
105
104
|
},
|
|
106
105
|
'4': {
|
|
107
|
-
hidden: false,
|
|
108
106
|
position: 4,
|
|
109
107
|
loading: true
|
|
110
108
|
}
|
|
@@ -129,13 +127,15 @@ test('should create props when first slide is on the state', t => {
|
|
|
129
127
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
130
128
|
navigation: ['loader', 'slides'],
|
|
131
129
|
answers: {},
|
|
130
|
+
positions: [0, 1, 2, 3, 4],
|
|
132
131
|
slide: {
|
|
133
132
|
sli_VJYjJnJhg: {
|
|
134
133
|
validateButton: false,
|
|
135
134
|
animateCorrectionPopin: false,
|
|
136
135
|
showCorrectionPopin: false
|
|
137
136
|
}
|
|
138
|
-
}
|
|
137
|
+
},
|
|
138
|
+
showQuitPopin: false
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
|
|
@@ -182,7 +182,6 @@ test('should create props when first slide is on the state', t => {
|
|
|
182
182
|
animationType: undefined,
|
|
183
183
|
animateCorrectionPopin: false,
|
|
184
184
|
showCorrectionPopin: false,
|
|
185
|
-
hidden: false,
|
|
186
185
|
position: 0,
|
|
187
186
|
loading: false,
|
|
188
187
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -200,22 +199,18 @@ test('should create props when first slide is on the state', t => {
|
|
|
200
199
|
});
|
|
201
200
|
t.deepEqual(omit(['0'], props.stack.slides), {
|
|
202
201
|
'1': {
|
|
203
|
-
hidden: false,
|
|
204
202
|
position: 1,
|
|
205
203
|
loading: true
|
|
206
204
|
},
|
|
207
205
|
'2': {
|
|
208
|
-
hidden: false,
|
|
209
206
|
position: 2,
|
|
210
207
|
loading: true
|
|
211
208
|
},
|
|
212
209
|
'3': {
|
|
213
|
-
hidden: false,
|
|
214
210
|
position: 3,
|
|
215
211
|
loading: true
|
|
216
212
|
},
|
|
217
213
|
'4': {
|
|
218
|
-
hidden: false,
|
|
219
214
|
position: 4,
|
|
220
215
|
loading: true
|
|
221
216
|
}
|
|
@@ -239,13 +234,15 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
239
234
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
240
235
|
navigation: ['loader', 'slides'],
|
|
241
236
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
237
|
+
positions: [0, 1, 2, 3, 4],
|
|
242
238
|
slide: {
|
|
243
239
|
sli_VJYjJnJhg: {
|
|
244
240
|
validateButton: true,
|
|
245
241
|
animateCorrectionPopin: false,
|
|
246
242
|
showCorrectionPopin: false
|
|
247
243
|
}
|
|
248
|
-
}
|
|
244
|
+
},
|
|
245
|
+
showQuitPopin: false
|
|
249
246
|
}
|
|
250
247
|
};
|
|
251
248
|
|
|
@@ -292,7 +289,6 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
292
289
|
animationType: undefined,
|
|
293
290
|
animateCorrectionPopin: false,
|
|
294
291
|
showCorrectionPopin: false,
|
|
295
|
-
hidden: false,
|
|
296
292
|
position: 0,
|
|
297
293
|
loading: false,
|
|
298
294
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -310,22 +306,18 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
310
306
|
});
|
|
311
307
|
t.deepEqual(omit(['0'], props.stack.slides), {
|
|
312
308
|
'1': {
|
|
313
|
-
hidden: false,
|
|
314
309
|
position: 1,
|
|
315
310
|
loading: true
|
|
316
311
|
},
|
|
317
312
|
'2': {
|
|
318
|
-
hidden: false,
|
|
319
313
|
position: 2,
|
|
320
314
|
loading: true
|
|
321
315
|
},
|
|
322
316
|
'3': {
|
|
323
|
-
hidden: false,
|
|
324
317
|
position: 3,
|
|
325
318
|
loading: true
|
|
326
319
|
},
|
|
327
320
|
'4': {
|
|
328
|
-
hidden: false,
|
|
329
321
|
position: 4,
|
|
330
322
|
loading: true
|
|
331
323
|
}
|
|
@@ -350,6 +342,7 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
350
342
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
351
343
|
navigation: ['loader', 'slides'],
|
|
352
344
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
345
|
+
positions: [0, 1, 2, 3, 4],
|
|
353
346
|
slide: {
|
|
354
347
|
sli_VJYjJnJhg: {
|
|
355
348
|
validateButton: false,
|
|
@@ -361,7 +354,8 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
361
354
|
animateCorrectionPopin: false,
|
|
362
355
|
showCorrectionPopin: false
|
|
363
356
|
}
|
|
364
|
-
}
|
|
357
|
+
},
|
|
358
|
+
showQuitPopin: false
|
|
365
359
|
}
|
|
366
360
|
};
|
|
367
361
|
|
|
@@ -408,7 +402,6 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
408
402
|
animationType: undefined,
|
|
409
403
|
animateCorrectionPopin: false,
|
|
410
404
|
showCorrectionPopin: false,
|
|
411
|
-
hidden: false,
|
|
412
405
|
position: 0,
|
|
413
406
|
loading: false,
|
|
414
407
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -426,22 +419,18 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
426
419
|
t.is(props.stack.validateButton.disabled, true);
|
|
427
420
|
t.deepEqual(omit(['0'], props.stack.slides), {
|
|
428
421
|
'1': {
|
|
429
|
-
hidden: false,
|
|
430
422
|
position: 1,
|
|
431
423
|
loading: true
|
|
432
424
|
},
|
|
433
425
|
'2': {
|
|
434
|
-
hidden: false,
|
|
435
426
|
position: 2,
|
|
436
427
|
loading: true
|
|
437
428
|
},
|
|
438
429
|
'3': {
|
|
439
|
-
hidden: false,
|
|
440
430
|
position: 3,
|
|
441
431
|
loading: true
|
|
442
432
|
},
|
|
443
433
|
'4': {
|
|
444
|
-
hidden: false,
|
|
445
434
|
position: 4,
|
|
446
435
|
loading: true
|
|
447
436
|
}
|
|
@@ -470,6 +459,7 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
470
459
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
471
460
|
navigation: ['loader', 'slides'],
|
|
472
461
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
462
|
+
positions: [0, 1, 2, 3, 4],
|
|
473
463
|
slide: {
|
|
474
464
|
sli_VJYjJnJhg: {
|
|
475
465
|
validateButton: false,
|
|
@@ -481,7 +471,8 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
481
471
|
animateCorrectionPopin: false,
|
|
482
472
|
showCorrectionPopin: false
|
|
483
473
|
}
|
|
484
|
-
}
|
|
474
|
+
},
|
|
475
|
+
showQuitPopin: false
|
|
485
476
|
}
|
|
486
477
|
};
|
|
487
478
|
|
|
@@ -542,6 +533,7 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
542
533
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
543
534
|
navigation: ['loader', 'slides'],
|
|
544
535
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
536
|
+
positions: [0, 1, 2, 3, 4],
|
|
545
537
|
slide: {
|
|
546
538
|
sli_VJYjJnJhg: {
|
|
547
539
|
validateButton: false,
|
|
@@ -553,7 +545,8 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
553
545
|
animateCorrectionPopin: false,
|
|
554
546
|
showCorrectionPopin: false
|
|
555
547
|
}
|
|
556
|
-
}
|
|
548
|
+
},
|
|
549
|
+
showQuitPopin: false
|
|
557
550
|
}
|
|
558
551
|
};
|
|
559
552
|
|
|
@@ -611,7 +604,6 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
611
604
|
animationType: undefined,
|
|
612
605
|
animateCorrectionPopin: true,
|
|
613
606
|
showCorrectionPopin: true,
|
|
614
|
-
hidden: false,
|
|
615
607
|
position: 0,
|
|
616
608
|
loading: false,
|
|
617
609
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -630,7 +622,6 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
630
622
|
animationType: undefined,
|
|
631
623
|
animateCorrectionPopin: false,
|
|
632
624
|
showCorrectionPopin: false,
|
|
633
|
-
hidden: false,
|
|
634
625
|
position: 1,
|
|
635
626
|
loading: false,
|
|
636
627
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -639,17 +630,14 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
639
630
|
t.is(props.stack.validateButton.disabled, true);
|
|
640
631
|
t.deepEqual(omit(['0', '1'], props.stack.slides), {
|
|
641
632
|
'2': {
|
|
642
|
-
hidden: false,
|
|
643
633
|
position: 2,
|
|
644
634
|
loading: true
|
|
645
635
|
},
|
|
646
636
|
'3': {
|
|
647
|
-
hidden: false,
|
|
648
637
|
position: 3,
|
|
649
638
|
loading: true
|
|
650
639
|
},
|
|
651
640
|
'4': {
|
|
652
|
-
hidden: false,
|
|
653
641
|
position: 4,
|
|
654
642
|
loading: true
|
|
655
643
|
}
|
|
@@ -676,6 +664,7 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
676
664
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
677
665
|
navigation: ['loader', 'slides'],
|
|
678
666
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
667
|
+
positions: [0, 1, 2, 3, 4],
|
|
679
668
|
slide: {
|
|
680
669
|
sli_VJYjJnJhg: {
|
|
681
670
|
validateButton: false,
|
|
@@ -687,7 +676,8 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
687
676
|
animateCorrectionPopin: false,
|
|
688
677
|
showCorrectionPopin: false
|
|
689
678
|
}
|
|
690
|
-
}
|
|
679
|
+
},
|
|
680
|
+
showQuitPopin: false
|
|
691
681
|
}
|
|
692
682
|
};
|
|
693
683
|
|
|
@@ -748,7 +738,6 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
748
738
|
animationType: undefined,
|
|
749
739
|
animateCorrectionPopin: true,
|
|
750
740
|
showCorrectionPopin: true,
|
|
751
|
-
hidden: false,
|
|
752
741
|
position: 0,
|
|
753
742
|
loading: false,
|
|
754
743
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -767,7 +756,6 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
767
756
|
animationType: undefined,
|
|
768
757
|
animateCorrectionPopin: false,
|
|
769
758
|
showCorrectionPopin: false,
|
|
770
|
-
hidden: false,
|
|
771
759
|
position: 1,
|
|
772
760
|
loading: false,
|
|
773
761
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -776,17 +764,14 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
776
764
|
t.is(props.stack.validateButton.disabled, true);
|
|
777
765
|
t.deepEqual(omit(['0', '1'], props.stack.slides), {
|
|
778
766
|
'2': {
|
|
779
|
-
hidden: false,
|
|
780
767
|
position: 2,
|
|
781
768
|
loading: true
|
|
782
769
|
},
|
|
783
770
|
'3': {
|
|
784
|
-
hidden: false,
|
|
785
771
|
position: 3,
|
|
786
772
|
loading: true
|
|
787
773
|
},
|
|
788
774
|
'4': {
|
|
789
|
-
hidden: false,
|
|
790
775
|
position: 4,
|
|
791
776
|
loading: true
|
|
792
777
|
}
|
|
@@ -816,6 +801,7 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
816
801
|
sli_VJYjJnJhg: ['Benchmark'],
|
|
817
802
|
sli_VkSQroQnx: []
|
|
818
803
|
},
|
|
804
|
+
positions: [-1, 0, 1, 2, 3],
|
|
819
805
|
slide: {
|
|
820
806
|
sli_VJYjJnJhg: {
|
|
821
807
|
validateButton: false,
|
|
@@ -828,7 +814,8 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
828
814
|
animateCorrectionPopin: false,
|
|
829
815
|
showCorrectionPopin: false
|
|
830
816
|
}
|
|
831
|
-
}
|
|
817
|
+
},
|
|
818
|
+
showQuitPopin: false
|
|
832
819
|
}
|
|
833
820
|
};
|
|
834
821
|
|
|
@@ -868,7 +855,31 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
868
855
|
]
|
|
869
856
|
});
|
|
870
857
|
|
|
871
|
-
|
|
858
|
+
const propsToCheck = ['loading', 'animateCorrectionPopin', 'animationType', 'position'];
|
|
859
|
+
t.deepEqual(pick(propsToCheck, props.stack.slides[0]), {
|
|
860
|
+
loading: false,
|
|
861
|
+
animateCorrectionPopin: false,
|
|
862
|
+
animationType: 'unstack',
|
|
863
|
+
position: -1
|
|
864
|
+
});
|
|
865
|
+
t.deepEqual(pick(propsToCheck, props.stack.slides[1]), {
|
|
866
|
+
loading: false,
|
|
867
|
+
animateCorrectionPopin: false,
|
|
868
|
+
animationType: undefined,
|
|
869
|
+
position: 0
|
|
870
|
+
});
|
|
871
|
+
t.deepEqual(pick(propsToCheck, props.stack.slides[2]), {
|
|
872
|
+
loading: true,
|
|
873
|
+
position: 1
|
|
874
|
+
});
|
|
875
|
+
t.deepEqual(pick(propsToCheck, props.stack.slides[3]), {
|
|
876
|
+
loading: true,
|
|
877
|
+
position: 2
|
|
878
|
+
});
|
|
879
|
+
t.deepEqual(pick(propsToCheck, props.stack.slides[4]), {
|
|
880
|
+
loading: true,
|
|
881
|
+
position: 3
|
|
882
|
+
});
|
|
872
883
|
});
|
|
873
884
|
|
|
874
885
|
test('should verify props when progression is in success', t => {
|
|
@@ -904,6 +915,7 @@ test('should verify props when progression is in success', t => {
|
|
|
904
915
|
sli_VkAzsCLKb: ['7'],
|
|
905
916
|
'sli_N13-hG3kX': ['Leaderboard', 'utilisateurs', 'étoiles']
|
|
906
917
|
},
|
|
918
|
+
positions: [-1, -1, -1, -1, 0],
|
|
907
919
|
slide: {
|
|
908
920
|
sli_VJYjJnJhg: {
|
|
909
921
|
validateButton: false,
|
|
@@ -934,7 +946,8 @@ test('should verify props when progression is in success', t => {
|
|
|
934
946
|
animateCorrectionPopin: true,
|
|
935
947
|
showCorrectionPopin: true
|
|
936
948
|
}
|
|
937
|
-
}
|
|
949
|
+
},
|
|
950
|
+
showQuitPopin: false
|
|
938
951
|
}
|
|
939
952
|
};
|
|
940
953
|
|
|
@@ -1010,6 +1023,7 @@ test('should verify props when progression has answered a current pendingSlide',
|
|
|
1010
1023
|
sli_VkAzsCLKb: ['7'],
|
|
1011
1024
|
'sli_N13-hG3kX': ['Leaderboard', 'utilisateurs', 'étoiles']
|
|
1012
1025
|
},
|
|
1026
|
+
positions: [0, -1, 1, -1, -1],
|
|
1013
1027
|
slide: {
|
|
1014
1028
|
sli_VJYjJnJhg: {
|
|
1015
1029
|
validateButton: false,
|
|
@@ -1040,7 +1054,8 @@ test('should verify props when progression has answered a current pendingSlide',
|
|
|
1040
1054
|
showCorrectionPopin: false,
|
|
1041
1055
|
animationType: 'unstack'
|
|
1042
1056
|
}
|
|
1043
|
-
}
|
|
1057
|
+
},
|
|
1058
|
+
showQuitPopin: false
|
|
1044
1059
|
}
|
|
1045
1060
|
};
|
|
1046
1061
|
|
|
@@ -1113,6 +1128,7 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1113
1128
|
sli_VkAzsCLKb: ['7'],
|
|
1114
1129
|
'sli_N13-hG3kX': ['Leaderboard', 'utilisateurs', 'étoiles']
|
|
1115
1130
|
},
|
|
1131
|
+
positions: [-1, -1, 0, -1, -1],
|
|
1116
1132
|
slide: {
|
|
1117
1133
|
sli_VJYjJnJhg: {
|
|
1118
1134
|
validateButton: false,
|
|
@@ -1143,7 +1159,8 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1143
1159
|
showCorrectionPopin: false,
|
|
1144
1160
|
animationType: 'unstack'
|
|
1145
1161
|
}
|
|
1146
|
-
}
|
|
1162
|
+
},
|
|
1163
|
+
showQuitPopin: false
|
|
1147
1164
|
}
|
|
1148
1165
|
};
|
|
1149
1166
|
|
|
@@ -1182,3 +1199,34 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1182
1199
|
]
|
|
1183
1200
|
});
|
|
1184
1201
|
});
|
|
1202
|
+
|
|
1203
|
+
test('should verify that props quitPopin is not undefined when popin is displayed', t => {
|
|
1204
|
+
const state: StoreState = {
|
|
1205
|
+
data: {
|
|
1206
|
+
progression: createdProgression,
|
|
1207
|
+
skills: [],
|
|
1208
|
+
slides: {
|
|
1209
|
+
sli_N1XACJobn: null
|
|
1210
|
+
},
|
|
1211
|
+
token: '1234',
|
|
1212
|
+
corrections: {},
|
|
1213
|
+
rank: {}
|
|
1214
|
+
},
|
|
1215
|
+
ui: {
|
|
1216
|
+
currentSlideRef: '',
|
|
1217
|
+
navigation: ['loader', 'slides'],
|
|
1218
|
+
answers: {},
|
|
1219
|
+
positions: [0, 1, 2, 3, 4],
|
|
1220
|
+
slide: {
|
|
1221
|
+
sli_N1XACJobn: {
|
|
1222
|
+
validateButton: false,
|
|
1223
|
+
animateCorrectionPopin: false,
|
|
1224
|
+
showCorrectionPopin: false
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
showQuitPopin: true
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1231
|
+
t.not(props.quitPopin, undefined);
|
|
1232
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import identity from 'lodash/fp/identity';
|
|
3
|
+
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
4
|
+
import {CLOSE_POPIN} from '../../../actions/ui/quit-popin';
|
|
5
|
+
import {incorrectFreeTextPostAnswerResponse, services} from '../../../test/util/services.mock';
|
|
6
|
+
import {StoreState} from '../../../reducers';
|
|
7
|
+
import {mapStateToSlidesProps, QuitPopinProps} from '..';
|
|
8
|
+
import {freeTextSlide} from './fixtures/free-text';
|
|
9
|
+
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
10
|
+
|
|
11
|
+
const state: StoreState = {
|
|
12
|
+
data: {
|
|
13
|
+
progression: incorrectFreeTextPostAnswerResponse,
|
|
14
|
+
skills: [],
|
|
15
|
+
slides: {
|
|
16
|
+
sli_VJYjJnJhg: freeTextSlide,
|
|
17
|
+
sli_VkSQroQnx: qcmGraphicSlide
|
|
18
|
+
},
|
|
19
|
+
token: '1234',
|
|
20
|
+
corrections: {},
|
|
21
|
+
rank: {}
|
|
22
|
+
},
|
|
23
|
+
ui: {
|
|
24
|
+
currentSlideRef: 'sli_VJYjJnJhg',
|
|
25
|
+
navigation: ['loader', 'slides'],
|
|
26
|
+
answers: {sli_VJYjJnJhg: ['My value']},
|
|
27
|
+
positions: [0, 1, 2, 3, 4],
|
|
28
|
+
slide: {
|
|
29
|
+
sli_VJYjJnJhg: {
|
|
30
|
+
validateButton: false,
|
|
31
|
+
animateCorrectionPopin: true,
|
|
32
|
+
showCorrectionPopin: true
|
|
33
|
+
},
|
|
34
|
+
sli_VkSQroQnx: {
|
|
35
|
+
validateButton: false,
|
|
36
|
+
animateCorrectionPopin: false,
|
|
37
|
+
showCorrectionPopin: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
showQuitPopin: true
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
test('should dispatch CLOSE_POPIN action via the property handleOnclick of secondButton when popin is open', async t => {
|
|
45
|
+
const expectedAction = [{type: CLOSE_POPIN}];
|
|
46
|
+
const {dispatch, getState} = createTestStore(t, state, services, expectedAction);
|
|
47
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
48
|
+
const quitPopin = props.quitPopin as QuitPopinProps;
|
|
49
|
+
await quitPopin.secondButton.handleOnclick();
|
|
50
|
+
const updatedState = getState();
|
|
51
|
+
t.is(updatedState.ui.showQuitPopin, false);
|
|
52
|
+
t.pass();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should dispatch onQuitClick function via the property handleOnclick of firstButton when popin is open', async t => {
|
|
56
|
+
t.plan(2);
|
|
57
|
+
|
|
58
|
+
const expectedAction = [{type: CLOSE_POPIN}];
|
|
59
|
+
const {dispatch, getState} = createTestStore(t, state, services, expectedAction);
|
|
60
|
+
const props = mapStateToSlidesProps(getState(), dispatch, () => t.pass());
|
|
61
|
+
const quitPopin = props.quitPopin as QuitPopinProps;
|
|
62
|
+
await quitPopin.firstButton.handleOnclick();
|
|
63
|
+
t.pass();
|
|
64
|
+
});
|
|
@@ -59,13 +59,15 @@ const initialState: StoreState = {
|
|
|
59
59
|
currentSlideRef: freeTextSlide._id,
|
|
60
60
|
navigation: ['skills', 'slides'],
|
|
61
61
|
answers: {},
|
|
62
|
+
positions: [0, 1, 2, 3, 4],
|
|
62
63
|
slide: {
|
|
63
64
|
[freeTextSlide._id]: {
|
|
64
65
|
validateButton: false,
|
|
65
66
|
animateCorrectionPopin: false,
|
|
66
67
|
showCorrectionPopin: false
|
|
67
68
|
}
|
|
68
|
-
}
|
|
69
|
+
},
|
|
70
|
+
showQuitPopin: false
|
|
69
71
|
}
|
|
70
72
|
};
|
|
71
73
|
|
|
@@ -101,7 +103,6 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
|
|
|
101
103
|
animationType: undefined,
|
|
102
104
|
animateCorrectionPopin: false,
|
|
103
105
|
showCorrectionPopin: false,
|
|
104
|
-
hidden: false,
|
|
105
106
|
position: 0,
|
|
106
107
|
loading: false,
|
|
107
108
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -31,6 +31,7 @@ test('correction popin actions after click', async t => {
|
|
|
31
31
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
32
32
|
navigation: ['loader', 'slides'],
|
|
33
33
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
34
|
+
positions: [0, 1, 2, 3, 4],
|
|
34
35
|
slide: {
|
|
35
36
|
sli_VJYjJnJhg: {
|
|
36
37
|
validateButton: false,
|
|
@@ -42,7 +43,8 @@ test('correction popin actions after click', async t => {
|
|
|
42
43
|
animateCorrectionPopin: false,
|
|
43
44
|
showCorrectionPopin: false
|
|
44
45
|
}
|
|
45
|
-
}
|
|
46
|
+
},
|
|
47
|
+
showQuitPopin: false
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
|
|
@@ -52,7 +54,9 @@ test('correction popin actions after click', async t => {
|
|
|
52
54
|
payload: {
|
|
53
55
|
animationType: 'restack',
|
|
54
56
|
currentSlideRef: freeTextSlide._id,
|
|
55
|
-
nextSlideRef: qcmGraphicSlide._id
|
|
57
|
+
nextSlideRef: qcmGraphicSlide._id,
|
|
58
|
+
totalCorrectAnswers: 0,
|
|
59
|
+
answeredSlides: ['sli_VJYjJnJhg']
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
];
|
|
@@ -60,5 +64,9 @@ test('correction popin actions after click', async t => {
|
|
|
60
64
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
61
65
|
const correctionPopin = props.stack.correctionPopinProps as CorrectionPopinProps;
|
|
62
66
|
await correctionPopin.next.onClick();
|
|
67
|
+
|
|
68
|
+
const updatedState = getState();
|
|
69
|
+
t.deepEqual(updatedState.ui.positions, [4, 0, 1, 2, 3]);
|
|
70
|
+
t.deepEqual(updatedState.ui.currentSlideRef, qcmGraphicSlide._id);
|
|
63
71
|
t.pass();
|
|
64
72
|
});
|
|
@@ -47,6 +47,7 @@ const initialState: StoreState = {
|
|
|
47
47
|
ui: {
|
|
48
48
|
currentSlideRef: qcmDragSlide._id,
|
|
49
49
|
navigation: ['skills', 'slides'],
|
|
50
|
+
positions: [0, 1, 2, 3, 4],
|
|
50
51
|
answers: {},
|
|
51
52
|
slide: {
|
|
52
53
|
[qcmDragSlide._id]: {
|
|
@@ -54,7 +55,8 @@ const initialState: StoreState = {
|
|
|
54
55
|
animateCorrectionPopin: false,
|
|
55
56
|
showCorrectionPopin: false
|
|
56
57
|
}
|
|
57
|
-
}
|
|
58
|
+
},
|
|
59
|
+
showQuitPopin: false
|
|
58
60
|
}
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -75,7 +77,6 @@ test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Dra
|
|
|
75
77
|
animationType: undefined,
|
|
76
78
|
animateCorrectionPopin: false,
|
|
77
79
|
showCorrectionPopin: false,
|
|
78
|
-
hidden: false,
|
|
79
80
|
position: 0,
|
|
80
81
|
loading: false,
|
|
81
82
|
parentContentTitle: 'From "Using redux" chapter',
|
|
@@ -47,6 +47,7 @@ const initialState: StoreState = {
|
|
|
47
47
|
ui: {
|
|
48
48
|
currentSlideRef: qcmGraphicSlide._id,
|
|
49
49
|
navigation: ['skills', 'slides'],
|
|
50
|
+
positions: [0, 1, 2, 3, 4],
|
|
50
51
|
answers: {},
|
|
51
52
|
slide: {
|
|
52
53
|
[qcmGraphicSlide._id]: {
|
|
@@ -54,7 +55,8 @@ const initialState: StoreState = {
|
|
|
54
55
|
animateCorrectionPopin: false,
|
|
55
56
|
showCorrectionPopin: false
|
|
56
57
|
}
|
|
57
|
-
}
|
|
58
|
+
},
|
|
59
|
+
showQuitPopin: false
|
|
58
60
|
}
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -75,7 +77,6 @@ test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM
|
|
|
75
77
|
animationType: undefined,
|
|
76
78
|
animateCorrectionPopin: false,
|
|
77
79
|
showCorrectionPopin: false,
|
|
78
|
-
hidden: false,
|
|
79
80
|
position: 0,
|
|
80
81
|
loading: false,
|
|
81
82
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -47,6 +47,7 @@ const initialState: StoreState = {
|
|
|
47
47
|
ui: {
|
|
48
48
|
currentSlideRef: qcmSlide._id,
|
|
49
49
|
navigation: ['skills', 'slides'],
|
|
50
|
+
positions: [0, 1, 2, 3, 4],
|
|
50
51
|
answers: {},
|
|
51
52
|
slide: {
|
|
52
53
|
[qcmSlide._id]: {
|
|
@@ -54,7 +55,8 @@ const initialState: StoreState = {
|
|
|
54
55
|
animateCorrectionPopin: false,
|
|
55
56
|
showCorrectionPopin: false
|
|
56
57
|
}
|
|
57
|
-
}
|
|
58
|
+
},
|
|
59
|
+
showQuitPopin: false
|
|
58
60
|
}
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -77,7 +79,6 @@ test('should dispatch EDIT_QCM action via the property onClick of a QCM slide',
|
|
|
77
79
|
animationType: undefined,
|
|
78
80
|
animateCorrectionPopin: false,
|
|
79
81
|
showCorrectionPopin: false,
|
|
80
|
-
hidden: false,
|
|
81
82
|
position: 0,
|
|
82
83
|
loading: false,
|
|
83
84
|
parentContentTitle: 'From "Developing the review app" course',
|
|
@@ -47,6 +47,7 @@ const initialState: StoreState = {
|
|
|
47
47
|
ui: {
|
|
48
48
|
currentSlideRef: sliderSlide._id,
|
|
49
49
|
navigation: ['skills', 'slides'],
|
|
50
|
+
positions: [0, 1, 2, 3, 4],
|
|
50
51
|
answers: {},
|
|
51
52
|
slide: {
|
|
52
53
|
[sliderSlide._id]: {
|
|
@@ -54,7 +55,8 @@ const initialState: StoreState = {
|
|
|
54
55
|
animateCorrectionPopin: false,
|
|
55
56
|
showCorrectionPopin: false
|
|
56
57
|
}
|
|
57
|
-
}
|
|
58
|
+
},
|
|
59
|
+
showQuitPopin: false
|
|
58
60
|
}
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -75,7 +77,6 @@ test('should dispatch EDIT_SLIDER action via the property onChange of a Slider s
|
|
|
75
77
|
animationType: undefined,
|
|
76
78
|
animateCorrectionPopin: false,
|
|
77
79
|
showCorrectionPopin: false,
|
|
78
|
-
hidden: false,
|
|
79
80
|
position: 0,
|
|
80
81
|
loading: false,
|
|
81
82
|
parentContentTitle: 'From "Developing the review app" course',
|