@coorpacademy/app-review 0.2.4 → 0.2.6
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/post-answer.js +4 -2
- package/es/actions/api/test/fetch-correction.test.js +2 -1
- package/es/actions/api/test/fetch-skills.test.js +2 -1
- package/es/actions/api/test/fetch-slide.test.js +2 -1
- package/es/actions/api/test/post-answer.test.js +32 -10
- package/es/actions/api/test/post-progression.test.js +2 -1
- package/es/actions/data/test/token.test.js +2 -1
- package/es/actions/test/create-test-store.d.ts +1 -1
- package/es/actions/ui/answers.js +13 -6
- package/es/actions/ui/test/answers.test.js +17 -1
- package/es/actions/ui/test/slides.test.js +2 -1
- package/es/reducers/data/index.d.ts +4 -2
- package/es/reducers/data/index.js +2 -6
- package/es/reducers/index.d.ts +2 -1
- package/es/reducers/ui/index.d.ts +1 -1
- package/es/reducers/ui/slide.d.ts +3 -1
- package/es/reducers/ui/slide.js +5 -0
- package/es/reducers/ui/test/slide.test.js +12 -0
- package/es/types/slides.d.ts +1 -0
- package/es/views/skills/test/skills.test.js +4 -2
- package/es/views/slides/map-api-slide-to-ui.js +8 -7
- package/es/views/slides/test/fixtures/qcm-graphic.js +4 -2
- package/es/views/slides/test/fixtures/qcm.js +4 -4
- package/es/views/slides/test/index.test.js +20 -10
- package/es/views/slides/test/slide.free-text.on-change.test.d.ts +1 -0
- package/es/views/slides/test/slide.free-text.on-change.test.js +69 -0
- package/es/views/slides/test/slide.qcm-drag.on-click.test.d.ts +1 -0
- package/es/views/slides/test/slide.qcm-drag.on-click.test.js +69 -0
- package/es/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +1 -0
- package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +69 -0
- package/es/views/slides/test/slide.qcm.on-click.test.d.ts +1 -0
- package/es/views/slides/test/slide.qcm.on-click.test.js +71 -0
- package/es/views/slides/test/slide.slider.on-change.test.d.ts +1 -0
- package/es/views/slides/test/slide.slider.on-change.test.js +70 -0
- package/es/views/slides/test/slide.template.on-change.test.js +2 -1
- package/lib/actions/api/post-answer.js +9 -5
- package/lib/actions/api/test/fetch-correction.test.js +2 -1
- package/lib/actions/api/test/fetch-skills.test.js +2 -1
- package/lib/actions/api/test/fetch-slide.test.js +2 -1
- package/lib/actions/api/test/post-answer.test.js +45 -14
- package/lib/actions/api/test/post-progression.test.js +2 -1
- package/lib/actions/data/test/token.test.js +2 -1
- package/lib/actions/test/create-test-store.d.ts +1 -1
- package/lib/actions/ui/answers.js +13 -6
- package/lib/actions/ui/test/answers.test.js +43 -1
- package/lib/actions/ui/test/slides.test.js +2 -1
- package/lib/reducers/data/index.d.ts +4 -2
- package/lib/reducers/data/index.js +2 -6
- package/lib/reducers/index.d.ts +2 -1
- package/lib/reducers/ui/index.d.ts +1 -1
- package/lib/reducers/ui/slide.d.ts +3 -1
- package/lib/reducers/ui/slide.js +5 -0
- package/lib/reducers/ui/test/slide.test.js +12 -0
- package/lib/types/slides.d.ts +1 -0
- package/lib/views/skills/test/skills.test.js +4 -2
- package/lib/views/slides/map-api-slide-to-ui.js +8 -7
- package/lib/views/slides/test/fixtures/qcm-graphic.js +4 -2
- package/lib/views/slides/test/fixtures/qcm.js +4 -4
- package/lib/views/slides/test/index.test.js +20 -10
- package/lib/views/slides/test/slide.free-text.on-change.test.d.ts +1 -0
- package/lib/views/slides/test/slide.free-text.on-change.test.js +71 -0
- package/lib/views/slides/test/slide.qcm-drag.on-click.test.d.ts +1 -0
- package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +71 -0
- package/lib/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +1 -0
- package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +71 -0
- package/lib/views/slides/test/slide.qcm.on-click.test.d.ts +1 -0
- package/lib/views/slides/test/slide.qcm.on-click.test.js +73 -0
- package/lib/views/slides/test/slide.slider.on-change.test.d.ts +1 -0
- package/lib/views/slides/test/slide.slider.on-change.test.js +72 -0
- package/lib/views/slides/test/slide.template.on-change.test.js +2 -1
- package/package.json +3 -3
- package/src/actions/api/post-answer.ts +4 -2
- package/src/actions/api/test/fetch-correction.test.ts +2 -1
- package/src/actions/api/test/fetch-skills.test.ts +2 -1
- package/src/actions/api/test/fetch-slide.test.ts +2 -1
- package/src/actions/api/test/post-answer.test.ts +51 -10
- package/src/actions/api/test/post-progression.test.ts +2 -1
- package/src/actions/data/test/token.test.ts +2 -1
- package/src/actions/test/create-test-store.ts +1 -1
- package/src/actions/ui/answers.ts +15 -6
- package/src/actions/ui/test/answers.test.ts +33 -2
- package/src/actions/ui/test/slides.test.ts +2 -1
- package/src/reducers/data/index.ts +3 -7
- package/src/reducers/ui/slide.ts +7 -1
- package/src/reducers/ui/test/slide.test.ts +13 -0
- package/src/types/slides.ts +1 -0
- package/src/views/skills/test/skills.test.ts +4 -2
- package/src/views/slides/map-api-slide-to-ui.ts +8 -7
- package/src/views/slides/test/fixtures/qcm-graphic.ts +4 -2
- package/src/views/slides/test/fixtures/qcm.ts +5 -4
- package/src/views/slides/test/index.test.ts +20 -10
- package/src/views/slides/test/slide.free-text.on-change.test.ts +79 -0
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +78 -0
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +79 -0
- package/src/views/slides/test/slide.qcm.on-click.test.ts +80 -0
- package/src/views/slides/test/slide.slider.on-change.test.ts +80 -0
- package/src/views/slides/test/slide.template.on-change.test.ts +2 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
13
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
14
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -37,6 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
48
|
import test from 'ava';
|
|
38
49
|
import pipe from 'lodash/fp/pipe';
|
|
39
50
|
import set from 'lodash/fp/set';
|
|
51
|
+
import omit from 'lodash/fp/omit';
|
|
40
52
|
import { createTestStore } from '../../test/create-test-store';
|
|
41
53
|
import { services } from '../../../test/util/services.mock';
|
|
42
54
|
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
@@ -74,7 +86,8 @@ var initialState = {
|
|
|
74
86
|
},
|
|
75
87
|
slides: {},
|
|
76
88
|
skills: [],
|
|
77
|
-
token: '1234'
|
|
89
|
+
token: '1234',
|
|
90
|
+
corrections: {}
|
|
78
91
|
},
|
|
79
92
|
ui: {
|
|
80
93
|
currentSlideRef: '',
|
|
@@ -88,6 +101,35 @@ var initialState = {
|
|
|
88
101
|
var buildInitialState = function (state, question) {
|
|
89
102
|
return pipe(set(['data', 'progression', 'state', 'nextContent', 'ref'], question._id), set(['data', 'slides', question._id], question), set(['ui', 'currentSlideRef'], question._id))(state);
|
|
90
103
|
};
|
|
104
|
+
test('editAnswer should throw an Error if the slide is not found', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
var state, expectedActions, dispatch;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
state = buildInitialState(initialState, freeTextSlide);
|
|
110
|
+
expectedActions = [{ type: undefined, payload: [] }];
|
|
111
|
+
dispatch = createTestStore(t, omit(['data', 'slides'], state), services, expectedActions).dispatch;
|
|
112
|
+
return [4 /*yield*/, t.throws(function () { return dispatch(editAnswer(['Some kind of answer'])); }, undefined, 'No slide was found or questionType was not found')];
|
|
113
|
+
case 1:
|
|
114
|
+
_a.sent();
|
|
115
|
+
return [2 /*return*/];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}); });
|
|
119
|
+
test('editAnswer should throw an Error for unsupported questions', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
120
|
+
var state, dispatch;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
state = buildInitialState(initialState, __assign(__assign({}, freeTextSlide), { question: __assign(__assign({}, freeTextSlide.question), { type: 'unsupportedType' }) }));
|
|
125
|
+
dispatch = createTestStore(t, state, services, []).dispatch;
|
|
126
|
+
return [4 /*yield*/, t.throws(function () { return dispatch(editAnswer(['Some kind of answer'])); }, undefined, 'Question type unsupportedType is not supported')];
|
|
127
|
+
case 1:
|
|
128
|
+
_a.sent();
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); });
|
|
91
133
|
test('should dispatch EDIT_BASIC action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
134
|
var state, expectedActions, dispatch;
|
|
93
135
|
return __generator(this, function (_a) {
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import { CorrectionsState } from './corrections';
|
|
1
2
|
import { ProgressionState } from './progression';
|
|
2
3
|
import { SkillsState } from './skills';
|
|
3
4
|
import { SlidesState } from './slides';
|
|
4
5
|
import { TokenState } from './token';
|
|
5
6
|
export declare type DataState = {
|
|
6
|
-
|
|
7
|
+
corrections: CorrectionsState;
|
|
7
8
|
progression: ProgressionState;
|
|
8
9
|
skills: SkillsState;
|
|
9
10
|
slides: SlidesState;
|
|
10
11
|
token: TokenState;
|
|
11
12
|
};
|
|
12
13
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
14
|
+
corrections: CorrectionsState;
|
|
13
15
|
progression: ProgressionState;
|
|
14
16
|
skills: SkillsState;
|
|
15
17
|
slides: SlidesState;
|
|
16
18
|
token: string;
|
|
17
|
-
}>, import("../../actions/api/post-answer").PostAnswerSuccessAction | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
|
|
19
|
+
}>, import("./corrections").CorrectionsAction | import("../../actions/api/post-answer").PostAnswerSuccessAction | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
|
|
18
20
|
export default _default;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { combineReducers } from 'redux';
|
|
2
|
+
import corrections from './corrections';
|
|
2
3
|
import progression from './progression';
|
|
3
4
|
import skills from './skills';
|
|
4
5
|
import slides from './slides';
|
|
5
6
|
import token from './token';
|
|
6
|
-
export default combineReducers({
|
|
7
|
-
progression: progression,
|
|
8
|
-
skills: skills,
|
|
9
|
-
slides: slides,
|
|
10
|
-
token: token
|
|
11
|
-
});
|
|
7
|
+
export default combineReducers({ corrections: corrections, progression: progression, skills: skills, slides: slides, token: token });
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare type StoreState = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
8
8
|
data: import("redux").CombinedState<{
|
|
9
|
+
corrections: import("./data/corrections").CorrectionsState;
|
|
9
10
|
progression: import("./data/progression").ProgressionState;
|
|
10
11
|
skills: import("./data/skills").SkillsState;
|
|
11
12
|
slides: import("./data/slides").SlidesState;
|
|
@@ -17,5 +18,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
17
18
|
answers: import("./ui/answers").AnswerState;
|
|
18
19
|
slide: import("./ui/slide").UISlideState;
|
|
19
20
|
}>;
|
|
20
|
-
}>, import("../actions/ui/slides").SetCurrentSlide | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/post-progression").ReceivedProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/navigation").NavigateTo | import("../actions/ui/navigation").NavigateBack | import("../actions/ui/answers").EditAnswerAction>;
|
|
21
|
+
}>, import("./data/corrections").CorrectionsAction | import("../actions/ui/slides").SetCurrentSlide | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/post-progression").ReceivedProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/navigation").NavigateTo | import("../actions/ui/navigation").NavigateBack | import("../actions/ui/answers").EditAnswerAction>;
|
|
21
22
|
export default _default;
|
|
@@ -13,5 +13,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
13
13
|
navigation: NavigationState;
|
|
14
14
|
answers: AnswerState;
|
|
15
15
|
slide: UISlideState;
|
|
16
|
-
}>, import("../../actions/ui/slides").SetCurrentSlide | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/navigation").NavigateTo | import("../../actions/ui/navigation").NavigateBack | import("../../actions/ui/answers").EditAnswerAction>;
|
|
16
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlide | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/navigation").NavigateTo | import("../../actions/ui/navigation").NavigateBack | import("../../actions/ui/answers").EditAnswerAction>;
|
|
17
17
|
export default _default;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EditAnswerAction } from '../../actions/ui/answers';
|
|
2
2
|
import { PostAnswerRequestAction } from '../../actions/api/post-answer';
|
|
3
|
+
import { ReceivedCorrection } from '../../actions/api/fetch-correction';
|
|
3
4
|
export declare type UISlideState = {
|
|
4
5
|
validateButton: boolean;
|
|
6
|
+
animateCorrectionPopin?: boolean;
|
|
5
7
|
};
|
|
6
8
|
export declare const initialState: UISlideState;
|
|
7
|
-
declare const reducer: (state: UISlideState | undefined, action: PostAnswerRequestAction | EditAnswerAction) => UISlideState;
|
|
9
|
+
declare const reducer: (state: UISlideState | undefined, action: PostAnswerRequestAction | EditAnswerAction | ReceivedCorrection) => UISlideState;
|
|
8
10
|
export default reducer;
|
package/lib/reducers/ui/slide.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import compact from 'lodash/fp/compact';
|
|
2
2
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
3
3
|
import pipe from 'lodash/fp/pipe';
|
|
4
|
+
import set from 'lodash/fp/set';
|
|
4
5
|
import { EDIT_BASIC, EDIT_QCM, EDIT_QCM_DRAG, EDIT_QCM_GRAPHIC, EDIT_SLIDER, EDIT_TEMPLATE } from '../../actions/ui/answers';
|
|
5
6
|
import { POST_ANSWER_REQUEST } from '../../actions/api/post-answer';
|
|
7
|
+
import { CORRECTION_FETCH_SUCCESS } from '../../actions/api/fetch-correction';
|
|
6
8
|
export var initialState = { validateButton: false };
|
|
7
9
|
var reducer = function (
|
|
8
10
|
// eslint-disable-next-line default-param-last
|
|
@@ -20,6 +22,9 @@ state, action) {
|
|
|
20
22
|
case POST_ANSWER_REQUEST: {
|
|
21
23
|
return initialState;
|
|
22
24
|
}
|
|
25
|
+
case CORRECTION_FETCH_SUCCESS: {
|
|
26
|
+
return set(['animateCorrectionPopin'], true, state);
|
|
27
|
+
}
|
|
23
28
|
default:
|
|
24
29
|
return state;
|
|
25
30
|
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
2
|
import reducer, { initialState } from '../slide';
|
|
3
3
|
import { EDIT_BASIC } from '../../../actions/ui/answers';
|
|
4
|
+
import { CORRECTION_FETCH_SUCCESS } from '../../../actions/api/fetch-correction';
|
|
4
5
|
test('should use initial state if no answers are found when an EditAnswerAction is received', function (t) {
|
|
5
6
|
var state = reducer(undefined, { type: EDIT_BASIC, payload: [''] });
|
|
6
7
|
t.truthy(state);
|
|
7
8
|
t.false(state.validateButton);
|
|
9
|
+
t.falsy(state.animateCorrectionPopin);
|
|
10
|
+
});
|
|
11
|
+
test('should set animateCorrectionPopin to true if CORRECTION_FETCH_SUCCESS is received', function (t) {
|
|
12
|
+
var state = reducer(undefined, {
|
|
13
|
+
type: CORRECTION_FETCH_SUCCESS,
|
|
14
|
+
payload: undefined,
|
|
15
|
+
meta: { slideRef: '1234' }
|
|
16
|
+
});
|
|
17
|
+
t.truthy(state);
|
|
18
|
+
t.false(state.validateButton);
|
|
19
|
+
t.true(state.animateCorrectionPopin);
|
|
8
20
|
});
|
|
9
21
|
test('should return state directly when there is no corresponding action handler + have an initial state', function (t) {
|
|
10
22
|
var state = reducer(undefined, { type: 'NOPE' });
|
package/lib/types/slides.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ test('should create initial props when there are no skills on the state', functi
|
|
|
8
8
|
progression: null,
|
|
9
9
|
skills: [],
|
|
10
10
|
slides: {},
|
|
11
|
-
token: '1234'
|
|
11
|
+
token: '1234',
|
|
12
|
+
corrections: {}
|
|
12
13
|
},
|
|
13
14
|
ui: {
|
|
14
15
|
currentSlideRef: '',
|
|
@@ -49,7 +50,8 @@ test('should create initial props when skills on the state', function (t) {
|
|
|
49
50
|
}
|
|
50
51
|
],
|
|
51
52
|
slides: {},
|
|
52
|
-
token: '1234'
|
|
53
|
+
token: '1234',
|
|
54
|
+
corrections: {}
|
|
53
55
|
},
|
|
54
56
|
ui: {
|
|
55
57
|
currentSlideRef: '',
|
|
@@ -5,14 +5,14 @@ var qcmProps = function (dispatch) {
|
|
|
5
5
|
return {
|
|
6
6
|
type: 'qcm',
|
|
7
7
|
answers: map(function (choice) {
|
|
8
|
-
var label =
|
|
8
|
+
var label = getOr('', 'label', choice);
|
|
9
9
|
return {
|
|
10
10
|
title: label,
|
|
11
11
|
selected: includes(label, answers),
|
|
12
12
|
onClick: function () {
|
|
13
13
|
dispatch(editAnswer([label]));
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
'aria-label': label
|
|
16
16
|
};
|
|
17
17
|
}, question.content.choices)
|
|
18
18
|
};
|
|
@@ -23,7 +23,7 @@ var qcmDragProps = function (dispatch) {
|
|
|
23
23
|
return {
|
|
24
24
|
type: 'qcmDrag',
|
|
25
25
|
answers: map(function (choice) {
|
|
26
|
-
var label =
|
|
26
|
+
var label = getOr('', 'label', choice);
|
|
27
27
|
var indexInAnswer = indexOf(label, answers);
|
|
28
28
|
return {
|
|
29
29
|
title: label,
|
|
@@ -42,14 +42,15 @@ var qcmGraphicProps = function (dispatch) {
|
|
|
42
42
|
return {
|
|
43
43
|
type: 'qcmGraphic',
|
|
44
44
|
answers: map(function (choice) {
|
|
45
|
-
var label =
|
|
45
|
+
var label = getOr('', 'label', choice);
|
|
46
46
|
return {
|
|
47
47
|
title: label,
|
|
48
48
|
image: get('media.src.0.url', choice),
|
|
49
49
|
selected: includes(label, answers),
|
|
50
50
|
onClick: function () {
|
|
51
51
|
dispatch(editAnswer([label]));
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
|
+
ariaLabel: label
|
|
53
54
|
};
|
|
54
55
|
}, question.content.choices)
|
|
55
56
|
};
|
|
@@ -117,8 +118,8 @@ var basicProps = function (dispatch) {
|
|
|
117
118
|
return function (answers, question) {
|
|
118
119
|
return {
|
|
119
120
|
type: 'freeText',
|
|
120
|
-
placeholder:
|
|
121
|
-
value:
|
|
121
|
+
placeholder: getOr('', 'content.placeholder', question),
|
|
122
|
+
value: getOr('', '0', answers),
|
|
122
123
|
onChange: function (text) {
|
|
123
124
|
dispatch(editAnswer([text]));
|
|
124
125
|
}
|
|
@@ -74,13 +74,15 @@ export var qcmGraphicUISlide = {
|
|
|
74
74
|
title: 'Vrai',
|
|
75
75
|
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
|
|
76
76
|
selected: false,
|
|
77
|
-
onClick: noop
|
|
77
|
+
onClick: noop,
|
|
78
|
+
ariaLabel: 'Vrai'
|
|
78
79
|
},
|
|
79
80
|
{
|
|
80
81
|
title: 'Faux',
|
|
81
82
|
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
|
|
82
83
|
selected: false,
|
|
83
|
-
onClick: noop
|
|
84
|
+
onClick: noop,
|
|
85
|
+
ariaLabel: 'Faux'
|
|
84
86
|
}
|
|
85
87
|
]
|
|
86
88
|
}
|
|
@@ -83,25 +83,25 @@ export var qcmUISlide = {
|
|
|
83
83
|
title: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
|
|
84
84
|
selected: false,
|
|
85
85
|
onClick: noop,
|
|
86
|
-
|
|
86
|
+
'aria-label': 'Le créateur peut fixer un pourcentage pour chaque transaction future'
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
title: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
|
|
90
90
|
selected: false,
|
|
91
91
|
onClick: noop,
|
|
92
|
-
|
|
92
|
+
'aria-label': "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
title: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
|
|
96
96
|
selected: false,
|
|
97
97
|
onClick: noop,
|
|
98
|
-
|
|
98
|
+
'aria-label': "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT"
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
title: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
|
|
102
102
|
selected: false,
|
|
103
103
|
onClick: noop,
|
|
104
|
-
|
|
104
|
+
'aria-label': "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission"
|
|
105
105
|
}
|
|
106
106
|
]
|
|
107
107
|
}
|
|
@@ -18,7 +18,8 @@ test('should create initial props when fetched slide is not still received', fun
|
|
|
18
18
|
slides: {
|
|
19
19
|
sli_N1XACJobn: null
|
|
20
20
|
},
|
|
21
|
-
token: '1234'
|
|
21
|
+
token: '1234',
|
|
22
|
+
corrections: {}
|
|
22
23
|
},
|
|
23
24
|
ui: {
|
|
24
25
|
currentSlideRef: '',
|
|
@@ -105,7 +106,8 @@ test('should create props when first slide is on the state', function (t) {
|
|
|
105
106
|
slides: {
|
|
106
107
|
sli_VJYjJnJhg: freeTextSlide
|
|
107
108
|
},
|
|
108
|
-
token: '1234'
|
|
109
|
+
token: '1234',
|
|
110
|
+
corrections: {}
|
|
109
111
|
},
|
|
110
112
|
ui: {
|
|
111
113
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -203,7 +205,8 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
203
205
|
slides: {
|
|
204
206
|
sli_VJYjJnJhg: freeTextSlide
|
|
205
207
|
},
|
|
206
|
-
token: '1234'
|
|
208
|
+
token: '1234',
|
|
209
|
+
corrections: {}
|
|
207
210
|
},
|
|
208
211
|
ui: {
|
|
209
212
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -302,7 +305,8 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
302
305
|
sli_VJYjJnJhg: freeTextSlide,
|
|
303
306
|
sli_VkSQroQnx: null
|
|
304
307
|
},
|
|
305
|
-
token: '1234'
|
|
308
|
+
token: '1234',
|
|
309
|
+
corrections: {}
|
|
306
310
|
},
|
|
307
311
|
ui: {
|
|
308
312
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -401,7 +405,8 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
401
405
|
sli_VJYjJnJhg: freeTextSlide,
|
|
402
406
|
sli_VkSQroQnx: null
|
|
403
407
|
},
|
|
404
|
-
token: '1234'
|
|
408
|
+
token: '1234',
|
|
409
|
+
corrections: {}
|
|
405
410
|
},
|
|
406
411
|
ui: {
|
|
407
412
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -458,7 +463,8 @@ test('should verify props when first slide was answered and next slide is fecthe
|
|
|
458
463
|
sli_VJYjJnJhg: freeTextSlide,
|
|
459
464
|
sli_VkSQroQnx: qcmGraphicSlide
|
|
460
465
|
},
|
|
461
|
-
token: '1234'
|
|
466
|
+
token: '1234',
|
|
467
|
+
corrections: {}
|
|
462
468
|
},
|
|
463
469
|
ui: {
|
|
464
470
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -559,7 +565,8 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
559
565
|
sli_VJYjJnJhg: freeTextSlide,
|
|
560
566
|
sli_VkSQroQnx: qcmGraphicSlide
|
|
561
567
|
},
|
|
562
|
-
token: '1234'
|
|
568
|
+
token: '1234',
|
|
569
|
+
corrections: {}
|
|
563
570
|
},
|
|
564
571
|
ui: {
|
|
565
572
|
currentSlideRef: 'sli_VkSQroQnx',
|
|
@@ -621,7 +628,8 @@ test('should verify props when progression is in success', function (t) {
|
|
|
621
628
|
_a[sliderSlide.universalRef] = sliderSlide,
|
|
622
629
|
_a[templateSlide.universalRef] = templateSlide,
|
|
623
630
|
_a),
|
|
624
|
-
token: '1234'
|
|
631
|
+
token: '1234',
|
|
632
|
+
corrections: {}
|
|
625
633
|
},
|
|
626
634
|
ui: {
|
|
627
635
|
currentSlideRef: templateSlide.universalRef,
|
|
@@ -683,7 +691,8 @@ test('should verify props when progression has answered a current pendingslide',
|
|
|
683
691
|
_a[sliderSlide.universalRef] = sliderSlide,
|
|
684
692
|
_a[templateSlide.universalRef] = templateSlide,
|
|
685
693
|
_a),
|
|
686
|
-
token: '1234'
|
|
694
|
+
token: '1234',
|
|
695
|
+
corrections: {}
|
|
687
696
|
},
|
|
688
697
|
ui: {
|
|
689
698
|
currentSlideRef: freeTextSlide.universalRef,
|
|
@@ -743,7 +752,8 @@ test('should verify props when progression has still pendingslide', function (t)
|
|
|
743
752
|
_a[sliderSlide.universalRef] = sliderSlide,
|
|
744
753
|
_a[templateSlide.universalRef] = templateSlide,
|
|
745
754
|
_a),
|
|
746
|
-
token: '1234'
|
|
755
|
+
token: '1234',
|
|
756
|
+
corrections: {}
|
|
747
757
|
},
|
|
748
758
|
ui: {
|
|
749
759
|
currentSlideRef: qcmSlide.universalRef,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { mapStateToSlidesProps } from '..';
|
|
6
|
+
import { services } from '../../../test/util/services.mock';
|
|
7
|
+
import { createTestStore } from '../../../actions/test/create-test-store';
|
|
8
|
+
import { EDIT_BASIC } from '../../../actions/ui/answers';
|
|
9
|
+
import { freeTextSlide } from './fixtures/free-text';
|
|
10
|
+
var progression = {
|
|
11
|
+
_id: '123456789123',
|
|
12
|
+
content: { type: 'skill', ref: '_skill-ref' },
|
|
13
|
+
engine: {
|
|
14
|
+
ref: 'review'
|
|
15
|
+
},
|
|
16
|
+
state: {
|
|
17
|
+
allAnswers: [],
|
|
18
|
+
isCorrect: true,
|
|
19
|
+
nextContent: {
|
|
20
|
+
ref: freeTextSlide._id,
|
|
21
|
+
type: 'slide'
|
|
22
|
+
},
|
|
23
|
+
pendingSlides: [],
|
|
24
|
+
slides: [],
|
|
25
|
+
step: {
|
|
26
|
+
current: 1
|
|
27
|
+
},
|
|
28
|
+
stars: 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var initialState = {
|
|
32
|
+
data: {
|
|
33
|
+
progression: progression,
|
|
34
|
+
slides: (_a = {},
|
|
35
|
+
_a[freeTextSlide._id] = freeTextSlide,
|
|
36
|
+
_a),
|
|
37
|
+
skills: [],
|
|
38
|
+
token: '1234',
|
|
39
|
+
corrections: {}
|
|
40
|
+
},
|
|
41
|
+
ui: {
|
|
42
|
+
currentSlideRef: freeTextSlide._id,
|
|
43
|
+
navigation: ['skills', 'slides'],
|
|
44
|
+
answers: [],
|
|
45
|
+
slide: {
|
|
46
|
+
validateButton: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
test('should dispatch EDIT_BASIC action via the property onChange of a Free Text slide', function (t) {
|
|
51
|
+
var _a;
|
|
52
|
+
t.plan(2);
|
|
53
|
+
var expectedActions = [
|
|
54
|
+
{
|
|
55
|
+
type: EDIT_BASIC,
|
|
56
|
+
payload: ['My Answer']
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
|
|
60
|
+
var props = mapStateToSlidesProps(getState(), dispatch);
|
|
61
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
62
|
+
hidden: false,
|
|
63
|
+
position: 0,
|
|
64
|
+
loading: false,
|
|
65
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
66
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
67
|
+
});
|
|
68
|
+
var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
|
|
69
|
+
var onChange = get('onChange', SlideProps);
|
|
70
|
+
onChange('My Answer');
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { mapStateToSlidesProps } from '..';
|
|
6
|
+
import { services } from '../../../test/util/services.mock';
|
|
7
|
+
import { createTestStore } from '../../../actions/test/create-test-store';
|
|
8
|
+
import { EDIT_QCM_DRAG } from '../../../actions/ui/answers';
|
|
9
|
+
import { qcmDragSlide } from './fixtures/qcm-drag';
|
|
10
|
+
var progression = {
|
|
11
|
+
_id: '123456789123',
|
|
12
|
+
content: { type: 'skill', ref: '_skill-ref' },
|
|
13
|
+
engine: {
|
|
14
|
+
ref: 'review'
|
|
15
|
+
},
|
|
16
|
+
state: {
|
|
17
|
+
allAnswers: [],
|
|
18
|
+
isCorrect: true,
|
|
19
|
+
nextContent: {
|
|
20
|
+
ref: qcmDragSlide._id,
|
|
21
|
+
type: 'slide'
|
|
22
|
+
},
|
|
23
|
+
pendingSlides: [],
|
|
24
|
+
slides: [],
|
|
25
|
+
step: {
|
|
26
|
+
current: 1
|
|
27
|
+
},
|
|
28
|
+
stars: 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var initialState = {
|
|
32
|
+
data: {
|
|
33
|
+
progression: progression,
|
|
34
|
+
slides: (_a = {},
|
|
35
|
+
_a[qcmDragSlide._id] = qcmDragSlide,
|
|
36
|
+
_a),
|
|
37
|
+
skills: [],
|
|
38
|
+
token: '1234',
|
|
39
|
+
corrections: {}
|
|
40
|
+
},
|
|
41
|
+
ui: {
|
|
42
|
+
currentSlideRef: qcmDragSlide._id,
|
|
43
|
+
navigation: ['skills', 'slides'],
|
|
44
|
+
answers: [],
|
|
45
|
+
slide: {
|
|
46
|
+
validateButton: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Drag slide', function (t) {
|
|
51
|
+
var _a;
|
|
52
|
+
t.plan(2);
|
|
53
|
+
var expectedActions = [
|
|
54
|
+
{
|
|
55
|
+
type: EDIT_QCM_DRAG,
|
|
56
|
+
payload: ['La démoralisation']
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
|
|
60
|
+
var props = mapStateToSlidesProps(getState(), dispatch);
|
|
61
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
62
|
+
hidden: false,
|
|
63
|
+
position: 0,
|
|
64
|
+
loading: false,
|
|
65
|
+
parentContentTitle: 'From "Using redux" chapter',
|
|
66
|
+
questionText: "Remettez dans l'ordre les quatre étapes du burn out."
|
|
67
|
+
});
|
|
68
|
+
var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
|
|
69
|
+
var onClick = get(['0', 'onClick'], SlideProps.answers);
|
|
70
|
+
onClick();
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { mapStateToSlidesProps } from '..';
|
|
6
|
+
import { services } from '../../../test/util/services.mock';
|
|
7
|
+
import { createTestStore } from '../../../actions/test/create-test-store';
|
|
8
|
+
import { EDIT_QCM_GRAPHIC } from '../../../actions/ui/answers';
|
|
9
|
+
import { qcmGraphicSlide } from './fixtures/qcm-graphic';
|
|
10
|
+
var progression = {
|
|
11
|
+
_id: '123456789123',
|
|
12
|
+
content: { type: 'skill', ref: '_skill-ref' },
|
|
13
|
+
engine: {
|
|
14
|
+
ref: 'review'
|
|
15
|
+
},
|
|
16
|
+
state: {
|
|
17
|
+
allAnswers: [],
|
|
18
|
+
isCorrect: true,
|
|
19
|
+
nextContent: {
|
|
20
|
+
ref: qcmGraphicSlide._id,
|
|
21
|
+
type: 'slide'
|
|
22
|
+
},
|
|
23
|
+
pendingSlides: [],
|
|
24
|
+
slides: [],
|
|
25
|
+
step: {
|
|
26
|
+
current: 1
|
|
27
|
+
},
|
|
28
|
+
stars: 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var initialState = {
|
|
32
|
+
data: {
|
|
33
|
+
progression: progression,
|
|
34
|
+
slides: (_a = {},
|
|
35
|
+
_a[qcmGraphicSlide._id] = qcmGraphicSlide,
|
|
36
|
+
_a),
|
|
37
|
+
skills: [],
|
|
38
|
+
token: '1234',
|
|
39
|
+
corrections: {}
|
|
40
|
+
},
|
|
41
|
+
ui: {
|
|
42
|
+
currentSlideRef: qcmGraphicSlide._id,
|
|
43
|
+
navigation: ['skills', 'slides'],
|
|
44
|
+
answers: [],
|
|
45
|
+
slide: {
|
|
46
|
+
validateButton: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM Graphic slide', function (t) {
|
|
51
|
+
var _a;
|
|
52
|
+
t.plan(2);
|
|
53
|
+
var expectedActions = [
|
|
54
|
+
{
|
|
55
|
+
type: EDIT_QCM_GRAPHIC,
|
|
56
|
+
payload: ['Faux']
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
|
|
60
|
+
var props = mapStateToSlidesProps(getState(), dispatch);
|
|
61
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
62
|
+
hidden: false,
|
|
63
|
+
position: 0,
|
|
64
|
+
loading: false,
|
|
65
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
66
|
+
questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
|
|
67
|
+
});
|
|
68
|
+
var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
|
|
69
|
+
var onClick = get(['1', 'onClick'], SlideProps.answers);
|
|
70
|
+
onClick();
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|