@coorpacademy/app-review 0.5.3 → 0.5.4
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/api/fetch-rank.js +5 -1
- package/es/actions/ui/quit-popin.d.ts +8 -0
- package/es/actions/ui/quit-popin.js +8 -0
- package/es/index.d.ts +0 -1
- package/es/reducers/data/rank.d.ts +4 -3
- package/es/reducers/data/rank.js +9 -18
- package/es/reducers/index.d.ts +7 -1
- package/es/reducers/ui/index.d.ts +11 -1
- package/es/reducers/ui/index.js +5 -1
- package/es/reducers/ui/navigation.js +0 -1
- package/es/reducers/ui/positions.js +3 -1
- package/es/reducers/ui/quit-popin.d.ts +4 -0
- package/es/reducers/ui/quit-popin.js +16 -0
- package/es/reducers/ui/show-congrats.d.ts +5 -0
- package/es/reducers/ui/show-congrats.js +20 -0
- package/es/reducers/ui/slide.js +4 -1
- package/es/types/common.d.ts +10 -8
- package/es/views/slides/index.d.ts +67 -19
- package/es/views/slides/index.js +122 -6
- package/lib/actions/api/fetch-rank.js +7 -1
- package/lib/actions/ui/quit-popin.d.ts +8 -0
- package/lib/actions/ui/quit-popin.js +8 -0
- package/lib/index.d.ts +0 -1
- package/lib/reducers/data/rank.d.ts +4 -3
- package/lib/reducers/data/rank.js +9 -18
- package/lib/reducers/index.d.ts +7 -1
- package/lib/reducers/ui/index.d.ts +11 -1
- package/lib/reducers/ui/index.js +5 -1
- package/lib/reducers/ui/navigation.js +0 -1
- package/lib/reducers/ui/positions.js +3 -1
- package/lib/reducers/ui/quit-popin.d.ts +4 -0
- package/lib/reducers/ui/quit-popin.js +17 -0
- package/lib/reducers/ui/show-congrats.d.ts +5 -0
- package/lib/reducers/ui/show-congrats.js +21 -0
- package/lib/reducers/ui/slide.js +4 -1
- package/lib/types/common.d.ts +10 -8
- package/lib/views/slides/index.d.ts +67 -19
- package/lib/views/slides/index.js +124 -6
- package/package.json +3 -3
- package/src/actions/api/fetch-rank.ts +8 -1
- package/src/actions/api/test/fetch-correction.test.ts +4 -2
- package/src/actions/api/test/fetch-rank.test.ts +17 -8
- package/src/actions/api/test/fetch-skills.test.ts +4 -2
- package/src/actions/api/test/fetch-slide.test.ts +4 -2
- package/src/actions/api/test/post-answer.test.ts +9 -10
- package/src/actions/api/test/post-progression.test.ts +4 -2
- package/src/actions/data/test/token.test.ts +4 -2
- package/src/actions/ui/quit-popin.ts +10 -0
- package/src/actions/ui/test/answers.test.ts +4 -2
- package/src/actions/ui/test/next-slide.test.ts +5 -2
- package/src/actions/ui/test/quit-popin.test.ts +39 -0
- package/src/actions/ui/test/slides.test.ts +4 -2
- package/src/reducers/data/rank.ts +15 -31
- package/src/reducers/data/test/rank.test.ts +33 -52
- package/src/reducers/ui/index.ts +7 -1
- package/src/reducers/ui/navigation.ts +0 -2
- package/src/reducers/ui/positions.ts +3 -1
- package/src/reducers/ui/quit-popin.ts +22 -0
- package/src/reducers/ui/show-congrats.ts +26 -0
- package/src/reducers/ui/slide.ts +4 -2
- package/src/reducers/ui/test/positions.test.ts +14 -0
- package/src/reducers/ui/test/quit-popin.test.ts +24 -0
- package/src/reducers/ui/test/show-congrats.test.ts +40 -0
- package/src/reducers/ui/test/slide.test.ts +21 -0
- package/src/types/common.ts +12 -8
- package/src/views/skills/test/skills.test.ts +8 -4
- package/src/views/slides/index.ts +207 -27
- package/src/views/slides/test/header.on-click.test.ts +46 -0
- package/src/views/slides/test/index.test.ts +335 -25
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +65 -0
- package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -2
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +107 -2
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -2
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +4 -2
- package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -2
- package/src/views/slides/test/slide.slider.on-change.test.ts +4 -2
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +4 -2
- package/src/views/slides/test/slide.template.on-change.test.ts +4 -2
|
@@ -2,6 +2,7 @@ import test from 'ava';
|
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import type {StoreState} from '../../../reducers';
|
|
4
4
|
import {
|
|
5
|
+
postAnswerResponses,
|
|
5
6
|
getChoicesCorrection,
|
|
6
7
|
incorrectFreeTextPostAnswerResponse,
|
|
7
8
|
services
|
|
@@ -11,6 +12,9 @@ import {createTestStore} from '../../../actions/test/create-test-store';
|
|
|
11
12
|
import {NEXT_SLIDE} from '../../../actions/ui/next-slide';
|
|
12
13
|
import {freeTextSlide} from './fixtures/free-text';
|
|
13
14
|
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
15
|
+
import {templateSlide} from './fixtures/template';
|
|
16
|
+
import {qcmSlide} from './fixtures/qcm';
|
|
17
|
+
import {sliderSlide} from './fixtures/slider';
|
|
14
18
|
|
|
15
19
|
test('correction popin actions after click', async t => {
|
|
16
20
|
const state: StoreState = {
|
|
@@ -25,9 +29,10 @@ test('correction popin actions after click', async t => {
|
|
|
25
29
|
corrections: {
|
|
26
30
|
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id, true)
|
|
27
31
|
},
|
|
28
|
-
rank: {}
|
|
32
|
+
rank: {start: 10, end: Number.NaN}
|
|
29
33
|
},
|
|
30
34
|
ui: {
|
|
35
|
+
showCongrats: false,
|
|
31
36
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
32
37
|
navigation: ['loader', 'slides'],
|
|
33
38
|
answers: {sli_VJYjJnJhg: ['My value']},
|
|
@@ -43,7 +48,8 @@ test('correction popin actions after click', async t => {
|
|
|
43
48
|
animateCorrectionPopin: false,
|
|
44
49
|
showCorrectionPopin: false
|
|
45
50
|
}
|
|
46
|
-
}
|
|
51
|
+
},
|
|
52
|
+
showQuitPopin: false
|
|
47
53
|
}
|
|
48
54
|
};
|
|
49
55
|
|
|
@@ -69,3 +75,102 @@ test('correction popin actions after click', async t => {
|
|
|
69
75
|
t.deepEqual(updatedState.ui.currentSlideRef, qcmGraphicSlide._id);
|
|
70
76
|
t.pass();
|
|
71
77
|
});
|
|
78
|
+
|
|
79
|
+
test('correction popin actions after click when progression is finished', async t => {
|
|
80
|
+
const state: StoreState = {
|
|
81
|
+
data: {
|
|
82
|
+
progression: postAnswerResponses[templateSlide.universalRef],
|
|
83
|
+
skills: [],
|
|
84
|
+
slides: {
|
|
85
|
+
[freeTextSlide.universalRef]: freeTextSlide,
|
|
86
|
+
[qcmGraphicSlide.universalRef]: qcmGraphicSlide,
|
|
87
|
+
[qcmSlide.universalRef]: qcmSlide,
|
|
88
|
+
[sliderSlide.universalRef]: sliderSlide,
|
|
89
|
+
[templateSlide.universalRef]: templateSlide
|
|
90
|
+
},
|
|
91
|
+
token: '1234',
|
|
92
|
+
corrections: {
|
|
93
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
|
|
94
|
+
[qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
|
|
95
|
+
[qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id),
|
|
96
|
+
[sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
|
|
97
|
+
[templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
|
|
98
|
+
},
|
|
99
|
+
rank: {start: 10, end: Number.NaN}
|
|
100
|
+
},
|
|
101
|
+
ui: {
|
|
102
|
+
showCongrats: false,
|
|
103
|
+
showQuitPopin: false,
|
|
104
|
+
currentSlideRef: templateSlide.universalRef,
|
|
105
|
+
navigation: ['loader', 'slides'],
|
|
106
|
+
answers: {
|
|
107
|
+
sli_VJYjJnJhg: ['Benchmark'],
|
|
108
|
+
sli_VkSQroQnx: ['Faux'],
|
|
109
|
+
sli_N1XACJobn: ['Le créateur peut fixer un pourcentage pour chaque transaction future'],
|
|
110
|
+
sli_VkAzsCLKb: ['7'],
|
|
111
|
+
'sli_N13-hG3kX': ['Leaderboard', 'utilisateurs', 'étoiles']
|
|
112
|
+
},
|
|
113
|
+
positions: [-1, -1, -1, -1, 0],
|
|
114
|
+
slide: {
|
|
115
|
+
sli_VJYjJnJhg: {
|
|
116
|
+
validateButton: false,
|
|
117
|
+
animateCorrectionPopin: false,
|
|
118
|
+
showCorrectionPopin: false,
|
|
119
|
+
animationType: 'unstack'
|
|
120
|
+
},
|
|
121
|
+
sli_VkSQroQnx: {
|
|
122
|
+
validateButton: false,
|
|
123
|
+
animateCorrectionPopin: false,
|
|
124
|
+
showCorrectionPopin: false,
|
|
125
|
+
animationType: 'unstack'
|
|
126
|
+
},
|
|
127
|
+
sli_N1XACJobn: {
|
|
128
|
+
validateButton: false,
|
|
129
|
+
animateCorrectionPopin: false,
|
|
130
|
+
showCorrectionPopin: false,
|
|
131
|
+
animationType: 'unstack'
|
|
132
|
+
},
|
|
133
|
+
sli_VkAzsCLKb: {
|
|
134
|
+
validateButton: false,
|
|
135
|
+
animateCorrectionPopin: false,
|
|
136
|
+
showCorrectionPopin: false,
|
|
137
|
+
animationType: 'unstack'
|
|
138
|
+
},
|
|
139
|
+
'sli_N13-hG3kX': {
|
|
140
|
+
validateButton: false,
|
|
141
|
+
animateCorrectionPopin: true,
|
|
142
|
+
showCorrectionPopin: true
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const expectedActions = [
|
|
149
|
+
{
|
|
150
|
+
type: NEXT_SLIDE,
|
|
151
|
+
payload: {
|
|
152
|
+
animationType: 'unstack',
|
|
153
|
+
currentSlideRef: templateSlide.universalRef,
|
|
154
|
+
nextSlideRef: 'successExitNode',
|
|
155
|
+
totalCorrectAnswers: 5,
|
|
156
|
+
answeredSlides: [
|
|
157
|
+
'sli_VJYjJnJhg',
|
|
158
|
+
'sli_VkSQroQnx',
|
|
159
|
+
'sli_N1XACJobn',
|
|
160
|
+
'sli_VkAzsCLKb',
|
|
161
|
+
'sli_N13-hG3kX'
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
const {dispatch, getState} = createTestStore(t, state, services, expectedActions);
|
|
167
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
168
|
+
t.is(props.congrats, undefined);
|
|
169
|
+
const correctionPopin = props.stack.correctionPopinProps as CorrectionPopinProps;
|
|
170
|
+
await correctionPopin.next.onClick();
|
|
171
|
+
|
|
172
|
+
const updatedState = getState();
|
|
173
|
+
t.deepEqual(updatedState.ui.positions, [-1, -1, -1, -1, 0]);
|
|
174
|
+
t.is(updatedState.ui.currentSlideRef, 'successExitNode');
|
|
175
|
+
t.pass();
|
|
176
|
+
});
|
|
@@ -42,9 +42,10 @@ const initialState: StoreState = {
|
|
|
42
42
|
skills: [],
|
|
43
43
|
token: '1234',
|
|
44
44
|
corrections: {},
|
|
45
|
-
rank: {}
|
|
45
|
+
rank: {start: 10, end: Number.NaN}
|
|
46
46
|
},
|
|
47
47
|
ui: {
|
|
48
|
+
showCongrats: false,
|
|
48
49
|
currentSlideRef: qcmDragSlide._id,
|
|
49
50
|
navigation: ['skills', 'slides'],
|
|
50
51
|
positions: [0, 1, 2, 3, 4],
|
|
@@ -55,7 +56,8 @@ const initialState: StoreState = {
|
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -42,9 +42,10 @@ const initialState: StoreState = {
|
|
|
42
42
|
skills: [],
|
|
43
43
|
token: '1234',
|
|
44
44
|
corrections: {},
|
|
45
|
-
rank: {}
|
|
45
|
+
rank: {start: 10, end: Number.NaN}
|
|
46
46
|
},
|
|
47
47
|
ui: {
|
|
48
|
+
showCongrats: false,
|
|
48
49
|
currentSlideRef: qcmGraphicSlide._id,
|
|
49
50
|
navigation: ['skills', 'slides'],
|
|
50
51
|
positions: [0, 1, 2, 3, 4],
|
|
@@ -55,7 +56,8 @@ const initialState: StoreState = {
|
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -42,9 +42,10 @@ const initialState: StoreState = {
|
|
|
42
42
|
skills: [],
|
|
43
43
|
token: '1234',
|
|
44
44
|
corrections: {},
|
|
45
|
-
rank: {}
|
|
45
|
+
rank: {start: 10, end: Number.NaN}
|
|
46
46
|
},
|
|
47
47
|
ui: {
|
|
48
|
+
showCongrats: false,
|
|
48
49
|
currentSlideRef: qcmSlide._id,
|
|
49
50
|
navigation: ['skills', 'slides'],
|
|
50
51
|
positions: [0, 1, 2, 3, 4],
|
|
@@ -55,7 +56,8 @@ const initialState: StoreState = {
|
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -42,9 +42,10 @@ const initialState: StoreState = {
|
|
|
42
42
|
skills: [],
|
|
43
43
|
token: '1234',
|
|
44
44
|
corrections: {},
|
|
45
|
-
rank: {}
|
|
45
|
+
rank: {start: 10, end: Number.NaN}
|
|
46
46
|
},
|
|
47
47
|
ui: {
|
|
48
|
+
showCongrats: false,
|
|
48
49
|
currentSlideRef: sliderSlide._id,
|
|
49
50
|
navigation: ['skills', 'slides'],
|
|
50
51
|
positions: [0, 1, 2, 3, 4],
|
|
@@ -55,7 +56,8 @@ const initialState: StoreState = {
|
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -42,9 +42,10 @@ const initialState: StoreState = {
|
|
|
42
42
|
skills: [],
|
|
43
43
|
token: '1234',
|
|
44
44
|
corrections: {},
|
|
45
|
-
rank: {}
|
|
45
|
+
rank: {start: 10, end: Number.NaN}
|
|
46
46
|
},
|
|
47
47
|
ui: {
|
|
48
|
+
showCongrats: false,
|
|
48
49
|
currentSlideRef: sliderSlide._id,
|
|
49
50
|
navigation: ['skills', 'slides'],
|
|
50
51
|
answers: {},
|
|
@@ -55,7 +56,8 @@ const initialState: StoreState = {
|
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -43,9 +43,10 @@ const initialState: StoreState = {
|
|
|
43
43
|
skills: [],
|
|
44
44
|
token: '1234',
|
|
45
45
|
corrections: {},
|
|
46
|
-
rank: {}
|
|
46
|
+
rank: {start: 10, end: Number.NaN}
|
|
47
47
|
},
|
|
48
48
|
ui: {
|
|
49
|
+
showCongrats: false,
|
|
49
50
|
currentSlideRef: templateSlide._id,
|
|
50
51
|
navigation: ['skills', 'slides'],
|
|
51
52
|
answers: {},
|
|
@@ -56,7 +57,8 @@ const initialState: StoreState = {
|
|
|
56
57
|
animateCorrectionPopin: false,
|
|
57
58
|
showCorrectionPopin: false
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
},
|
|
61
|
+
showQuitPopin: false
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
|