@coorpacademy/player-web 4.2.10 → 4.2.11
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/package.json +3 -4
- package/es/map-state-to-props/test/answer.js +0 -390
- package/es/map-state-to-props/test/answer.js.map +0 -1
- package/es/map-state-to-props/test/fixtures/player/clue.json +0 -131
- package/es/map-state-to-props/test/fixtures/player/loading-clue.json +0 -131
- package/es/map-state-to-props/test/fixtures/player/no-clue.json +0 -118
- package/es/map-state-to-props/test/fixtures/player/slide-no-lessons.json +0 -115
- package/es/map-state-to-props/test/fixtures/player/slide.json +0 -127
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-extra-life.json +0 -139
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-failure.json +0 -145
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-next-level.json +0 -282
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-revival.json +0 -140
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-success-node.json +0 -154
- package/es/map-state-to-props/test/fixtures/popin-correction/popin-success.json +0 -268
- package/es/map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers.json +0 -473
- package/es/map-state-to-props/test/fixtures/popin-end/fail.json +0 -205
- package/es/map-state-to-props/test/fixtures/popin-end/learner-adaptive-failure.json +0 -209
- package/es/map-state-to-props/test/fixtures/popin-end/learner-failure-with-redirection.json +0 -211
- package/es/map-state-to-props/test/fixtures/popin-end/learner-failure.json +0 -211
- package/es/map-state-to-props/test/fixtures/popin-end/learner-success-with-redirection.json +0 -278
- package/es/map-state-to-props/test/fixtures/popin-end/learner-success.json +0 -275
- package/es/map-state-to-props/test/fixtures/popin-end/success.json +0 -223
- package/es/map-state-to-props/test/fixtures/progression-learner.json +0 -102
- package/es/map-state-to-props/test/fixtures/progression-state.json +0 -45
- package/es/map-state-to-props/test/fixtures/slides/basic.json +0 -60
- package/es/map-state-to-props/test/fixtures/slides/plop.json +0 -56
- package/es/map-state-to-props/test/fixtures/slides/qcm-drag.json +0 -56
- package/es/map-state-to-props/test/fixtures/slides/qcm-graphic.json +0 -49
- package/es/map-state-to-props/test/fixtures/slides/qcm.json +0 -43
- package/es/map-state-to-props/test/fixtures/slides/slider.json +0 -57
- package/es/map-state-to-props/test/fixtures/slides/template.json +0 -49
- package/es/map-state-to-props/test/fixtures/slides/videos.json +0 -163
- package/es/map-state-to-props/test/fixtures/slides/with-context.json +0 -69
- package/es/map-state-to-props/test/header.js +0 -131
- package/es/map-state-to-props/test/header.js.map +0 -1
- package/es/map-state-to-props/test/index.js +0 -107
- package/es/map-state-to-props/test/index.js.map +0 -1
- package/es/map-state-to-props/test/player.js +0 -680
- package/es/map-state-to-props/test/player.js.map +0 -1
- package/es/map-state-to-props/test/popin-correction.create-header-cta.js +0 -301
- package/es/map-state-to-props/test/popin-correction.create-header-cta.js.map +0 -1
- package/es/map-state-to-props/test/popin-correction.js +0 -80
- package/es/map-state-to-props/test/popin-correction.js.map +0 -1
- package/es/map-state-to-props/test/popin-end.js +0 -313
- package/es/map-state-to-props/test/popin-end.js.map +0 -1
- package/es/map-state-to-props/test/popin-error.js +0 -77
- package/es/map-state-to-props/test/popin-error.js.map +0 -1
- package/es/map-state-to-props/test/resources.js +0 -31
- package/es/map-state-to-props/test/resources.js.map +0 -1
- package/es/test/add-timeout.js +0 -8
- package/es/test/add-timeout.js.map +0 -1
- package/es/test/helpers/css-register.js +0 -3
- package/es/test/helpers/css-register.js.map +0 -1
- package/es/test/helpers/macro.js +0 -6
- package/es/test/helpers/macro.js.map +0 -1
- package/es/test/index.js +0 -39
- package/es/test/index.js.map +0 -1
- package/es/test/init-reducers.js +0 -50
- package/es/test/init-reducers.js.map +0 -1
- package/es/test/locales.js +0 -8
- package/es/test/locales.js.map +0 -1
- package/es/test/run-app.js +0 -20
- package/es/test/run-app.js.map +0 -1
- package/es/test/store.js +0 -38
- package/es/test/store.js.map +0 -1
- package/es/views/test/helpers/render.js +0 -13
- package/es/views/test/helpers/render.js.map +0 -1
- package/es/views/test/helpers/state-to-vnode.js +0 -7
- package/es/views/test/helpers/state-to-vnode.js.map +0 -1
- package/es/views/test/loading.js +0 -15
- package/es/views/test/loading.js.map +0 -1
- package/es/views/test/popin-correction.js +0 -223
- package/es/views/test/popin-correction.js.map +0 -1
- package/es/views/test/popin-end.js +0 -93
- package/es/views/test/popin-end.js.map +0 -1
- package/es/views/test/router.js +0 -22
- package/es/views/test/router.js.map +0 -1
- package/es/views/test/slide.js +0 -335
- package/es/views/test/slide.js.map +0 -1
- package/lib/map-state-to-props/test/answer.js +0 -408
- package/lib/map-state-to-props/test/answer.js.map +0 -1
- package/lib/map-state-to-props/test/fixtures/player/clue.json +0 -131
- package/lib/map-state-to-props/test/fixtures/player/loading-clue.json +0 -131
- package/lib/map-state-to-props/test/fixtures/player/no-clue.json +0 -118
- package/lib/map-state-to-props/test/fixtures/player/slide-no-lessons.json +0 -115
- package/lib/map-state-to-props/test/fixtures/player/slide.json +0 -127
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-extra-life.json +0 -139
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-failure.json +0 -145
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-next-level.json +0 -282
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-revival.json +0 -140
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-success-node.json +0 -154
- package/lib/map-state-to-props/test/fixtures/popin-correction/popin-success.json +0 -268
- package/lib/map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers.json +0 -473
- package/lib/map-state-to-props/test/fixtures/popin-end/fail.json +0 -205
- package/lib/map-state-to-props/test/fixtures/popin-end/learner-adaptive-failure.json +0 -209
- package/lib/map-state-to-props/test/fixtures/popin-end/learner-failure-with-redirection.json +0 -211
- package/lib/map-state-to-props/test/fixtures/popin-end/learner-failure.json +0 -211
- package/lib/map-state-to-props/test/fixtures/popin-end/learner-success-with-redirection.json +0 -278
- package/lib/map-state-to-props/test/fixtures/popin-end/learner-success.json +0 -275
- package/lib/map-state-to-props/test/fixtures/popin-end/success.json +0 -223
- package/lib/map-state-to-props/test/fixtures/progression-learner.json +0 -102
- package/lib/map-state-to-props/test/fixtures/progression-state.json +0 -45
- package/lib/map-state-to-props/test/fixtures/slides/basic.json +0 -60
- package/lib/map-state-to-props/test/fixtures/slides/plop.json +0 -56
- package/lib/map-state-to-props/test/fixtures/slides/qcm-drag.json +0 -56
- package/lib/map-state-to-props/test/fixtures/slides/qcm-graphic.json +0 -49
- package/lib/map-state-to-props/test/fixtures/slides/qcm.json +0 -43
- package/lib/map-state-to-props/test/fixtures/slides/slider.json +0 -57
- package/lib/map-state-to-props/test/fixtures/slides/template.json +0 -49
- package/lib/map-state-to-props/test/fixtures/slides/videos.json +0 -163
- package/lib/map-state-to-props/test/fixtures/slides/with-context.json +0 -69
- package/lib/map-state-to-props/test/header.js +0 -143
- package/lib/map-state-to-props/test/header.js.map +0 -1
- package/lib/map-state-to-props/test/index.js +0 -100
- package/lib/map-state-to-props/test/index.js.map +0 -1
- package/lib/map-state-to-props/test/player.js +0 -714
- package/lib/map-state-to-props/test/player.js.map +0 -1
- package/lib/map-state-to-props/test/popin-correction.create-header-cta.js +0 -315
- package/lib/map-state-to-props/test/popin-correction.create-header-cta.js.map +0 -1
- package/lib/map-state-to-props/test/popin-correction.js +0 -85
- package/lib/map-state-to-props/test/popin-correction.js.map +0 -1
- package/lib/map-state-to-props/test/popin-end.js +0 -328
- package/lib/map-state-to-props/test/popin-end.js.map +0 -1
- package/lib/map-state-to-props/test/popin-error.js +0 -85
- package/lib/map-state-to-props/test/popin-error.js.map +0 -1
- package/lib/map-state-to-props/test/resources.js +0 -42
- package/lib/map-state-to-props/test/resources.js.map +0 -1
- package/lib/test/add-timeout.js +0 -14
- package/lib/test/add-timeout.js.map +0 -1
- package/lib/test/helpers/css-register.js +0 -8
- package/lib/test/helpers/css-register.js.map +0 -1
- package/lib/test/helpers/macro.js +0 -12
- package/lib/test/helpers/macro.js.map +0 -1
- package/lib/test/index.js +0 -53
- package/lib/test/index.js.map +0 -1
- package/lib/test/init-reducers.js +0 -57
- package/lib/test/init-reducers.js.map +0 -1
- package/lib/test/locales.js +0 -18
- package/lib/test/locales.js.map +0 -1
- package/lib/test/run-app.js +0 -27
- package/lib/test/run-app.js.map +0 -1
- package/lib/test/store.js +0 -45
- package/lib/test/store.js.map +0 -1
- package/lib/views/test/helpers/render.js +0 -24
- package/lib/views/test/helpers/render.js.map +0 -1
- package/lib/views/test/helpers/state-to-vnode.js +0 -14
- package/lib/views/test/helpers/state-to-vnode.js.map +0 -1
- package/lib/views/test/loading.js +0 -22
- package/lib/views/test/loading.js.map +0 -1
- package/lib/views/test/popin-correction.js +0 -237
- package/lib/views/test/popin-correction.js.map +0 -1
- package/lib/views/test/popin-end.js +0 -105
- package/lib/views/test/popin-end.js.map +0 -1
- package/lib/views/test/router.js +0 -32
- package/lib/views/test/router.js.map +0 -1
- package/lib/views/test/slide.js +0 -359
- package/lib/views/test/slide.js.map +0 -1
|
@@ -1,714 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.store = exports.options = exports.data = void 0;
|
|
5
|
-
|
|
6
|
-
var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
|
|
7
|
-
|
|
8
|
-
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
9
|
-
|
|
10
|
-
var _isFunction2 = _interopRequireDefault(require("lodash/fp/isFunction"));
|
|
11
|
-
|
|
12
|
-
var _fromPairs2 = _interopRequireDefault(require("lodash/fp/fromPairs"));
|
|
13
|
-
|
|
14
|
-
var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
|
|
15
|
-
|
|
16
|
-
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
17
|
-
|
|
18
|
-
var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
19
|
-
|
|
20
|
-
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
21
|
-
|
|
22
|
-
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
|
|
23
|
-
|
|
24
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
25
|
-
|
|
26
|
-
var _translate = require("@coorpacademy/translate");
|
|
27
|
-
|
|
28
|
-
var _playerServices = require("@coorpacademy/player-services");
|
|
29
|
-
|
|
30
|
-
var _playerStore = require("@coorpacademy/player-store");
|
|
31
|
-
|
|
32
|
-
var _player = _interopRequireDefault(require("../player"));
|
|
33
|
-
|
|
34
|
-
var _header = _interopRequireDefault(require("../header"));
|
|
35
|
-
|
|
36
|
-
var fixtures = _interopRequireWildcard(require("../../../sandbox/fixtures"));
|
|
37
|
-
|
|
38
|
-
var _progressionLearner = _interopRequireDefault(require("./fixtures/progression-learner"));
|
|
39
|
-
|
|
40
|
-
var _plop = _interopRequireDefault(require("./fixtures/slides/plop"));
|
|
41
|
-
|
|
42
|
-
var _basic = _interopRequireDefault(require("./fixtures/slides/basic"));
|
|
43
|
-
|
|
44
|
-
var _withContext = _interopRequireDefault(require("./fixtures/slides/with-context"));
|
|
45
|
-
|
|
46
|
-
var _template = _interopRequireDefault(require("./fixtures/slides/template"));
|
|
47
|
-
|
|
48
|
-
var _qcm = _interopRequireDefault(require("./fixtures/slides/qcm"));
|
|
49
|
-
|
|
50
|
-
var _qcmDrag = _interopRequireDefault(require("./fixtures/slides/qcm-drag"));
|
|
51
|
-
|
|
52
|
-
var _qcmGraphic = _interopRequireDefault(require("./fixtures/slides/qcm-graphic"));
|
|
53
|
-
|
|
54
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
55
|
-
|
|
56
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
57
|
-
|
|
58
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
|
-
|
|
60
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
61
|
-
|
|
62
|
-
const services = {
|
|
63
|
-
Analytics: _playerServices.Analytics,
|
|
64
|
-
Answers: (0, _playerServices.Answers)(fixtures),
|
|
65
|
-
Clues: (0, _playerServices.Clues)(fixtures),
|
|
66
|
-
Coach: _playerServices.Coach,
|
|
67
|
-
Comments: _playerServices.Comments,
|
|
68
|
-
Content: (0, _playerServices.Content)(fixtures),
|
|
69
|
-
ExitNodes: (0, _playerServices.ExitNodes)(fixtures),
|
|
70
|
-
LeaderBoard: _playerServices.LeaderBoard,
|
|
71
|
-
Location: _playerServices.Location,
|
|
72
|
-
Logger: console,
|
|
73
|
-
Progressions: (0, _playerServices.Progressions)(fixtures),
|
|
74
|
-
Recommendations: (0, _playerServices.Recommendations)(fixtures)
|
|
75
|
-
};
|
|
76
|
-
const options = {
|
|
77
|
-
translate: _translate.mockTranslate,
|
|
78
|
-
services
|
|
79
|
-
};
|
|
80
|
-
exports.options = options;
|
|
81
|
-
const store = {
|
|
82
|
-
dispatch: _identity2.default
|
|
83
|
-
};
|
|
84
|
-
exports.store = store;
|
|
85
|
-
const createPlayerProps = (0, _player.default)(options, store);
|
|
86
|
-
const createHeaderProps = (0, _header.default)(options, store);
|
|
87
|
-
const availableSlides = (0, _pipe2.default)((0, _map2.default)(slide => [slide._id, slide]), _fromPairs2.default)([_basic.default, _plop.default, _qcm.default, _qcmDrag.default, _qcmGraphic.default, _withContext.default]);
|
|
88
|
-
|
|
89
|
-
const createProgression = (slide, contentRef) => ({
|
|
90
|
-
engine: {
|
|
91
|
-
ref: 'microlearning',
|
|
92
|
-
version: '1'
|
|
93
|
-
},
|
|
94
|
-
content: {
|
|
95
|
-
ref: contentRef,
|
|
96
|
-
type: 'chapter'
|
|
97
|
-
},
|
|
98
|
-
state: {
|
|
99
|
-
nextContent: {
|
|
100
|
-
ref: slide._id,
|
|
101
|
-
type: 'slide'
|
|
102
|
-
},
|
|
103
|
-
lives: 1,
|
|
104
|
-
livesDisabled: false,
|
|
105
|
-
step: {
|
|
106
|
-
current: 1
|
|
107
|
-
},
|
|
108
|
-
viewedResources: []
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const data = {
|
|
113
|
-
contents: {
|
|
114
|
-
chapter: {
|
|
115
|
-
entities: {
|
|
116
|
-
nonAdaptiveContent: {
|
|
117
|
-
_id: 'nonAdaptiveContent',
|
|
118
|
-
isConditional: false
|
|
119
|
-
},
|
|
120
|
-
adaptiveContent: {
|
|
121
|
-
_id: 'adaptiveContent',
|
|
122
|
-
isConditional: true
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
slide: {
|
|
127
|
-
entities: availableSlides
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
progressions: {
|
|
131
|
-
entities: {
|
|
132
|
-
basic: createProgression(_basic.default, 'nonAdaptiveContent'),
|
|
133
|
-
plop: createProgression(_plop.default, 'nonAdaptiveContent'),
|
|
134
|
-
qcm: createProgression(_qcm.default, 'nonAdaptiveContent'),
|
|
135
|
-
qcmDrag: createProgression(_qcmDrag.default, 'nonAdaptiveContent'),
|
|
136
|
-
qcmGraphic: createProgression(_qcmGraphic.default, 'nonAdaptiveContent'),
|
|
137
|
-
template: createProgression(_template.default, 'nonAdaptiveContent'),
|
|
138
|
-
context: createProgression(_withContext.default, 'nonAdaptiveContent'),
|
|
139
|
-
adaptiveBasic: createProgression(_basic.default, 'adaptiveContent'),
|
|
140
|
-
adaptiveQcm: createProgression(_qcm.default, 'adaptiveContent'),
|
|
141
|
-
adaptiveQcmDrag: createProgression(_qcmDrag.default, 'adaptiveContent'),
|
|
142
|
-
adaptiveQcmGraphic: createProgression(_qcmGraphic.default, 'adaptiveContent'),
|
|
143
|
-
adaptiveContext: createProgression(_withContext.default, 'adaptiveContent'),
|
|
144
|
-
adaptiveTemplate: createProgression(_template.default, 'adaptiveContent')
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
exports.data = data;
|
|
149
|
-
|
|
150
|
-
const isDisabledFor = (slide, isConditional, answer) => {
|
|
151
|
-
const progressionId = 'progression';
|
|
152
|
-
const chapterId = 'chapter';
|
|
153
|
-
return createPlayerProps({
|
|
154
|
-
data: {
|
|
155
|
-
contents: {
|
|
156
|
-
slide: {
|
|
157
|
-
entities: {
|
|
158
|
-
[slide._id]: _extends({}, slide, {
|
|
159
|
-
chapter_id: chapterId
|
|
160
|
-
})
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
chapter: {
|
|
164
|
-
entities: {
|
|
165
|
-
[chapterId]: {
|
|
166
|
-
_id: chapterId,
|
|
167
|
-
isConditional
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
progressions: {
|
|
173
|
-
entities: {
|
|
174
|
-
[progressionId]: createProgression(slide, chapterId)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
ui: {
|
|
179
|
-
route: {
|
|
180
|
-
[progressionId]: 'answer'
|
|
181
|
-
},
|
|
182
|
-
current: {
|
|
183
|
-
progressionId
|
|
184
|
-
},
|
|
185
|
-
answers: {
|
|
186
|
-
[progressionId]: {
|
|
187
|
-
value: answer
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}).cta.disabled;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
(0, _ava.default)('should create player props for basic question and show coaches', t => {
|
|
195
|
-
const state = {
|
|
196
|
-
data,
|
|
197
|
-
ui: {
|
|
198
|
-
route: {
|
|
199
|
-
basic: 'answer'
|
|
200
|
-
},
|
|
201
|
-
current: {
|
|
202
|
-
progressionId: 'basic'
|
|
203
|
-
},
|
|
204
|
-
coaches: {
|
|
205
|
-
availableCoaches: 1
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
const props = createPlayerProps(state);
|
|
210
|
-
const headerProps = createHeaderProps(state);
|
|
211
|
-
t.deepEqual(props.answerType.media, {
|
|
212
|
-
_id: '593eb72a187bd18c01283592',
|
|
213
|
-
mimeType: 'image/jpeg',
|
|
214
|
-
type: 'img',
|
|
215
|
-
url: '//static.coorpacademy.com/content/ijoinchanel/en/slides/1B2_Q6/1B2-Q6-canap-v1.jpg'
|
|
216
|
-
});
|
|
217
|
-
t.is(props.typeClue, 'answer');
|
|
218
|
-
t.is(props.question, "Écrivez le mot Text dans l'input.\n");
|
|
219
|
-
t.is(props.answerType.model.type, 'freeText');
|
|
220
|
-
t.true((0, _isFunction2.default)(props.answerType.model.onChange));
|
|
221
|
-
t.is(props.slideContext, undefined);
|
|
222
|
-
t.is(props.cta.submitValue, '__Validate');
|
|
223
|
-
t.true(props.cta.disabled);
|
|
224
|
-
t.is(props.buttons.length, 4);
|
|
225
|
-
t.is(props.buttons[3].title, '__Coach');
|
|
226
|
-
t.is(props.buttons[3].type, 'coach');
|
|
227
|
-
t.deepEqual((0, _omit2.default)('content.onClick', props.header), (0, _omit2.default)('content.onClick', headerProps));
|
|
228
|
-
t.true((0, _isFunction2.default)(props.header.content.onClick));
|
|
229
|
-
});
|
|
230
|
-
(0, _ava.default)('should enable the validate button when there is an answer', t => {
|
|
231
|
-
t.true(isDisabledFor(_basic.default, false, []));
|
|
232
|
-
t.false(isDisabledFor(_basic.default, false, ['foo']));
|
|
233
|
-
});
|
|
234
|
-
(0, _ava.default)('should enable the validate button when there are two answers in an non-adaptive content for all questions', t => {
|
|
235
|
-
const answers = ['foo', 'bar'];
|
|
236
|
-
t.false(isDisabledFor(_basic.default, false, answers));
|
|
237
|
-
t.false(isDisabledFor(_qcm.default, false, answers));
|
|
238
|
-
t.false(isDisabledFor(_qcmGraphic.default, false, answers));
|
|
239
|
-
t.false(isDisabledFor(_qcmDrag.default, false, answers));
|
|
240
|
-
t.false(isDisabledFor(_withContext.default, false, answers));
|
|
241
|
-
t.false(isDisabledFor(_template.default, false, answers));
|
|
242
|
-
});
|
|
243
|
-
(0, _ava.default)('should disable the validate button when there are several answers in an adaptive content for qcm questions', t => {
|
|
244
|
-
t.false(isDisabledFor(_basic.default, true, ['foo', 'bar']));
|
|
245
|
-
t.true(isDisabledFor(_qcm.default, true, ['foo', 'bar']));
|
|
246
|
-
t.true(isDisabledFor(_qcmGraphic.default, true, ['foo', 'bar']));
|
|
247
|
-
t.false(isDisabledFor(_qcmDrag.default, true, ['foo', 'bar']));
|
|
248
|
-
t.false(isDisabledFor(_withContext.default, true, ['foo', 'bar']));
|
|
249
|
-
t.false(isDisabledFor(_template.default, true, ['foo', 'bar']));
|
|
250
|
-
t.false(isDisabledFor(_basic.default, true, ['foo', 'bar', 'baz']));
|
|
251
|
-
t.true(isDisabledFor(_qcm.default, true, ['foo', 'bar', 'baz']));
|
|
252
|
-
t.true(isDisabledFor(_qcmGraphic.default, true, ['foo', 'bar', 'baz']));
|
|
253
|
-
t.false(isDisabledFor(_qcmDrag.default, true, ['foo', 'bar', 'baz']));
|
|
254
|
-
t.false(isDisabledFor(_withContext.default, true, ['foo', 'bar', 'baz']));
|
|
255
|
-
t.false(isDisabledFor(_template.default, true, ['foo', 'bar', 'baz']));
|
|
256
|
-
});
|
|
257
|
-
(0, _ava.default)('should disable the validate button when there the text answer has been deleted', t => {
|
|
258
|
-
const state = {
|
|
259
|
-
data,
|
|
260
|
-
ui: {
|
|
261
|
-
route: {
|
|
262
|
-
basic: 'answer'
|
|
263
|
-
},
|
|
264
|
-
current: {
|
|
265
|
-
progressionId: 'basic'
|
|
266
|
-
},
|
|
267
|
-
answers: {
|
|
268
|
-
basic: {
|
|
269
|
-
value: ['']
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
const props = createPlayerProps(state);
|
|
275
|
-
t.true(props.cta.disabled);
|
|
276
|
-
});
|
|
277
|
-
(0, _ava.default)('should return defaut props when slide.question.type is not handles', t => {
|
|
278
|
-
const state = {
|
|
279
|
-
data,
|
|
280
|
-
ui: {
|
|
281
|
-
route: {
|
|
282
|
-
basic: 'answer'
|
|
283
|
-
},
|
|
284
|
-
current: {
|
|
285
|
-
progressionId: 'plop'
|
|
286
|
-
},
|
|
287
|
-
answers: {
|
|
288
|
-
basic: {
|
|
289
|
-
value: ['']
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
t.throws(() => createPlayerProps(state), {
|
|
295
|
-
message: 'plop is not an handled question.type'
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
(0, _ava.default)('should disable the validate button when no answer is provided', t => {
|
|
299
|
-
const state = {
|
|
300
|
-
data,
|
|
301
|
-
ui: {
|
|
302
|
-
route: {
|
|
303
|
-
basic: 'answer'
|
|
304
|
-
},
|
|
305
|
-
current: {
|
|
306
|
-
progressionId: 'basic'
|
|
307
|
-
},
|
|
308
|
-
answers: {}
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
const props = createPlayerProps(state);
|
|
312
|
-
t.true(props.cta.disabled);
|
|
313
|
-
});
|
|
314
|
-
(0, _ava.default)('should disable the validate button when a previous selected answer has been unselected', t => {
|
|
315
|
-
const state = {
|
|
316
|
-
data,
|
|
317
|
-
ui: {
|
|
318
|
-
route: {
|
|
319
|
-
basic: 'answer'
|
|
320
|
-
},
|
|
321
|
-
current: {
|
|
322
|
-
progressionId: 'basic'
|
|
323
|
-
},
|
|
324
|
-
answers: {
|
|
325
|
-
basic: {
|
|
326
|
-
value: []
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const props = createPlayerProps(state);
|
|
332
|
-
t.true(props.cta.disabled);
|
|
333
|
-
});
|
|
334
|
-
(0, _ava.default)('should disable the validate button when some answer fields are empty', t => {
|
|
335
|
-
const state = {
|
|
336
|
-
data,
|
|
337
|
-
ui: {
|
|
338
|
-
route: {
|
|
339
|
-
template: 'answer'
|
|
340
|
-
},
|
|
341
|
-
current: {
|
|
342
|
-
progressionId: 'template'
|
|
343
|
-
},
|
|
344
|
-
answers: {
|
|
345
|
-
template: {
|
|
346
|
-
value: ['', 'Test']
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
const props = createPlayerProps(state);
|
|
352
|
-
t.true(props.cta.disabled);
|
|
353
|
-
});
|
|
354
|
-
(0, _ava.default)('should disable the validate button when no answer has been selected by user on template question', t => {
|
|
355
|
-
const state = {
|
|
356
|
-
data,
|
|
357
|
-
ui: {
|
|
358
|
-
route: {
|
|
359
|
-
template: 'answer'
|
|
360
|
-
},
|
|
361
|
-
current: {
|
|
362
|
-
progressionId: 'template'
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
const props = createPlayerProps(state);
|
|
367
|
-
t.true(props.cta.disabled);
|
|
368
|
-
});
|
|
369
|
-
(0, _ava.default)('should display context tab button if slide context is available', t => {
|
|
370
|
-
t.plan(10);
|
|
371
|
-
const state = {
|
|
372
|
-
data,
|
|
373
|
-
ui: {
|
|
374
|
-
route: {
|
|
375
|
-
context: 'answer'
|
|
376
|
-
},
|
|
377
|
-
current: {
|
|
378
|
-
progressionId: 'context'
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
const dispatch = action => {
|
|
384
|
-
t.deepEqual(action, {
|
|
385
|
-
type: _playerStore.UI_SELECT_ROUTE,
|
|
386
|
-
payload: 'context',
|
|
387
|
-
meta: {
|
|
388
|
-
progressionId: 'context'
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
const props = (0, _player.default)(options, {
|
|
394
|
-
dispatch: action => action(dispatch, () => state)
|
|
395
|
-
})(state);
|
|
396
|
-
t.is(typeof props.slideContext, 'object');
|
|
397
|
-
t.is(props.slideContext.title, 'Some context title');
|
|
398
|
-
t.is(typeof props.slideContext.description, 'string');
|
|
399
|
-
t.is(props.slideContext.description, _withContext.default.context.description);
|
|
400
|
-
t.is(props.buttons.length, 5);
|
|
401
|
-
t.is(props.buttons[0].title, '__Context');
|
|
402
|
-
t.is(props.buttons[0].type, 'context');
|
|
403
|
-
t.false(props.buttons[0].selected);
|
|
404
|
-
t.is(typeof props.buttons[0].onClick, 'function');
|
|
405
|
-
props.buttons[0].onClick();
|
|
406
|
-
});
|
|
407
|
-
(0, _ava.default)('should display "Back to question" for the cta in the tabs', t => {
|
|
408
|
-
const state = {
|
|
409
|
-
data,
|
|
410
|
-
ui: {
|
|
411
|
-
current: {
|
|
412
|
-
progressionId: 'basic'
|
|
413
|
-
},
|
|
414
|
-
route: {
|
|
415
|
-
basic: 'media'
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
const props = createPlayerProps(state);
|
|
420
|
-
t.is(props.cta.submitValue, '__Back to question');
|
|
421
|
-
state.ui.route.foo = 'clue';
|
|
422
|
-
t.is(typeof props.onClickSeeClue, 'function');
|
|
423
|
-
props.onClickSeeClue();
|
|
424
|
-
t.is(props.cta.submitValue, '__Back to question');
|
|
425
|
-
});
|
|
426
|
-
(0, _ava.default)('should display "Go to question" for the context tab cta', t => {
|
|
427
|
-
const state = {
|
|
428
|
-
data,
|
|
429
|
-
ui: {
|
|
430
|
-
current: {
|
|
431
|
-
progressionId: 'basic'
|
|
432
|
-
},
|
|
433
|
-
route: {
|
|
434
|
-
basic: 'context'
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
const props = createPlayerProps(state);
|
|
439
|
-
t.is(props.cta.submitValue, '__Go to question');
|
|
440
|
-
});
|
|
441
|
-
(0, _ava.default)('should display new media notification when user has not seen any media for the current slide', t => {
|
|
442
|
-
const progression = createProgression(_basic.default);
|
|
443
|
-
progression.state.viewedResources = [{
|
|
444
|
-
resources: ['1234']
|
|
445
|
-
}];
|
|
446
|
-
const state = {
|
|
447
|
-
data: {
|
|
448
|
-
contents: data.contents,
|
|
449
|
-
progressions: {
|
|
450
|
-
entities: {
|
|
451
|
-
basic: progression
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
ui: {
|
|
456
|
-
current: {
|
|
457
|
-
progressionId: 'basic'
|
|
458
|
-
},
|
|
459
|
-
route: {
|
|
460
|
-
basic: 'answer'
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
const props = createPlayerProps(state);
|
|
465
|
-
t.true(props.showNewMedia);
|
|
466
|
-
});
|
|
467
|
-
(0, _ava.default)('should display new media notification for the answer/undefined route when user has not seen any media', t => {
|
|
468
|
-
const state = {
|
|
469
|
-
data: {
|
|
470
|
-
contents: data.contents,
|
|
471
|
-
progressions: {
|
|
472
|
-
entities: {
|
|
473
|
-
basic: createProgression(_basic.default)
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
ui: {
|
|
478
|
-
current: {
|
|
479
|
-
progressionId: 'basic'
|
|
480
|
-
},
|
|
481
|
-
route: {}
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
[undefined].forEach(route => {
|
|
485
|
-
const props = createPlayerProps((0, _set2.default)('ui.route.basic', route, state));
|
|
486
|
-
t.true((0, _isEmpty2.default)(props));
|
|
487
|
-
});
|
|
488
|
-
['media', 'clue', 'context', 'answer'].forEach(route => {
|
|
489
|
-
const props = createPlayerProps((0, _set2.default)('ui.route.basic', route, state));
|
|
490
|
-
t.false((0, _isEmpty2.default)(props));
|
|
491
|
-
});
|
|
492
|
-
});
|
|
493
|
-
(0, _ava.default)('should not display new media notification for the other routes when user has not seen any media', t => {
|
|
494
|
-
const state = {
|
|
495
|
-
data: {
|
|
496
|
-
contents: data.contents,
|
|
497
|
-
progressions: {
|
|
498
|
-
entities: {
|
|
499
|
-
basic: createProgression(_basic.default)
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
ui: {
|
|
504
|
-
current: {
|
|
505
|
-
progressionId: 'basic'
|
|
506
|
-
},
|
|
507
|
-
route: {}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
['media', 'clue'].forEach(route => {
|
|
511
|
-
const props = createPlayerProps((0, _set2.default)('ui.route.basic', route, state));
|
|
512
|
-
t.false(props.showNewMedia);
|
|
513
|
-
});
|
|
514
|
-
});
|
|
515
|
-
(0, _ava.default)('should not display new media notification when user has seen at least one media of the current slide', t => {
|
|
516
|
-
const progression = createProgression(_basic.default);
|
|
517
|
-
progression.state.viewedResources = [{
|
|
518
|
-
type: 'chapter',
|
|
519
|
-
ref: _basic.default.chapter_id,
|
|
520
|
-
resources: [_basic.default.lessons[0].ref]
|
|
521
|
-
}];
|
|
522
|
-
const state = {
|
|
523
|
-
data: {
|
|
524
|
-
contents: data.contents,
|
|
525
|
-
progressions: {
|
|
526
|
-
entities: {
|
|
527
|
-
basic: progression
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
ui: {
|
|
532
|
-
current: {
|
|
533
|
-
progressionId: 'basic'
|
|
534
|
-
},
|
|
535
|
-
route: {
|
|
536
|
-
basic: 'answer'
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
const props = createPlayerProps(state);
|
|
541
|
-
t.false(props.showNewMedia);
|
|
542
|
-
});
|
|
543
|
-
(0, _ava.default)('should display review lesson notification when user has seen at least one media of the current slide', t => {
|
|
544
|
-
const progression = createProgression(_basic.default);
|
|
545
|
-
progression.state.viewedResources = [{
|
|
546
|
-
type: 'chapter',
|
|
547
|
-
ref: _basic.default.chapter_id,
|
|
548
|
-
resources: [_basic.default.lessons[0].ref]
|
|
549
|
-
}];
|
|
550
|
-
const state = {
|
|
551
|
-
data: {
|
|
552
|
-
contents: data.contents,
|
|
553
|
-
progressions: {
|
|
554
|
-
entities: {
|
|
555
|
-
basic: progression
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
},
|
|
559
|
-
ui: {
|
|
560
|
-
current: {
|
|
561
|
-
progressionId: 'basic'
|
|
562
|
-
},
|
|
563
|
-
route: {
|
|
564
|
-
basic: 'answer'
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
const props = createPlayerProps(state);
|
|
569
|
-
t.true(props.showReviewLesson);
|
|
570
|
-
});
|
|
571
|
-
(0, _ava.default)('should not display review lesson notification when user has not seen any media for the current slide', t => {
|
|
572
|
-
const progression = createProgression(_basic.default);
|
|
573
|
-
progression.state.viewedResources = [{
|
|
574
|
-
type: 'chapter',
|
|
575
|
-
ref: _basic.default.chapter_id,
|
|
576
|
-
resources: []
|
|
577
|
-
}];
|
|
578
|
-
const state = {
|
|
579
|
-
data: {
|
|
580
|
-
contents: data.contents,
|
|
581
|
-
progressions: {
|
|
582
|
-
entities: {
|
|
583
|
-
basic: progression
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
ui: {
|
|
588
|
-
current: {
|
|
589
|
-
progressionId: 'basic'
|
|
590
|
-
},
|
|
591
|
-
route: {
|
|
592
|
-
basic: 'answer'
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
const props = createPlayerProps(state);
|
|
597
|
-
t.false(props.showReviewLesson);
|
|
598
|
-
});
|
|
599
|
-
(0, _ava.default)('should feed step prop in non-adaptive mode', t => {
|
|
600
|
-
const state = (0, _set2.default)('data.contents.level.entities.1.info.nbSlides', 12, _progressionLearner.default);
|
|
601
|
-
const props = createPlayerProps(state);
|
|
602
|
-
t.deepEqual(props.step, {
|
|
603
|
-
current: 0,
|
|
604
|
-
total: 12
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
(0, _ava.default)('should not feed step prop in adaptive mode', t => {
|
|
608
|
-
const state = (0, _pipe2.default)((0, _set2.default)('data.contents.level.entities.1.info.nbSlides', 12), (0, _set2.default)('data.contents.chapter.entities.chapter2.isConditional', true))(_progressionLearner.default);
|
|
609
|
-
const props = createPlayerProps(state);
|
|
610
|
-
t.falsy(props.step);
|
|
611
|
-
});
|
|
612
|
-
(0, _ava.default)('should not send an id prop in resources', t => {
|
|
613
|
-
const props = createPlayerProps(_progressionLearner.default);
|
|
614
|
-
t.is((0, _get2.default)('resources.0.id', props), undefined);
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
const createLearnerProgression = (slide, contentRef) => ({
|
|
618
|
-
engine: {
|
|
619
|
-
ref: 'learner',
|
|
620
|
-
version: '1'
|
|
621
|
-
},
|
|
622
|
-
content: {
|
|
623
|
-
ref: contentRef,
|
|
624
|
-
type: 'level'
|
|
625
|
-
},
|
|
626
|
-
state: {
|
|
627
|
-
nextContent: {
|
|
628
|
-
ref: slide._id,
|
|
629
|
-
type: 'slide'
|
|
630
|
-
},
|
|
631
|
-
lives: 1,
|
|
632
|
-
livesDisabled: false,
|
|
633
|
-
step: {
|
|
634
|
-
current: 1
|
|
635
|
-
},
|
|
636
|
-
viewedResources: []
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
const check = (slide, answer) => {
|
|
641
|
-
const progressionId = 'progression';
|
|
642
|
-
const levelId = 'level';
|
|
643
|
-
const chapterId = 'chapter';
|
|
644
|
-
return createPlayerProps({
|
|
645
|
-
data: {
|
|
646
|
-
contents: {
|
|
647
|
-
slide: {
|
|
648
|
-
entities: {
|
|
649
|
-
[slide._id]: _extends({}, slide, {
|
|
650
|
-
chapter_id: chapterId
|
|
651
|
-
})
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
level: {
|
|
655
|
-
entities: {
|
|
656
|
-
[levelId]: {
|
|
657
|
-
ref: levelId,
|
|
658
|
-
chapterIds: [chapterId],
|
|
659
|
-
isConditional: true
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
},
|
|
663
|
-
chapter: {
|
|
664
|
-
entities: {
|
|
665
|
-
[chapterId]: {
|
|
666
|
-
_id: chapterId,
|
|
667
|
-
isConditional: false
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
},
|
|
672
|
-
progressions: {
|
|
673
|
-
entities: {
|
|
674
|
-
[progressionId]: createLearnerProgression(slide, levelId)
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
ui: {
|
|
679
|
-
route: {
|
|
680
|
-
[progressionId]: 'answer'
|
|
681
|
-
},
|
|
682
|
-
current: {
|
|
683
|
-
progressionId
|
|
684
|
-
},
|
|
685
|
-
answers: {
|
|
686
|
-
[progressionId]: {
|
|
687
|
-
value: answer
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}).cta.disabled;
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
(0, _ava.default)('should allow multi answers on adaptive level if the current chapter is not adaptive', t => {
|
|
695
|
-
t.true(check(_basic.default, []));
|
|
696
|
-
t.true(check(_qcm.default, []));
|
|
697
|
-
t.true(check(_qcmGraphic.default, []));
|
|
698
|
-
t.true(check(_qcmDrag.default, []));
|
|
699
|
-
t.true(check(_withContext.default, []));
|
|
700
|
-
t.true(check(_template.default, []));
|
|
701
|
-
t.false(check(_basic.default, ['foo']));
|
|
702
|
-
t.false(check(_qcm.default, ['foo']));
|
|
703
|
-
t.false(check(_qcmGraphic.default, ['foo']));
|
|
704
|
-
t.false(check(_qcmDrag.default, ['foo']));
|
|
705
|
-
t.false(check(_withContext.default, ['foo']));
|
|
706
|
-
t.false(check(_template.default, ['foo']));
|
|
707
|
-
t.false(check(_basic.default, ['foo', 'bar']));
|
|
708
|
-
t.false(check(_qcm.default, ['foo', 'bar']));
|
|
709
|
-
t.false(check(_qcmGraphic.default, ['foo', 'bar']));
|
|
710
|
-
t.false(check(_qcmDrag.default, ['foo', 'bar']));
|
|
711
|
-
t.false(check(_withContext.default, ['foo', 'bar']));
|
|
712
|
-
t.false(check(_template.default, ['foo', 'bar']));
|
|
713
|
-
});
|
|
714
|
-
//# sourceMappingURL=player.js.map
|