@coorpacademy/app-review 0.3.4 → 0.4.0
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-slide.js +0 -2
- package/es/actions/ui/next-slide.js +5 -2
- package/es/views/slides/index.d.ts +9 -7
- package/es/views/slides/index.js +36 -23
- package/es/views/slides/map-api-slide-to-ui.js +0 -3
- package/es/views/slides/test/fixtures/free-text.d.ts +2 -2
- package/es/views/slides/test/fixtures/qcm-drag.d.ts +2 -2
- package/es/views/slides/test/fixtures/qcm-graphic.d.ts +2 -2
- package/es/views/slides/test/fixtures/qcm.d.ts +2 -2
- package/es/views/slides/test/fixtures/slider.d.ts +2 -2
- package/es/views/slides/test/fixtures/template.d.ts +2 -2
- package/lib/actions/api/fetch-slide.js +0 -2
- package/lib/actions/ui/next-slide.js +5 -3
- package/lib/views/slides/index.d.ts +9 -7
- package/lib/views/slides/index.js +30 -24
- package/lib/views/slides/map-api-slide-to-ui.js +0 -3
- package/lib/views/slides/test/fixtures/free-text.d.ts +2 -2
- package/lib/views/slides/test/fixtures/qcm-drag.d.ts +2 -2
- package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +2 -2
- package/lib/views/slides/test/fixtures/qcm.d.ts +2 -2
- package/lib/views/slides/test/fixtures/slider.d.ts +2 -2
- package/lib/views/slides/test/fixtures/template.d.ts +2 -2
- package/package.json +3 -3
- package/src/actions/api/fetch-slide.ts +0 -1
- package/src/actions/ui/next-slide.ts +9 -2
- package/src/views/slides/index.ts +49 -43
- package/src/views/slides/map-api-slide-to-ui.ts +0 -3
- package/src/views/slides/test/fixtures/free-text.ts +2 -2
- package/src/views/slides/test/fixtures/qcm-drag.ts +2 -2
- package/src/views/slides/test/fixtures/qcm-graphic.ts +2 -2
- package/src/views/slides/test/fixtures/qcm.ts +2 -2
- package/src/views/slides/test/fixtures/slider.ts +2 -2
- package/src/views/slides/test/fixtures/template.ts +2 -2
- package/src/views/slides/test/index.test.ts +67 -51
- package/src/views/slides/test/map-api-slide-to-ui.test.ts +2 -2
- package/src/views/slides/test/slide.free-text.on-change.test.ts +1 -0
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +1 -0
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +1 -0
- package/src/views/slides/test/slide.qcm.on-click.test.ts +1 -0
- package/src/views/slides/test/slide.slider.on-change.test.ts +1 -0
- package/src/views/slides/test/slide.template.on-change.test.ts +2 -0
|
@@ -22,8 +22,6 @@ export const fetchSlide = (slideRef) => async (dispatch, getState, { services })
|
|
|
22
22
|
const response = await dispatch(action);
|
|
23
23
|
if (response.type === SLIDE_FETCH_SUCCESS) {
|
|
24
24
|
const slideFromAPI = response.payload;
|
|
25
|
-
if (!slideFromAPI)
|
|
26
|
-
throw new Error('Slide not found');
|
|
27
25
|
const state = getState();
|
|
28
26
|
const slides = get('data.progression.state.slides', state);
|
|
29
27
|
if (isEmpty(slides)) {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import get from 'lodash/fp/get';
|
|
2
|
+
import getOr from 'lodash/fp/getOr';
|
|
2
3
|
export const NEXT_SLIDE = '@@slide/NEXT_SLIDE';
|
|
3
4
|
export const nextSlide = (dispatch, getState) => {
|
|
4
5
|
const state = getState();
|
|
5
6
|
const payload = {
|
|
6
7
|
currentSlideRef: get(['ui', 'currentSlideRef'], state),
|
|
7
|
-
nextSlideRef: get(['
|
|
8
|
-
animationType:
|
|
8
|
+
nextSlideRef: get(['state', 'nextContent', 'ref'], state.data.progression),
|
|
9
|
+
animationType: getOr(false, ['state', 'isCorrect'], state.data.progression)
|
|
10
|
+
? 'unstack'
|
|
11
|
+
: 'restack'
|
|
9
12
|
};
|
|
10
13
|
const action = {
|
|
11
14
|
type: NEXT_SLIDE,
|
|
@@ -14,18 +14,19 @@ declare type StepItem = {
|
|
|
14
14
|
value: string;
|
|
15
15
|
};
|
|
16
16
|
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
17
|
-
export declare type
|
|
17
|
+
export declare type ReviewSlide = {
|
|
18
|
+
hidden: boolean;
|
|
19
|
+
position: number;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
showCorrectionPopin?: boolean;
|
|
22
|
+
animateCorrectionPopin?: boolean;
|
|
23
|
+
parentContentTitle?: string;
|
|
18
24
|
questionText?: string;
|
|
19
25
|
answerUI?: AnswerUI;
|
|
20
|
-
hidden?: boolean;
|
|
21
|
-
position: number;
|
|
22
26
|
animationType?: SlideUIAnimations;
|
|
23
|
-
isCorrect?: boolean;
|
|
24
|
-
endReview?: boolean;
|
|
25
|
-
loading: boolean;
|
|
26
27
|
};
|
|
27
28
|
declare type SlidesStack = {
|
|
28
|
-
[key in SlideIndexes]:
|
|
29
|
+
[key in SlideIndexes]: ReviewSlide;
|
|
29
30
|
};
|
|
30
31
|
declare type CorrectionPopinInformation = {
|
|
31
32
|
label: string;
|
|
@@ -38,6 +39,7 @@ declare type CorrectionPopinKlf = {
|
|
|
38
39
|
declare type CorrectionPopinNext = {
|
|
39
40
|
label: string;
|
|
40
41
|
ariaLabel: string;
|
|
42
|
+
onClick: Function;
|
|
41
43
|
};
|
|
42
44
|
export declare type CorrectionPopinProps = {
|
|
43
45
|
klf?: CorrectionPopinKlf;
|
package/es/views/slides/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import findLast from 'lodash/fp/findLast';
|
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
4
|
import getOr from 'lodash/fp/getOr';
|
|
5
5
|
import last from 'lodash/fp/last';
|
|
6
|
-
import pipe from 'lodash/fp/pipe';
|
|
7
6
|
import reduce from 'lodash/fp/reduce';
|
|
8
7
|
import set from 'lodash/fp/set';
|
|
9
8
|
import slice from 'lodash/fp/slice';
|
|
10
9
|
import toInteger from 'lodash/fp/toInteger';
|
|
11
10
|
import join from 'lodash/fp/join';
|
|
12
11
|
import { postAnswer } from '../../actions/api/post-answer';
|
|
12
|
+
import { nextSlide } from '../../actions/ui/next-slide';
|
|
13
13
|
import { mapApiSlideToUi } from './map-api-slide-to-ui';
|
|
14
14
|
const ICON_VALUES = {
|
|
15
15
|
right: 'right',
|
|
@@ -71,9 +71,17 @@ const buildStackSlides = (state, dispatch) => {
|
|
|
71
71
|
const isCurrentSlideRef = currentSlideRef === slideRef;
|
|
72
72
|
const animateCorrectionPopin = isCurrentSlideRef && get(['ui', 'slide', slideRef, 'animateCorrectionPopin'], state);
|
|
73
73
|
const showCorrectionPopin = isCurrentSlideRef && get(['ui', 'slide', slideRef, 'showCorrectionPopin'], state);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const animationType = get(['ui', 'slide', slideRef, 'animationType'], state);
|
|
75
|
+
const updatedUiSlide = {
|
|
76
|
+
...uiSlide,
|
|
77
|
+
showCorrectionPopin,
|
|
78
|
+
animateCorrectionPopin,
|
|
79
|
+
loading: false,
|
|
80
|
+
questionText,
|
|
81
|
+
answerUI,
|
|
82
|
+
parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
|
|
83
|
+
animationType
|
|
84
|
+
};
|
|
77
85
|
return set(index, updatedUiSlide, acc);
|
|
78
86
|
}, initialState, initialState);
|
|
79
87
|
return stack;
|
|
@@ -145,24 +153,29 @@ export const buildStepItems = (state) => {
|
|
|
145
153
|
});
|
|
146
154
|
return steps;
|
|
147
155
|
};
|
|
148
|
-
const getCorrectionPopinProps = (isCorrect, correctAnswer, klf) =>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) => {
|
|
157
|
+
return {
|
|
158
|
+
klf: isCorrect
|
|
159
|
+
? undefined
|
|
160
|
+
: {
|
|
161
|
+
label: '_klf',
|
|
162
|
+
tooltip: klf
|
|
163
|
+
},
|
|
164
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
165
|
+
information: {
|
|
166
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
167
|
+
message: isCorrect ? klf : join(',', correctAnswer)
|
|
154
168
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
});
|
|
169
|
+
next: {
|
|
170
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
171
|
+
label: '_correctionNextLabel',
|
|
172
|
+
onClick: () => {
|
|
173
|
+
dispatch(nextSlide);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
type: isCorrect ? 'right' : 'wrong'
|
|
177
|
+
};
|
|
178
|
+
};
|
|
166
179
|
export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
167
180
|
const currentSlideRef = get(['ui', 'currentSlideRef'], state);
|
|
168
181
|
const correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -182,11 +195,11 @@ export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
|
182
195
|
validateButton: {
|
|
183
196
|
label: '__validate',
|
|
184
197
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
185
|
-
onClick:
|
|
198
|
+
onClick: () => {
|
|
186
199
|
dispatch(postAnswer);
|
|
187
200
|
}
|
|
188
201
|
},
|
|
189
|
-
correctionPopinProps: correction && getCorrectionPopinProps(isCorrect, correction.correctAnswer, klf),
|
|
202
|
+
correctionPopinProps: correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
190
203
|
endReview: false
|
|
191
204
|
},
|
|
192
205
|
congratsProps: undefined
|
|
@@ -164,9 +164,6 @@ const getAnswerUIModel = (question, answers, dispatch) => {
|
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
export const mapApiSlideToUi = (dispatch) => (slide, answers) => {
|
|
167
|
-
if (!slide) {
|
|
168
|
-
throw new Error('no slide was found');
|
|
169
|
-
}
|
|
170
167
|
const questionText = getOr('', 'question.header', slide);
|
|
171
168
|
return {
|
|
172
169
|
questionText,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const freeTextSlide: SlideFromAPI;
|
|
4
|
-
export declare const freeTextUISlide: Partial<
|
|
4
|
+
export declare const freeTextUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmDragSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmDragUISlide: Partial<
|
|
4
|
+
export declare const qcmDragUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmGraphicSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmGraphicUISlide: Partial<
|
|
4
|
+
export declare const qcmGraphicUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmUISlide: Partial<
|
|
4
|
+
export declare const qcmUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const sliderSlide: SlideFromAPI;
|
|
4
|
-
export declare const sliderUISlide: Partial<
|
|
4
|
+
export declare const sliderUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const templateSlide: SlideFromAPI;
|
|
4
|
-
export declare const templateUISlide: Partial<
|
|
4
|
+
export declare const templateUISlide: Partial<ReviewSlide>;
|
|
@@ -67,8 +67,6 @@ export var fetchSlide = function (slideRef) {
|
|
|
67
67
|
response = _b.sent();
|
|
68
68
|
if (response.type === SLIDE_FETCH_SUCCESS) {
|
|
69
69
|
slideFromAPI = response.payload;
|
|
70
|
-
if (!slideFromAPI)
|
|
71
|
-
throw new Error('Slide not found');
|
|
72
70
|
state = getState();
|
|
73
71
|
slides = get('data.progression.state.slides', state);
|
|
74
72
|
if (isEmpty(slides)) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import get from 'lodash/fp/get';
|
|
2
|
+
import getOr from 'lodash/fp/getOr';
|
|
2
3
|
export var NEXT_SLIDE = '@@slide/NEXT_SLIDE';
|
|
3
4
|
export var nextSlide = function (dispatch, getState) {
|
|
4
|
-
var _a;
|
|
5
5
|
var state = getState();
|
|
6
6
|
var payload = {
|
|
7
7
|
currentSlideRef: get(['ui', 'currentSlideRef'], state),
|
|
8
|
-
nextSlideRef: get(['
|
|
9
|
-
animationType: (
|
|
8
|
+
nextSlideRef: get(['state', 'nextContent', 'ref'], state.data.progression),
|
|
9
|
+
animationType: getOr(false, ['state', 'isCorrect'], state.data.progression)
|
|
10
|
+
? 'unstack'
|
|
11
|
+
: 'restack'
|
|
10
12
|
};
|
|
11
13
|
var action = {
|
|
12
14
|
type: NEXT_SLIDE,
|
|
@@ -14,18 +14,19 @@ declare type StepItem = {
|
|
|
14
14
|
value: string;
|
|
15
15
|
};
|
|
16
16
|
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
17
|
-
export declare type
|
|
17
|
+
export declare type ReviewSlide = {
|
|
18
|
+
hidden: boolean;
|
|
19
|
+
position: number;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
showCorrectionPopin?: boolean;
|
|
22
|
+
animateCorrectionPopin?: boolean;
|
|
23
|
+
parentContentTitle?: string;
|
|
18
24
|
questionText?: string;
|
|
19
25
|
answerUI?: AnswerUI;
|
|
20
|
-
hidden?: boolean;
|
|
21
|
-
position: number;
|
|
22
26
|
animationType?: SlideUIAnimations;
|
|
23
|
-
isCorrect?: boolean;
|
|
24
|
-
endReview?: boolean;
|
|
25
|
-
loading: boolean;
|
|
26
27
|
};
|
|
27
28
|
declare type SlidesStack = {
|
|
28
|
-
[key in SlideIndexes]:
|
|
29
|
+
[key in SlideIndexes]: ReviewSlide;
|
|
29
30
|
};
|
|
30
31
|
declare type CorrectionPopinInformation = {
|
|
31
32
|
label: string;
|
|
@@ -38,6 +39,7 @@ declare type CorrectionPopinKlf = {
|
|
|
38
39
|
declare type CorrectionPopinNext = {
|
|
39
40
|
label: string;
|
|
40
41
|
ariaLabel: string;
|
|
42
|
+
onClick: Function;
|
|
41
43
|
};
|
|
42
44
|
export declare type CorrectionPopinProps = {
|
|
43
45
|
klf?: CorrectionPopinKlf;
|
|
@@ -14,13 +14,13 @@ import findLast from 'lodash/fp/findLast';
|
|
|
14
14
|
import get from 'lodash/fp/get';
|
|
15
15
|
import getOr from 'lodash/fp/getOr';
|
|
16
16
|
import last from 'lodash/fp/last';
|
|
17
|
-
import pipe from 'lodash/fp/pipe';
|
|
18
17
|
import reduce from 'lodash/fp/reduce';
|
|
19
18
|
import set from 'lodash/fp/set';
|
|
20
19
|
import slice from 'lodash/fp/slice';
|
|
21
20
|
import toInteger from 'lodash/fp/toInteger';
|
|
22
21
|
import join from 'lodash/fp/join';
|
|
23
22
|
import { postAnswer } from '../../actions/api/post-answer';
|
|
23
|
+
import { nextSlide } from '../../actions/ui/next-slide';
|
|
24
24
|
import { mapApiSlideToUi } from './map-api-slide-to-ui';
|
|
25
25
|
var ICON_VALUES = {
|
|
26
26
|
right: 'right',
|
|
@@ -82,9 +82,8 @@ var buildStackSlides = function (state, dispatch) {
|
|
|
82
82
|
var isCurrentSlideRef = currentSlideRef === slideRef;
|
|
83
83
|
var animateCorrectionPopin = isCurrentSlideRef && get(['ui', 'slide', slideRef, 'animateCorrectionPopin'], state);
|
|
84
84
|
var showCorrectionPopin = isCurrentSlideRef && get(['ui', 'slide', slideRef, 'showCorrectionPopin'], state);
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
)(uiSlide);
|
|
85
|
+
var animationType = get(['ui', 'slide', slideRef, 'animationType'], state);
|
|
86
|
+
var updatedUiSlide = __assign(__assign({}, uiSlide), { showCorrectionPopin: showCorrectionPopin, animateCorrectionPopin: animateCorrectionPopin, loading: false, questionText: questionText, answerUI: answerUI, parentContentTitle: "From \"".concat(parentContentTitle, "\" ").concat(parentContentType), animationType: animationType });
|
|
88
87
|
return set(index, updatedUiSlide, acc);
|
|
89
88
|
}, initialState, initialState);
|
|
90
89
|
return stack;
|
|
@@ -149,24 +148,31 @@ export var buildStepItems = function (state) {
|
|
|
149
148
|
});
|
|
150
149
|
return steps;
|
|
151
150
|
};
|
|
152
|
-
var getCorrectionPopinProps = function (
|
|
153
|
-
klf
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
var getCorrectionPopinProps = function (dispatch) {
|
|
152
|
+
return function (isCorrect, correctAnswer, klf) {
|
|
153
|
+
return {
|
|
154
|
+
klf: isCorrect
|
|
155
|
+
? undefined
|
|
156
|
+
: {
|
|
157
|
+
label: '_klf',
|
|
158
|
+
tooltip: klf
|
|
159
|
+
},
|
|
160
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
161
|
+
information: {
|
|
162
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
163
|
+
message: isCorrect ? klf : join(',', correctAnswer)
|
|
164
|
+
},
|
|
165
|
+
next: {
|
|
166
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
167
|
+
label: '_correctionNextLabel',
|
|
168
|
+
onClick: function () {
|
|
169
|
+
dispatch(nextSlide);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
type: isCorrect ? 'right' : 'wrong'
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
170
176
|
export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
171
177
|
var currentSlideRef = get(['ui', 'currentSlideRef'], state);
|
|
172
178
|
var correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -186,11 +192,11 @@ export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
|
186
192
|
validateButton: {
|
|
187
193
|
label: '__validate',
|
|
188
194
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
189
|
-
onClick:
|
|
195
|
+
onClick: function () {
|
|
190
196
|
dispatch(postAnswer);
|
|
191
197
|
}
|
|
192
198
|
},
|
|
193
|
-
correctionPopinProps: correction && getCorrectionPopinProps(isCorrect, correction.correctAnswer, klf),
|
|
199
|
+
correctionPopinProps: correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
194
200
|
endReview: false
|
|
195
201
|
},
|
|
196
202
|
congratsProps: undefined
|
|
@@ -179,9 +179,6 @@ var getAnswerUIModel = function (question, answers, dispatch) {
|
|
|
179
179
|
};
|
|
180
180
|
export var mapApiSlideToUi = function (dispatch) {
|
|
181
181
|
return function (slide, answers) {
|
|
182
|
-
if (!slide) {
|
|
183
|
-
throw new Error('no slide was found');
|
|
184
|
-
}
|
|
185
182
|
var questionText = getOr('', 'question.header', slide);
|
|
186
183
|
return {
|
|
187
184
|
questionText: questionText,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const freeTextSlide: SlideFromAPI;
|
|
4
|
-
export declare const freeTextUISlide: Partial<
|
|
4
|
+
export declare const freeTextUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmDragSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmDragUISlide: Partial<
|
|
4
|
+
export declare const qcmDragUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmGraphicSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmGraphicUISlide: Partial<
|
|
4
|
+
export declare const qcmGraphicUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const qcmSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmUISlide: Partial<
|
|
4
|
+
export declare const qcmUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const sliderSlide: SlideFromAPI;
|
|
4
|
-
export declare const sliderUISlide: Partial<
|
|
4
|
+
export declare const sliderUISlide: Partial<ReviewSlide>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReviewSlide } from '../..';
|
|
2
2
|
import { SlideFromAPI } from '../../../../types/common';
|
|
3
3
|
export declare const templateSlide: SlideFromAPI;
|
|
4
|
-
export declare const templateUISlide: Partial<
|
|
4
|
+
export declare const templateUISlide: Partial<ReviewSlide>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@coorpacademy/components": "10.23.
|
|
45
|
+
"@coorpacademy/components": "10.23.2",
|
|
46
46
|
"@coorpacademy/redux-task": "^1.1.5",
|
|
47
47
|
"cross-fetch": "^3.1.5",
|
|
48
48
|
"jwt-decode": "^3.1.2",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"webpack-cli": "^3.3.11",
|
|
78
78
|
"webpack-dev-server": "^3.11.0"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "e61dd34ad35298d25b20f60966d679a7f1f5657d"
|
|
81
81
|
}
|
|
@@ -41,7 +41,6 @@ export const fetchSlide =
|
|
|
41
41
|
|
|
42
42
|
if (response.type === SLIDE_FETCH_SUCCESS) {
|
|
43
43
|
const slideFromAPI = response.payload;
|
|
44
|
-
if (!slideFromAPI) throw new Error('Slide not found');
|
|
45
44
|
const state = getState();
|
|
46
45
|
const slides = get('data.progression.state.slides', state);
|
|
47
46
|
if (isEmpty(slides)) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type {Dispatch} from 'redux';
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
|
+
import getOr from 'lodash/fp/getOr';
|
|
3
4
|
import type {StoreState} from '../../reducers';
|
|
5
|
+
import {ProgressionFromAPI} from '../../types/common';
|
|
4
6
|
|
|
5
7
|
export const NEXT_SLIDE = '@@slide/NEXT_SLIDE' as const;
|
|
6
8
|
|
|
@@ -19,8 +21,13 @@ export const nextSlide = (dispatch: Dispatch, getState: () => StoreState): NextS
|
|
|
19
21
|
const state = getState();
|
|
20
22
|
const payload = {
|
|
21
23
|
currentSlideRef: get(['ui', 'currentSlideRef'], state),
|
|
22
|
-
nextSlideRef: get(
|
|
23
|
-
|
|
24
|
+
nextSlideRef: get(
|
|
25
|
+
['state', 'nextContent', 'ref'],
|
|
26
|
+
state.data.progression as ProgressionFromAPI
|
|
27
|
+
),
|
|
28
|
+
animationType: getOr(false, ['state', 'isCorrect'], state.data.progression)
|
|
29
|
+
? 'unstack'
|
|
30
|
+
: 'restack'
|
|
24
31
|
};
|
|
25
32
|
const action = {
|
|
26
33
|
type: NEXT_SLIDE,
|
|
@@ -3,7 +3,6 @@ import findLast from 'lodash/fp/findLast';
|
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
4
|
import getOr from 'lodash/fp/getOr';
|
|
5
5
|
import last from 'lodash/fp/last';
|
|
6
|
-
import pipe from 'lodash/fp/pipe';
|
|
7
6
|
import reduce from 'lodash/fp/reduce';
|
|
8
7
|
import set from 'lodash/fp/set';
|
|
9
8
|
import slice from 'lodash/fp/slice';
|
|
@@ -15,6 +14,7 @@ import type {SlideIndexes} from '../../common';
|
|
|
15
14
|
import type {StoreState} from '../../reducers';
|
|
16
15
|
import type {AnswerUI} from '../../types/slides';
|
|
17
16
|
import {postAnswer} from '../../actions/api/post-answer';
|
|
17
|
+
import {nextSlide} from '../../actions/ui/next-slide';
|
|
18
18
|
import {mapApiSlideToUi} from './map-api-slide-to-ui';
|
|
19
19
|
|
|
20
20
|
const ICON_VALUES = {
|
|
@@ -33,19 +33,20 @@ type StepItem = {
|
|
|
33
33
|
|
|
34
34
|
type SlideUIAnimations = 'unstack' | 'restack';
|
|
35
35
|
|
|
36
|
-
export type
|
|
36
|
+
export type ReviewSlide = {
|
|
37
|
+
hidden: boolean;
|
|
38
|
+
position: number;
|
|
39
|
+
loading: boolean;
|
|
40
|
+
showCorrectionPopin?: boolean;
|
|
41
|
+
animateCorrectionPopin?: boolean;
|
|
42
|
+
parentContentTitle?: string;
|
|
37
43
|
questionText?: string;
|
|
38
44
|
answerUI?: AnswerUI;
|
|
39
|
-
hidden?: boolean;
|
|
40
|
-
position: number;
|
|
41
45
|
animationType?: SlideUIAnimations;
|
|
42
|
-
isCorrect?: boolean;
|
|
43
|
-
endReview?: boolean;
|
|
44
|
-
loading: boolean;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
type SlidesStack = {
|
|
48
|
-
[key in SlideIndexes]:
|
|
49
|
+
[key in SlideIndexes]: ReviewSlide;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
type CorrectionPopinInformation = {
|
|
@@ -61,6 +62,7 @@ type CorrectionPopinKlf = {
|
|
|
61
62
|
type CorrectionPopinNext = {
|
|
62
63
|
label: string;
|
|
63
64
|
ariaLabel: string;
|
|
65
|
+
onClick: Function;
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
export type CorrectionPopinProps = {
|
|
@@ -158,10 +160,9 @@ const buildStackSlides = (state: StoreState, dispatch: Dispatch): SlidesStack =>
|
|
|
158
160
|
|
|
159
161
|
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
160
162
|
const stack = reduce.convert({cap: false})(
|
|
161
|
-
(acc: SlidesStack, uiSlide:
|
|
163
|
+
(acc: SlidesStack, uiSlide: ReviewSlide, index: string): SlidesStack => {
|
|
162
164
|
const slideRef = slideRefs[toInteger(index)];
|
|
163
165
|
if (!slideRef) return set(index, uiSlide, acc);
|
|
164
|
-
|
|
165
166
|
const slideFromAPI = get(slideRef, state.data.slides);
|
|
166
167
|
if (!slideFromAPI) return set(index, uiSlide, acc);
|
|
167
168
|
|
|
@@ -175,16 +176,18 @@ const buildStackSlides = (state: StoreState, dispatch: Dispatch): SlidesStack =>
|
|
|
175
176
|
isCurrentSlideRef && get(['ui', 'slide', slideRef, 'animateCorrectionPopin'], state);
|
|
176
177
|
const showCorrectionPopin =
|
|
177
178
|
isCurrentSlideRef && get(['ui', 'slide', slideRef, 'showCorrectionPopin'], state);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
const animationType = get(['ui', 'slide', slideRef, 'animationType'], state);
|
|
180
|
+
|
|
181
|
+
const updatedUiSlide = {
|
|
182
|
+
...uiSlide,
|
|
183
|
+
showCorrectionPopin,
|
|
184
|
+
animateCorrectionPopin,
|
|
185
|
+
loading: false,
|
|
186
|
+
questionText,
|
|
187
|
+
answerUI,
|
|
188
|
+
parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
|
|
189
|
+
animationType
|
|
190
|
+
};
|
|
188
191
|
|
|
189
192
|
return set(index, updatedUiSlide, acc);
|
|
190
193
|
},
|
|
@@ -275,28 +278,31 @@ export const buildStepItems = (state: StoreState): StepItem[] => {
|
|
|
275
278
|
return steps;
|
|
276
279
|
};
|
|
277
280
|
|
|
278
|
-
const getCorrectionPopinProps =
|
|
279
|
-
|
|
280
|
-
correctAnswer: string[],
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
281
|
+
const getCorrectionPopinProps =
|
|
282
|
+
(dispatch: Dispatch) =>
|
|
283
|
+
(isCorrect: boolean, correctAnswer: string[], klf: string): CorrectionPopinProps => {
|
|
284
|
+
return {
|
|
285
|
+
klf: isCorrect
|
|
286
|
+
? undefined
|
|
287
|
+
: {
|
|
288
|
+
label: '_klf',
|
|
289
|
+
tooltip: klf
|
|
290
|
+
},
|
|
291
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
292
|
+
information: {
|
|
293
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
294
|
+
message: isCorrect ? klf : join(',', correctAnswer)
|
|
288
295
|
},
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
});
|
|
296
|
+
next: {
|
|
297
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
298
|
+
label: '_correctionNextLabel',
|
|
299
|
+
onClick: (): void => {
|
|
300
|
+
dispatch(nextSlide);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
type: isCorrect ? 'right' : 'wrong'
|
|
304
|
+
};
|
|
305
|
+
};
|
|
300
306
|
|
|
301
307
|
export const mapStateToSlidesProps = (
|
|
302
308
|
state: StoreState,
|
|
@@ -322,12 +328,12 @@ export const mapStateToSlidesProps = (
|
|
|
322
328
|
validateButton: {
|
|
323
329
|
label: '__validate',
|
|
324
330
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
325
|
-
onClick:
|
|
331
|
+
onClick: (): void => {
|
|
326
332
|
dispatch(postAnswer);
|
|
327
333
|
}
|
|
328
334
|
},
|
|
329
335
|
correctionPopinProps:
|
|
330
|
-
correction && getCorrectionPopinProps(isCorrect, correction.correctAnswer, klf),
|
|
336
|
+
correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
331
337
|
endReview: false
|
|
332
338
|
},
|
|
333
339
|
congratsProps: undefined
|
|
@@ -278,9 +278,6 @@ const getAnswerUIModel = (
|
|
|
278
278
|
export const mapApiSlideToUi =
|
|
279
279
|
(dispatch: Dispatch) =>
|
|
280
280
|
(slide: SlideFromAPI, answers: string[]): {questionText: string; answerUI: AnswerUI} => {
|
|
281
|
-
if (!slide) {
|
|
282
|
-
throw new Error('no slide was found');
|
|
283
|
-
}
|
|
284
281
|
const questionText = getOr('', 'question.header', slide);
|
|
285
282
|
|
|
286
283
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const freeTextSlide: SlideFromAPI = {
|
|
@@ -29,7 +29,7 @@ export const freeTextSlide: SlideFromAPI = {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export const freeTextUISlide: Partial<
|
|
32
|
+
export const freeTextUISlide: Partial<ReviewSlide> = {
|
|
33
33
|
answerUI: {
|
|
34
34
|
help: 'Type your answer.',
|
|
35
35
|
model: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const qcmDragSlide: SlideFromAPI = {
|
|
@@ -75,7 +75,7 @@ export const qcmDragSlide: SlideFromAPI = {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export const qcmDragUISlide: Partial<
|
|
78
|
+
export const qcmDragUISlide: Partial<ReviewSlide> = {
|
|
79
79
|
questionText: "Remettez dans l'ordre les quatre étapes du burn out.",
|
|
80
80
|
answerUI: {
|
|
81
81
|
help: 'Sélectionnez les réponses ci-dessous dans le bon ordre.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const qcmGraphicSlide: SlideFromAPI = {
|
|
@@ -187,7 +187,7 @@ export const qcmGraphicSlide: SlideFromAPI = {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
export const qcmGraphicUISlide: Partial<
|
|
190
|
+
export const qcmGraphicUISlide: Partial<ReviewSlide> = {
|
|
191
191
|
questionText: 'Quels sont les 4 piliers de l’apprentissage ?',
|
|
192
192
|
answerUI: {
|
|
193
193
|
help: 'Sélectionnez les 4 bonnes réponses.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const qcmSlide: SlideFromAPI = {
|
|
@@ -78,7 +78,7 @@ export const qcmSlide: SlideFromAPI = {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
export const qcmUISlide: Partial<
|
|
81
|
+
export const qcmUISlide: Partial<ReviewSlide> = {
|
|
82
82
|
questionText: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?",
|
|
83
83
|
answerUI: {
|
|
84
84
|
help: 'Sélectionnez la bonne réponse.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const sliderSlide: SlideFromAPI = {
|
|
@@ -24,7 +24,7 @@ export const sliderSlide: SlideFromAPI = {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const sliderUISlide: Partial<
|
|
27
|
+
export const sliderUISlide: Partial<ReviewSlide> = {
|
|
28
28
|
questionText:
|
|
29
29
|
'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?',
|
|
30
30
|
answerUI: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/fp/noop';
|
|
2
|
-
import {
|
|
2
|
+
import {ReviewSlide} from '../..';
|
|
3
3
|
import {SlideFromAPI} from '../../../../types/common';
|
|
4
4
|
|
|
5
5
|
export const templateSlide: SlideFromAPI = {
|
|
@@ -91,7 +91,7 @@ export const templateSlide: SlideFromAPI = {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
export const templateUISlide: Partial<
|
|
94
|
+
export const templateUISlide: Partial<ReviewSlide> = {
|
|
95
95
|
questionText: 'Complétez la phrase ci-dessous.',
|
|
96
96
|
answerUI: {
|
|
97
97
|
help: 'Saisissez votre réponse ou sélectionnez la bonne réponse dans le(s) menu(s) déroulant(s).',
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getChoicesCorrection,
|
|
10
10
|
incorrectFreeTextPostAnswerResponse
|
|
11
11
|
} from '../../../test/util/services.mock';
|
|
12
|
-
import {
|
|
12
|
+
import {mapStateToSlidesProps} from '..';
|
|
13
13
|
import type {StoreState} from '../../../reducers';
|
|
14
14
|
import {freeTextSlide} from './fixtures/free-text';
|
|
15
15
|
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
@@ -17,36 +17,6 @@ import {templateSlide} from './fixtures/template';
|
|
|
17
17
|
import {qcmSlide} from './fixtures/qcm';
|
|
18
18
|
import {sliderSlide} from './fixtures/slider';
|
|
19
19
|
|
|
20
|
-
const popinPropsRightAnswer: CorrectionPopinProps = {
|
|
21
|
-
resultLabel: '_right',
|
|
22
|
-
information: {
|
|
23
|
-
label: '_klf',
|
|
24
|
-
message:
|
|
25
|
-
'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.'
|
|
26
|
-
},
|
|
27
|
-
klf: undefined,
|
|
28
|
-
next: {
|
|
29
|
-
ariaLabel: '_correctionNextAriaLabel',
|
|
30
|
-
label: '_correctionNextLabel'
|
|
31
|
-
},
|
|
32
|
-
type: 'right'
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const popinPropsWrongAnswer: CorrectionPopinProps = {
|
|
36
|
-
...popinPropsRightAnswer,
|
|
37
|
-
klf: {
|
|
38
|
-
label: '_klf',
|
|
39
|
-
tooltip:
|
|
40
|
-
'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.'
|
|
41
|
-
},
|
|
42
|
-
type: 'wrong',
|
|
43
|
-
resultLabel: '_wrong',
|
|
44
|
-
information: {
|
|
45
|
-
label: '_correctAnswer',
|
|
46
|
-
message: 'Benchmark'
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
20
|
test('should create initial props when fetched slide is not still received', t => {
|
|
51
21
|
// SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
|
|
52
22
|
const state: StoreState = {
|
|
@@ -209,6 +179,7 @@ test('should create props when first slide is on the state', t => {
|
|
|
209
179
|
endReview: false
|
|
210
180
|
});
|
|
211
181
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
182
|
+
animationType: undefined,
|
|
212
183
|
animateCorrectionPopin: false,
|
|
213
184
|
showCorrectionPopin: false,
|
|
214
185
|
hidden: false,
|
|
@@ -318,6 +289,7 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
318
289
|
endReview: false
|
|
319
290
|
});
|
|
320
291
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
292
|
+
animationType: undefined,
|
|
321
293
|
animateCorrectionPopin: false,
|
|
322
294
|
showCorrectionPopin: false,
|
|
323
295
|
hidden: false,
|
|
@@ -433,6 +405,7 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
433
405
|
endReview: false
|
|
434
406
|
});
|
|
435
407
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
408
|
+
animationType: undefined,
|
|
436
409
|
animateCorrectionPopin: false,
|
|
437
410
|
showCorrectionPopin: false,
|
|
438
411
|
hidden: false,
|
|
@@ -619,11 +592,23 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
619
592
|
}
|
|
620
593
|
]
|
|
621
594
|
});
|
|
622
|
-
t.
|
|
623
|
-
|
|
624
|
-
|
|
595
|
+
t.is(props.stack.endReview, false);
|
|
596
|
+
t.deepEqual(omit('next.onClick', props.stack.correctionPopinProps), {
|
|
597
|
+
resultLabel: '_right',
|
|
598
|
+
information: {
|
|
599
|
+
label: '_klf',
|
|
600
|
+
message:
|
|
601
|
+
'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.'
|
|
602
|
+
},
|
|
603
|
+
klf: undefined,
|
|
604
|
+
next: {
|
|
605
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
606
|
+
label: '_correctionNextLabel'
|
|
607
|
+
},
|
|
608
|
+
type: 'right'
|
|
625
609
|
});
|
|
626
610
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
611
|
+
animationType: undefined,
|
|
627
612
|
animateCorrectionPopin: true,
|
|
628
613
|
showCorrectionPopin: true,
|
|
629
614
|
hidden: false,
|
|
@@ -642,6 +627,7 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
642
627
|
}
|
|
643
628
|
});
|
|
644
629
|
t.deepEqual(omit('answerUI', props.stack.slides['1']), {
|
|
630
|
+
animationType: undefined,
|
|
645
631
|
animateCorrectionPopin: false,
|
|
646
632
|
showCorrectionPopin: false,
|
|
647
633
|
hidden: false,
|
|
@@ -740,11 +726,26 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
740
726
|
}
|
|
741
727
|
]
|
|
742
728
|
});
|
|
743
|
-
t.
|
|
744
|
-
|
|
745
|
-
|
|
729
|
+
t.is(props.stack.endReview, false);
|
|
730
|
+
t.deepEqual(omit('next.onClick', props.stack.correctionPopinProps), {
|
|
731
|
+
resultLabel: '_wrong',
|
|
732
|
+
information: {
|
|
733
|
+
label: '_correctAnswer',
|
|
734
|
+
message: 'Benchmark'
|
|
735
|
+
},
|
|
736
|
+
klf: {
|
|
737
|
+
label: '_klf',
|
|
738
|
+
tooltip:
|
|
739
|
+
'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.'
|
|
740
|
+
},
|
|
741
|
+
next: {
|
|
742
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
743
|
+
label: '_correctionNextLabel'
|
|
744
|
+
},
|
|
745
|
+
type: 'wrong'
|
|
746
746
|
});
|
|
747
747
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
748
|
+
animationType: undefined,
|
|
748
749
|
animateCorrectionPopin: true,
|
|
749
750
|
showCorrectionPopin: true,
|
|
750
751
|
hidden: false,
|
|
@@ -763,6 +764,7 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
763
764
|
}
|
|
764
765
|
});
|
|
765
766
|
t.deepEqual(omit('answerUI', props.stack.slides['1']), {
|
|
767
|
+
animationType: undefined,
|
|
766
768
|
animateCorrectionPopin: false,
|
|
767
769
|
showCorrectionPopin: false,
|
|
768
770
|
hidden: false,
|
|
@@ -811,13 +813,15 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
811
813
|
currentSlideRef: 'sli_VkSQroQnx',
|
|
812
814
|
navigation: ['loader', 'slides'],
|
|
813
815
|
answers: {
|
|
814
|
-
sli_VJYjJnJhg: ['Benchmark']
|
|
816
|
+
sli_VJYjJnJhg: ['Benchmark'],
|
|
817
|
+
sli_VkSQroQnx: []
|
|
815
818
|
},
|
|
816
819
|
slide: {
|
|
817
820
|
sli_VJYjJnJhg: {
|
|
818
821
|
validateButton: false,
|
|
819
822
|
animateCorrectionPopin: false,
|
|
820
|
-
showCorrectionPopin: true
|
|
823
|
+
showCorrectionPopin: true,
|
|
824
|
+
animationType: 'unstack'
|
|
821
825
|
},
|
|
822
826
|
sli_VkSQroQnx: {
|
|
823
827
|
validateButton: false,
|
|
@@ -904,22 +908,26 @@ test('should verify props when progression is in success', t => {
|
|
|
904
908
|
sli_VJYjJnJhg: {
|
|
905
909
|
validateButton: false,
|
|
906
910
|
animateCorrectionPopin: false,
|
|
907
|
-
showCorrectionPopin: false
|
|
911
|
+
showCorrectionPopin: false,
|
|
912
|
+
animationType: 'unstack'
|
|
908
913
|
},
|
|
909
914
|
sli_VkSQroQnx: {
|
|
910
915
|
validateButton: false,
|
|
911
916
|
animateCorrectionPopin: false,
|
|
912
|
-
showCorrectionPopin: false
|
|
917
|
+
showCorrectionPopin: false,
|
|
918
|
+
animationType: 'unstack'
|
|
913
919
|
},
|
|
914
920
|
sli_N1XACJobn: {
|
|
915
921
|
validateButton: false,
|
|
916
922
|
animateCorrectionPopin: false,
|
|
917
|
-
showCorrectionPopin: false
|
|
923
|
+
showCorrectionPopin: false,
|
|
924
|
+
animationType: 'unstack'
|
|
918
925
|
},
|
|
919
926
|
sli_VkAzsCLKb: {
|
|
920
927
|
validateButton: false,
|
|
921
928
|
animateCorrectionPopin: false,
|
|
922
|
-
showCorrectionPopin: false
|
|
929
|
+
showCorrectionPopin: false,
|
|
930
|
+
animationType: 'unstack'
|
|
923
931
|
},
|
|
924
932
|
'sli_N13-hG3kX': {
|
|
925
933
|
validateButton: false,
|
|
@@ -1011,22 +1019,26 @@ test('should verify props when progression has answered a current pendingSlide',
|
|
|
1011
1019
|
sli_VkSQroQnx: {
|
|
1012
1020
|
validateButton: false,
|
|
1013
1021
|
animateCorrectionPopin: false,
|
|
1014
|
-
showCorrectionPopin: false
|
|
1022
|
+
showCorrectionPopin: false,
|
|
1023
|
+
animationType: 'unstack'
|
|
1015
1024
|
},
|
|
1016
1025
|
sli_N1XACJobn: {
|
|
1017
1026
|
validateButton: false,
|
|
1018
1027
|
animateCorrectionPopin: false,
|
|
1019
|
-
showCorrectionPopin: false
|
|
1028
|
+
showCorrectionPopin: false,
|
|
1029
|
+
animationType: 'restack'
|
|
1020
1030
|
},
|
|
1021
1031
|
sli_VkAzsCLKb: {
|
|
1022
1032
|
validateButton: false,
|
|
1023
1033
|
animateCorrectionPopin: false,
|
|
1024
|
-
showCorrectionPopin: false
|
|
1034
|
+
showCorrectionPopin: false,
|
|
1035
|
+
animationType: 'unstack'
|
|
1025
1036
|
},
|
|
1026
1037
|
'sli_N13-hG3kX': {
|
|
1027
1038
|
validateButton: false,
|
|
1028
1039
|
animateCorrectionPopin: false,
|
|
1029
|
-
showCorrectionPopin: false
|
|
1040
|
+
showCorrectionPopin: false,
|
|
1041
|
+
animationType: 'unstack'
|
|
1030
1042
|
}
|
|
1031
1043
|
}
|
|
1032
1044
|
}
|
|
@@ -1105,12 +1117,14 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1105
1117
|
sli_VJYjJnJhg: {
|
|
1106
1118
|
validateButton: false,
|
|
1107
1119
|
animateCorrectionPopin: false,
|
|
1108
|
-
showCorrectionPopin: false
|
|
1120
|
+
showCorrectionPopin: false,
|
|
1121
|
+
animationType: 'unstack'
|
|
1109
1122
|
},
|
|
1110
1123
|
sli_VkSQroQnx: {
|
|
1111
1124
|
validateButton: false,
|
|
1112
1125
|
animateCorrectionPopin: false,
|
|
1113
|
-
showCorrectionPopin: false
|
|
1126
|
+
showCorrectionPopin: false,
|
|
1127
|
+
animationType: 'unstack'
|
|
1114
1128
|
},
|
|
1115
1129
|
sli_N1XACJobn: {
|
|
1116
1130
|
validateButton: false,
|
|
@@ -1120,12 +1134,14 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1120
1134
|
sli_VkAzsCLKb: {
|
|
1121
1135
|
validateButton: false,
|
|
1122
1136
|
animateCorrectionPopin: false,
|
|
1123
|
-
showCorrectionPopin: false
|
|
1137
|
+
showCorrectionPopin: false,
|
|
1138
|
+
animationType: 'unstack'
|
|
1124
1139
|
},
|
|
1125
1140
|
'sli_N13-hG3kX': {
|
|
1126
1141
|
validateButton: false,
|
|
1127
1142
|
animateCorrectionPopin: false,
|
|
1128
|
-
showCorrectionPopin: false
|
|
1143
|
+
showCorrectionPopin: false,
|
|
1144
|
+
animationType: 'unstack'
|
|
1129
1145
|
}
|
|
1130
1146
|
}
|
|
1131
1147
|
}
|
|
@@ -2,7 +2,7 @@ import test from 'ava';
|
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import {SlideFromAPI} from '../../../types/common';
|
|
4
4
|
import {mapApiSlideToUi} from '../map-api-slide-to-ui';
|
|
5
|
-
import {
|
|
5
|
+
import {ReviewSlide} from '..';
|
|
6
6
|
import {qcmUISlide, qcmSlide} from './fixtures/qcm';
|
|
7
7
|
import {qcmDragUISlide, qcmDragSlide} from './fixtures/qcm-drag';
|
|
8
8
|
import {freeTextSlide, freeTextUISlide} from './fixtures/free-text';
|
|
@@ -21,7 +21,7 @@ const macro = test.macro({
|
|
|
21
21
|
arg: {
|
|
22
22
|
slide: SlideFromAPI;
|
|
23
23
|
answers: string[];
|
|
24
|
-
expectedUiSlide: Partial<
|
|
24
|
+
expectedUiSlide: Partial<ReviewSlide>;
|
|
25
25
|
}
|
|
26
26
|
) {
|
|
27
27
|
t.deepEqual(
|
|
@@ -72,6 +72,7 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
|
|
|
72
72
|
|
|
73
73
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
74
74
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
75
|
+
animationType: undefined,
|
|
75
76
|
animateCorrectionPopin: false,
|
|
76
77
|
showCorrectionPopin: false,
|
|
77
78
|
hidden: false,
|
|
@@ -72,6 +72,7 @@ test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Dra
|
|
|
72
72
|
|
|
73
73
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
74
74
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
75
|
+
animationType: undefined,
|
|
75
76
|
animateCorrectionPopin: false,
|
|
76
77
|
showCorrectionPopin: false,
|
|
77
78
|
hidden: false,
|
|
@@ -72,6 +72,7 @@ test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM
|
|
|
72
72
|
|
|
73
73
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
74
74
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
75
|
+
animationType: undefined,
|
|
75
76
|
animateCorrectionPopin: false,
|
|
76
77
|
showCorrectionPopin: false,
|
|
77
78
|
hidden: false,
|
|
@@ -74,6 +74,7 @@ test('should dispatch EDIT_QCM action via the property onClick of a QCM slide',
|
|
|
74
74
|
|
|
75
75
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
76
76
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
77
|
+
animationType: undefined,
|
|
77
78
|
animateCorrectionPopin: false,
|
|
78
79
|
showCorrectionPopin: false,
|
|
79
80
|
hidden: false,
|
|
@@ -72,6 +72,7 @@ test('should dispatch EDIT_SLIDER action via the property onChange of a Slider s
|
|
|
72
72
|
|
|
73
73
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
74
74
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
75
|
+
animationType: undefined,
|
|
75
76
|
animateCorrectionPopin: false,
|
|
76
77
|
showCorrectionPopin: false,
|
|
77
78
|
hidden: false,
|
|
@@ -68,6 +68,7 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
68
68
|
|
|
69
69
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
70
70
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
71
|
+
animationType: undefined,
|
|
71
72
|
animateCorrectionPopin: false,
|
|
72
73
|
showCorrectionPopin: false,
|
|
73
74
|
hidden: false,
|
|
@@ -92,6 +93,7 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
92
93
|
|
|
93
94
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
94
95
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
96
|
+
animationType: undefined,
|
|
95
97
|
animateCorrectionPopin: false,
|
|
96
98
|
showCorrectionPopin: false,
|
|
97
99
|
hidden: false,
|