@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,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
4
|
-
|
|
5
|
-
var _store = require("../store");
|
|
6
|
-
|
|
7
|
-
var _macro = _interopRequireDefault(require("./helpers/macro"));
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
(0, _ava.default)('should have initial value', _macro.default, (0, _store.createReducers)(), undefined, {}, {
|
|
12
|
-
data: {
|
|
13
|
-
answers: {
|
|
14
|
-
entities: {}
|
|
15
|
-
},
|
|
16
|
-
comments: {
|
|
17
|
-
entities: {}
|
|
18
|
-
},
|
|
19
|
-
configs: {},
|
|
20
|
-
contents: {},
|
|
21
|
-
clues: {
|
|
22
|
-
entities: {}
|
|
23
|
-
},
|
|
24
|
-
exitNodes: {
|
|
25
|
-
entities: {}
|
|
26
|
-
},
|
|
27
|
-
progressions: {
|
|
28
|
-
entities: {}
|
|
29
|
-
},
|
|
30
|
-
rank: {},
|
|
31
|
-
nextContent: {
|
|
32
|
-
entities: {}
|
|
33
|
-
},
|
|
34
|
-
recommendations: {
|
|
35
|
-
entities: {}
|
|
36
|
-
},
|
|
37
|
-
videos: {
|
|
38
|
-
entities: {}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
ui: {
|
|
42
|
-
answers: {},
|
|
43
|
-
coaches: {
|
|
44
|
-
availableCoaches: 0
|
|
45
|
-
},
|
|
46
|
-
comments: {
|
|
47
|
-
text: null
|
|
48
|
-
},
|
|
49
|
-
corrections: {},
|
|
50
|
-
current: {
|
|
51
|
-
progressionId: null
|
|
52
|
-
},
|
|
53
|
-
location: {},
|
|
54
|
-
route: {}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=init-reducers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-reducers.js","names":["test","macro","createReducers","undefined","data","answers","entities","comments","configs","contents","clues","exitNodes","progressions","rank","nextContent","recommendations","videos","ui","coaches","availableCoaches","text","corrections","current","progressionId","location","route"],"sources":["../../src/test/init-reducers.js"],"sourcesContent":["import test from 'ava';\nimport {createReducers} from '../store';\nimport macro from './helpers/macro';\n\ntest(\n 'should have initial value',\n macro,\n createReducers(),\n undefined,\n {},\n {\n data: {\n answers: {entities: {}},\n comments: {entities: {}},\n configs: {},\n contents: {},\n clues: {entities: {}},\n exitNodes: {entities: {}},\n progressions: {entities: {}},\n rank: {},\n nextContent: {entities: {}},\n recommendations: {entities: {}},\n videos: {entities: {}}\n },\n ui: {\n answers: {},\n coaches: {\n availableCoaches: 0\n },\n comments: {\n text: null\n },\n corrections: {},\n current: {\n progressionId: null\n },\n location: {},\n route: {}\n }\n }\n);\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,IAAAA,YAAA,EACE,2BADF,EAEEC,cAFF,EAGE,IAAAC,qBAAA,GAHF,EAIEC,SAJF,EAKE,EALF,EAME;EACEC,IAAI,EAAE;IACJC,OAAO,EAAE;MAACC,QAAQ,EAAE;IAAX,CADL;IAEJC,QAAQ,EAAE;MAACD,QAAQ,EAAE;IAAX,CAFN;IAGJE,OAAO,EAAE,EAHL;IAIJC,QAAQ,EAAE,EAJN;IAKJC,KAAK,EAAE;MAACJ,QAAQ,EAAE;IAAX,CALH;IAMJK,SAAS,EAAE;MAACL,QAAQ,EAAE;IAAX,CANP;IAOJM,YAAY,EAAE;MAACN,QAAQ,EAAE;IAAX,CAPV;IAQJO,IAAI,EAAE,EARF;IASJC,WAAW,EAAE;MAACR,QAAQ,EAAE;IAAX,CATT;IAUJS,eAAe,EAAE;MAACT,QAAQ,EAAE;IAAX,CAVb;IAWJU,MAAM,EAAE;MAACV,QAAQ,EAAE;IAAX;EAXJ,CADR;EAcEW,EAAE,EAAE;IACFZ,OAAO,EAAE,EADP;IAEFa,OAAO,EAAE;MACPC,gBAAgB,EAAE;IADX,CAFP;IAKFZ,QAAQ,EAAE;MACRa,IAAI,EAAE;IADE,CALR;IAQFC,WAAW,EAAE,EARX;IASFC,OAAO,EAAE;MACPC,aAAa,EAAE;IADR,CATP;IAYFC,QAAQ,EAAE,EAZR;IAaFC,KAAK,EAAE;EAbL;AAdN,CANF"}
|
package/lib/test/locales.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
6
|
-
|
|
7
|
-
var _glob = _interopRequireDefault(require("glob"));
|
|
8
|
-
|
|
9
|
-
var _player = _interopRequireDefault(require("../../locales/en/player"));
|
|
10
|
-
|
|
11
|
-
var _locales = _interopRequireDefault(require("../../../../test/helpers/locales"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
const files = _glob.default.sync(_path.default.join(__dirname, '../**/*.js')).filter(file => !file.includes('/test/'));
|
|
16
|
-
|
|
17
|
-
(0, _ava.default)('All locale keys should be used, and used properly', _locales.default, __dirname, files, _player.default);
|
|
18
|
-
//# sourceMappingURL=locales.js.map
|
package/lib/test/locales.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","names":["files","glob","sync","path","join","__dirname","filter","file","includes","test","localesUseMacro","locales"],"sources":["../../src/test/locales.js"],"sourcesContent":["import path from 'path';\nimport test from 'ava';\nimport glob from 'glob';\nimport locales from '../../locales/en/player';\nimport localesUseMacro from '../../../../test/helpers/locales';\n\nconst files = glob\n .sync(path.join(__dirname, '../**/*.js'))\n .filter(file => !file.includes('/test/'));\n\ntest(\n 'All locale keys should be used, and used properly',\n localesUseMacro,\n __dirname,\n files,\n locales\n);\n"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,KAAK,GAAGC,aAAA,CACXC,IADW,CACNC,aAAA,CAAKC,IAAL,CAAUC,SAAV,EAAqB,YAArB,CADM,EAEXC,MAFW,CAEJC,IAAI,IAAI,CAACA,IAAI,CAACC,QAAL,CAAc,QAAd,CAFL,CAAd;;AAIA,IAAAC,YAAA,EACE,mDADF,EAEEC,gBAFF,EAGEL,SAHF,EAIEL,KAJF,EAKEW,eALF"}
|
package/lib/test/run-app.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isFunction2 = _interopRequireDefault(require("lodash/fp/isFunction"));
|
|
4
|
-
|
|
5
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
6
|
-
|
|
7
|
-
var _runApp = _interopRequireDefault(require("../run-app"));
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
(0, _ava.default)('it should run app', t => {
|
|
12
|
-
const options = {
|
|
13
|
-
progression: {
|
|
14
|
-
id: 'foo'
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
t.plan(3);
|
|
18
|
-
const store = {
|
|
19
|
-
dispatch: action => {
|
|
20
|
-
t.true((0, _isFunction2.default)(action));
|
|
21
|
-
return 'bar';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const app = (0, _runApp.default)(options, store);
|
|
25
|
-
t.is(app, 'bar');
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=run-app.js.map
|
package/lib/test/run-app.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-app.js","names":["test","t","options","progression","id","plan","store","dispatch","action","true","app","runApp","is"],"sources":["../../src/test/run-app.js"],"sourcesContent":["import test from 'ava';\nimport {isFunction} from 'lodash/fp';\nimport runApp from '../run-app';\n\ntest('it should run app', t => {\n const options = {\n progression: {\n id: 'foo'\n }\n };\n\n t.plan(3);\n const store = {\n dispatch: action => {\n t.true(isFunction(action));\n return 'bar';\n }\n };\n\n const app = runApp(options, store);\n t.is(app, 'bar');\n});\n"],"mappings":";;;;AAAA;;AAEA;;;;AAEA,IAAAA,YAAA,EAAK,mBAAL,EAA0BC,CAAC,IAAI;EAC7B,MAAMC,OAAO,GAAG;IACdC,WAAW,EAAE;MACXC,EAAE,EAAE;IADO;EADC,CAAhB;EAMAH,CAAC,CAACI,IAAF,CAAO,CAAP;EACA,MAAMC,KAAK,GAAG;IACZC,QAAQ,EAAEC,MAAM,IAAI;MAClBP,CAAC,CAACQ,IAAF,CAAO,0BAAWD,MAAX,CAAP;MACA,OAAO,KAAP;IACD;EAJW,CAAd;EAOA,MAAME,GAAG,GAAG,IAAAC,eAAA,EAAOT,OAAP,EAAgBI,KAAhB,CAAZ;EACAL,CAAC,CAACW,EAAF,CAAKF,GAAL,EAAU,KAAV;AACD,CAjBD"}
|
package/lib/test/store.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
4
|
-
|
|
5
|
-
var _redux = require("redux");
|
|
6
|
-
|
|
7
|
-
var _store = require("../store");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
const appOptions = {
|
|
12
|
-
services: {
|
|
13
|
-
error: () => {
|
|
14
|
-
throw new Error('error logger should not have been called');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
(0, _ava.default)('should apply redux-thunk', async t => {
|
|
19
|
-
t.plan(5);
|
|
20
|
-
const store = (0, _redux.createStore)(state => {
|
|
21
|
-
t.pass();
|
|
22
|
-
return state;
|
|
23
|
-
}, 'state', (0, _store.createMiddlewares)(appOptions));
|
|
24
|
-
await store.dispatch({
|
|
25
|
-
type: 1
|
|
26
|
-
});
|
|
27
|
-
return store.dispatch((dispatch, getState, options) => {
|
|
28
|
-
t.is(options, appOptions);
|
|
29
|
-
t.is(getState(), 'state');
|
|
30
|
-
return dispatch({
|
|
31
|
-
type: 2
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
(0, _ava.default)('should enable devtools', t => {
|
|
36
|
-
t.plan(1);
|
|
37
|
-
global.window = {
|
|
38
|
-
__REDUX_DEVTOOLS_EXTENSION__: () => {
|
|
39
|
-
t.pass();
|
|
40
|
-
return f => f;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
(0, _redux.createStore)(state => state, 'state', (0, _store.createMiddlewares)(appOptions));
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=store.js.map
|
package/lib/test/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["appOptions","services","error","Error","test","t","plan","store","createStore","state","pass","createMiddlewares","dispatch","type","getState","options","is","global","window","__REDUX_DEVTOOLS_EXTENSION__","f"],"sources":["../../src/test/store.js"],"sourcesContent":["import test from 'ava';\nimport {createStore} from 'redux';\nimport {createMiddlewares} from '../store';\n\nconst appOptions = {\n services: {\n error: () => {\n throw new Error('error logger should not have been called');\n }\n }\n};\n\ntest('should apply redux-thunk', async t => {\n t.plan(5);\n\n const store = createStore(\n state => {\n t.pass();\n return state;\n },\n 'state',\n createMiddlewares(appOptions)\n );\n\n await store.dispatch({type: 1});\n return store.dispatch((dispatch, getState, options) => {\n t.is(options, appOptions);\n t.is(getState(), 'state');\n return dispatch({\n type: 2\n });\n });\n});\n\ntest('should enable devtools', t => {\n t.plan(1);\n global.window = {\n __REDUX_DEVTOOLS_EXTENSION__: () => {\n t.pass();\n return f => f;\n }\n };\n\n createStore(state => state, 'state', createMiddlewares(appOptions));\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,UAAU,GAAG;EACjBC,QAAQ,EAAE;IACRC,KAAK,EAAE,MAAM;MACX,MAAM,IAAIC,KAAJ,CAAU,0CAAV,CAAN;IACD;EAHO;AADO,CAAnB;AAQA,IAAAC,YAAA,EAAK,0BAAL,EAAiC,MAAMC,CAAN,IAAW;EAC1CA,CAAC,CAACC,IAAF,CAAO,CAAP;EAEA,MAAMC,KAAK,GAAG,IAAAC,kBAAA,EACZC,KAAK,IAAI;IACPJ,CAAC,CAACK,IAAF;IACA,OAAOD,KAAP;EACD,CAJW,EAKZ,OALY,EAMZ,IAAAE,wBAAA,EAAkBX,UAAlB,CANY,CAAd;EASA,MAAMO,KAAK,CAACK,QAAN,CAAe;IAACC,IAAI,EAAE;EAAP,CAAf,CAAN;EACA,OAAON,KAAK,CAACK,QAAN,CAAe,CAACA,QAAD,EAAWE,QAAX,EAAqBC,OAArB,KAAiC;IACrDV,CAAC,CAACW,EAAF,CAAKD,OAAL,EAAcf,UAAd;IACAK,CAAC,CAACW,EAAF,CAAKF,QAAQ,EAAb,EAAiB,OAAjB;IACA,OAAOF,QAAQ,CAAC;MACdC,IAAI,EAAE;IADQ,CAAD,CAAf;EAGD,CANM,CAAP;AAOD,CApBD;AAsBA,IAAAT,YAAA,EAAK,wBAAL,EAA+BC,CAAC,IAAI;EAClCA,CAAC,CAACC,IAAF,CAAO,CAAP;EACAW,MAAM,CAACC,MAAP,GAAgB;IACdC,4BAA4B,EAAE,MAAM;MAClCd,CAAC,CAACK,IAAF;MACA,OAAOU,CAAC,IAAIA,CAAZ;IACD;EAJa,CAAhB;EAOA,IAAAZ,kBAAA,EAAYC,KAAK,IAAIA,KAArB,EAA4B,OAA5B,EAAqC,IAAAE,wBAAA,EAAkBX,UAAlB,CAArC;AACD,CAVD"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
|
|
8
|
-
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
9
|
-
|
|
10
|
-
var _translate = require("@coorpacademy/translate");
|
|
11
|
-
|
|
12
|
-
var _components = require("@coorpacademy/components");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const render = vNode => {
|
|
17
|
-
_server.default.renderToStaticMarkup(_react.default.createElement(_components.Provider, {
|
|
18
|
-
translate: _translate.mockTranslate
|
|
19
|
-
}, vNode));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
var _default = render;
|
|
23
|
-
exports.default = _default;
|
|
24
|
-
//# sourceMappingURL=render.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["render","vNode","ReactDOM","renderToStaticMarkup","React","createElement","Provider","translate","mockTranslate"],"sources":["../../../../src/views/test/helpers/render.js"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom/server';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {Provider} from '@coorpacademy/components';\n\nconst render = vNode => {\n ReactDOM.renderToStaticMarkup(React.createElement(Provider, {translate: mockTranslate}, vNode));\n};\n\nexport default render;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,MAAM,GAAGC,KAAK,IAAI;EACtBC,eAAA,CAASC,oBAAT,CAA8BC,cAAA,CAAMC,aAAN,CAAoBC,oBAApB,EAA8B;IAACC,SAAS,EAAEC;EAAZ,CAA9B,EAA0DP,KAA1D,CAA9B;AACD,CAFD;;eAIeD,M"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _ = require("../..");
|
|
7
|
-
|
|
8
|
-
var _mapStateToProps = require("../../../map-state-to-props");
|
|
9
|
-
|
|
10
|
-
const stateToVNode = (options, store) => (0, _mapStateToProps.selectMapStateToVNode)(options, store, _.views, _.createStateToVNode);
|
|
11
|
-
|
|
12
|
-
var _default = stateToVNode;
|
|
13
|
-
exports.default = _default;
|
|
14
|
-
//# sourceMappingURL=state-to-vnode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-to-vnode.js","names":["stateToVNode","options","store","selectMapStateToVNode","views","createStateToVNode"],"sources":["../../../../src/views/test/helpers/state-to-vnode.js"],"sourcesContent":["import {createStateToVNode, views} from '../..';\nimport {selectMapStateToVNode} from '../../../map-state-to-props';\n\nconst stateToVNode = (options, store) =>\n selectMapStateToVNode(options, store, views, createStateToVNode);\n\nexport default stateToVNode;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA,MAAMA,YAAY,GAAG,CAACC,OAAD,EAAUC,KAAV,KACnB,IAAAC,sCAAA,EAAsBF,OAAtB,EAA+BC,KAA/B,EAAsCE,OAAtC,EAA6CC,oBAA7C,CADF;;eAGeL,Y"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
4
|
-
|
|
5
|
-
var _render = _interopRequireDefault(require("./helpers/render"));
|
|
6
|
-
|
|
7
|
-
var _stateToVnode = _interopRequireDefault(require("./helpers/state-to-vnode"));
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
const mapStateToVNode = (0, _stateToVnode.default)({}, {});
|
|
12
|
-
(0, _ava.default)('should display loading view', t => {
|
|
13
|
-
const vNode = mapStateToVNode({
|
|
14
|
-
ui: {
|
|
15
|
-
current: {
|
|
16
|
-
progressionId: null
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
t.notThrows(() => (0, _render.default)(vNode));
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=loading.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","names":["mapStateToVNode","stateToVNode","test","t","vNode","ui","current","progressionId","notThrows","testRendering"],"sources":["../../../src/views/test/loading.js"],"sourcesContent":["import test from 'ava';\nimport testRendering from './helpers/render';\nimport stateToVNode from './helpers/state-to-vnode';\n\nconst mapStateToVNode = stateToVNode({}, {});\n\ntest('should display loading view', t => {\n const vNode = mapStateToVNode({ui: {current: {progressionId: null}}});\n t.notThrows(() => testRendering(vNode));\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,eAAe,GAAG,IAAAC,qBAAA,EAAa,EAAb,EAAiB,EAAjB,CAAxB;AAEA,IAAAC,YAAA,EAAK,6BAAL,EAAoCC,CAAC,IAAI;EACvC,MAAMC,KAAK,GAAGJ,eAAe,CAAC;IAACK,EAAE,EAAE;MAACC,OAAO,EAAE;QAACC,aAAa,EAAE;MAAhB;IAAV;EAAL,CAAD,CAA7B;EACAJ,CAAC,CAACK,SAAF,CAAY,MAAM,IAAAC,eAAA,EAAcL,KAAd,CAAlB;AACD,CAHD"}
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
|
|
4
|
-
|
|
5
|
-
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
6
|
-
|
|
7
|
-
var _isFunction2 = _interopRequireDefault(require("lodash/fp/isFunction"));
|
|
8
|
-
|
|
9
|
-
var _isArray2 = _interopRequireDefault(require("lodash/fp/isArray"));
|
|
10
|
-
|
|
11
|
-
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
12
|
-
|
|
13
|
-
var _forEach2 = _interopRequireDefault(require("lodash/fp/forEach"));
|
|
14
|
-
|
|
15
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
16
|
-
|
|
17
|
-
var _translate = require("@coorpacademy/translate");
|
|
18
|
-
|
|
19
|
-
var _playerStore = require("@coorpacademy/player-store");
|
|
20
|
-
|
|
21
|
-
var _popinFailure = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-correction/popin-failure"));
|
|
22
|
-
|
|
23
|
-
var _popinSuccess = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-correction/popin-success"));
|
|
24
|
-
|
|
25
|
-
var _stateFailMultipleAnswers = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers"));
|
|
26
|
-
|
|
27
|
-
var _popinExtraLife = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-correction/popin-extra-life"));
|
|
28
|
-
|
|
29
|
-
var _popinRevival = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-correction/popin-revival"));
|
|
30
|
-
|
|
31
|
-
var _stateToVnode = _interopRequireDefault(require("./helpers/state-to-vnode"));
|
|
32
|
-
|
|
33
|
-
var _render = _interopRequireDefault(require("./helpers/render"));
|
|
34
|
-
|
|
35
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
-
|
|
37
|
-
const Vimeo = {
|
|
38
|
-
Player: () => true
|
|
39
|
-
};
|
|
40
|
-
const options = {
|
|
41
|
-
translate: _translate.mockTranslate,
|
|
42
|
-
Vimeo
|
|
43
|
-
};
|
|
44
|
-
const mapStateToVNode = (0, _stateToVnode.default)(options, {
|
|
45
|
-
dispatch: _identity2.default
|
|
46
|
-
});
|
|
47
|
-
(0, _ava.default)('should set properties for success popin', t => {
|
|
48
|
-
const vNode = mapStateToVNode(_popinSuccess.default);
|
|
49
|
-
(0, _render.default)(vNode);
|
|
50
|
-
const {
|
|
51
|
-
props
|
|
52
|
-
} = vNode;
|
|
53
|
-
t.is(props.header.lives, 1);
|
|
54
|
-
t.false(props.header.failed);
|
|
55
|
-
t.is(props.header.title, '__Good job');
|
|
56
|
-
t.is(props.header.subtitle, '__Good answer');
|
|
57
|
-
t.is(props.question.answerPrefix, '__Correct answer');
|
|
58
|
-
t.is(props.question.answer, '2');
|
|
59
|
-
t.false(props.resources.open);
|
|
60
|
-
t.false(props.klf.open);
|
|
61
|
-
t.true(props.tips.open);
|
|
62
|
-
const resetHandler = props.header.cta.onClick;
|
|
63
|
-
t.true((0, _isFunction2.default)(resetHandler));
|
|
64
|
-
const actionReset = resetHandler();
|
|
65
|
-
t.true((0, _isFunction2.default)(actionReset));
|
|
66
|
-
const toggleAccordionHandler = props.onClick;
|
|
67
|
-
t.true((0, _isFunction2.default)(toggleAccordionHandler));
|
|
68
|
-
const actionToggleAccordion = toggleAccordionHandler(0);
|
|
69
|
-
t.deepEqual(actionToggleAccordion, {
|
|
70
|
-
type: _playerStore.UI_TOGGLE_ACCORDION,
|
|
71
|
-
payload: {
|
|
72
|
-
id: 0
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
(0, _ava.default)('should set properties to open resource tab if wrong answer and no resource viewed', t => {
|
|
77
|
-
const vNode = mapStateToVNode(_popinFailure.default);
|
|
78
|
-
(0, _render.default)(vNode);
|
|
79
|
-
const {
|
|
80
|
-
props
|
|
81
|
-
} = vNode;
|
|
82
|
-
t.is(props.header.lives, 0);
|
|
83
|
-
t.true(props.header.failed);
|
|
84
|
-
t.is(props.header.title, '__Ouch');
|
|
85
|
-
t.is(props.header.subtitle, '__Wrong answer');
|
|
86
|
-
t.is(props.question.answer, 'Text');
|
|
87
|
-
t.true(props.resources.open);
|
|
88
|
-
t.false(props.klf.open);
|
|
89
|
-
t.false(props.tips.open);
|
|
90
|
-
const resources = props.resources.value;
|
|
91
|
-
t.true((0, _isArray2.default)(resources));
|
|
92
|
-
t.is(resources.length, 2);
|
|
93
|
-
t.true(resources[0].selected);
|
|
94
|
-
t.false(resources[1].selected);
|
|
95
|
-
});
|
|
96
|
-
(0, _ava.default)('should trigger actions for resources', t => {
|
|
97
|
-
const vNode = mapStateToVNode(_popinFailure.default);
|
|
98
|
-
(0, _render.default)(vNode);
|
|
99
|
-
const {
|
|
100
|
-
props
|
|
101
|
-
} = vNode;
|
|
102
|
-
const resources = props.resources.value;
|
|
103
|
-
(0, _forEach2.default)(resource => {
|
|
104
|
-
const {
|
|
105
|
-
onClick,
|
|
106
|
-
onPlay,
|
|
107
|
-
onPause,
|
|
108
|
-
onEnded,
|
|
109
|
-
onResume
|
|
110
|
-
} = resource;
|
|
111
|
-
const actionSelectResource = onClick();
|
|
112
|
-
const actionPlayVideo = onPlay();
|
|
113
|
-
const actionPauseVideo = onPause();
|
|
114
|
-
const actionResumeVideo = onResume();
|
|
115
|
-
const actionEndedVideo = onEnded();
|
|
116
|
-
const baseResource = (0, _omit2.default)(['onClick', 'onPause', 'onPlay', 'onEnded', 'onResume', 'selected'], resource);
|
|
117
|
-
t.deepEqual((0, _playerStore.selectResource)(resource._id), actionSelectResource);
|
|
118
|
-
t.true((0, _isFunction2.default)(actionPlayVideo));
|
|
119
|
-
t.deepEqual(baseResource, actionPauseVideo.resource);
|
|
120
|
-
t.is(actionPauseVideo.type, _playerStore.UI_VIDEO_PAUSE);
|
|
121
|
-
t.deepEqual(baseResource, actionEndedVideo.resource);
|
|
122
|
-
t.is(actionEndedVideo.type, _playerStore.UI_VIDEO_ENDED);
|
|
123
|
-
t.is(actionResumeVideo.type, _playerStore.UI_VIDEO_RESUME);
|
|
124
|
-
}, resources);
|
|
125
|
-
});
|
|
126
|
-
(0, _ava.default)('should set properties when selecting second resource', t => {
|
|
127
|
-
const vNode = mapStateToVNode((0, _set2.default)('ui.corrections.playResource', '590b862e2e967f64333ad4fc', _popinFailure.default));
|
|
128
|
-
(0, _render.default)(vNode);
|
|
129
|
-
const {
|
|
130
|
-
props
|
|
131
|
-
} = vNode;
|
|
132
|
-
t.is(props.header.lives, 0);
|
|
133
|
-
t.true(props.header.failed);
|
|
134
|
-
t.is(props.header.title, '__Ouch');
|
|
135
|
-
t.is(props.header.subtitle, '__Wrong answer');
|
|
136
|
-
t.deepEqual(props.header.corrections, [{
|
|
137
|
-
answer: 'Toto',
|
|
138
|
-
isCorrect: false
|
|
139
|
-
}]);
|
|
140
|
-
t.is(props.question.answer, 'Text');
|
|
141
|
-
t.true(props.resources.open);
|
|
142
|
-
t.false(props.klf.open);
|
|
143
|
-
t.false(props.tips.open);
|
|
144
|
-
const resources = props.resources.value;
|
|
145
|
-
t.true((0, _isArray2.default)(resources));
|
|
146
|
-
t.is(resources.length, 2);
|
|
147
|
-
t.false(resources[0].selected);
|
|
148
|
-
t.true(resources[1].selected);
|
|
149
|
-
});
|
|
150
|
-
(0, _ava.default)('should display loading when correction is not still fetched', t => {
|
|
151
|
-
const statePopinLoading = (0, _set2.default)('data.answers.entities.0.sli_Vy88~R-bX', null, _popinSuccess.default);
|
|
152
|
-
const vNode = mapStateToVNode(statePopinLoading);
|
|
153
|
-
(0, _render.default)(vNode);
|
|
154
|
-
const {
|
|
155
|
-
props
|
|
156
|
-
} = vNode;
|
|
157
|
-
t.deepEqual(props.header, {
|
|
158
|
-
type: 'popinCorrection'
|
|
159
|
-
});
|
|
160
|
-
t.is(props.question.answer, '');
|
|
161
|
-
t.false(props.resources.open);
|
|
162
|
-
t.false(props.klf.open);
|
|
163
|
-
t.true(props.tips.open);
|
|
164
|
-
});
|
|
165
|
-
(0, _ava.default)("should display loading state when answer's result is not still received", t => {
|
|
166
|
-
const statePopinLoading = (0, _set2.default)('data.progressions.entities.0.state.isCorrect', null, _popinSuccess.default);
|
|
167
|
-
const vNode = mapStateToVNode(statePopinLoading);
|
|
168
|
-
(0, _render.default)(vNode);
|
|
169
|
-
const {
|
|
170
|
-
props
|
|
171
|
-
} = vNode;
|
|
172
|
-
t.deepEqual(props.header, {
|
|
173
|
-
type: 'popinCorrection'
|
|
174
|
-
});
|
|
175
|
-
t.is(props.question.answer, '2');
|
|
176
|
-
t.false(props.resources.open);
|
|
177
|
-
t.false(props.klf.open);
|
|
178
|
-
t.true(props.tips.open);
|
|
179
|
-
});
|
|
180
|
-
(0, _ava.default)('should display correction view when slide has not ressources', t => {
|
|
181
|
-
const statePopinWithoutRessources = (0, _set2.default)(['data', 'contents', 'slide', 'entities', '1.B2.4', 'lessons'], [], _popinFailure.default);
|
|
182
|
-
const vNode = mapStateToVNode(statePopinWithoutRessources);
|
|
183
|
-
(0, _render.default)(vNode);
|
|
184
|
-
const {
|
|
185
|
-
props
|
|
186
|
-
} = vNode;
|
|
187
|
-
t.true(props.resources.open);
|
|
188
|
-
t.false(props.klf.open);
|
|
189
|
-
t.false(props.tips.open);
|
|
190
|
-
const resources = props.resources.value;
|
|
191
|
-
t.true((0, _isArray2.default)(resources));
|
|
192
|
-
t.is(resources.length, 0);
|
|
193
|
-
});
|
|
194
|
-
(0, _ava.default)('should show correction on multiple answers for a slide', t => {
|
|
195
|
-
const vNode = mapStateToVNode(_stateFailMultipleAnswers.default);
|
|
196
|
-
(0, _render.default)(vNode);
|
|
197
|
-
const {
|
|
198
|
-
props
|
|
199
|
-
} = vNode;
|
|
200
|
-
t.is(props.header.lives, 0);
|
|
201
|
-
t.true(props.header.failed);
|
|
202
|
-
t.is(props.header.title, '__Ouch');
|
|
203
|
-
t.is(props.header.subtitle, '__Wrong answer');
|
|
204
|
-
t.is(props.question.answer, 'France, Suisse');
|
|
205
|
-
t.deepEqual(props.header.corrections, [{
|
|
206
|
-
answer: 'Suisse',
|
|
207
|
-
isCorrect: true
|
|
208
|
-
}, {
|
|
209
|
-
answer: 'Fiji',
|
|
210
|
-
isCorrect: false
|
|
211
|
-
}]);
|
|
212
|
-
t.true(props.resources.open);
|
|
213
|
-
t.false(props.klf.open);
|
|
214
|
-
t.false(props.tips.open);
|
|
215
|
-
});
|
|
216
|
-
(0, _ava.default)('should show correction for extra life state', t => {
|
|
217
|
-
const vNode = mapStateToVNode(_popinExtraLife.default);
|
|
218
|
-
(0, _render.default)(vNode);
|
|
219
|
-
const {
|
|
220
|
-
props
|
|
221
|
-
} = vNode;
|
|
222
|
-
t.is(props.header.lives, 0);
|
|
223
|
-
t.true(props.header.failed);
|
|
224
|
-
t.is(props.gameOver, false);
|
|
225
|
-
t.is(props.quit.cta.title, '__Quit');
|
|
226
|
-
});
|
|
227
|
-
(0, _ava.default)('should show correction for revival state', t => {
|
|
228
|
-
const vNode = mapStateToVNode(_popinRevival.default);
|
|
229
|
-
(0, _render.default)(vNode);
|
|
230
|
-
const {
|
|
231
|
-
props
|
|
232
|
-
} = vNode;
|
|
233
|
-
t.is(props.header.lives, 0);
|
|
234
|
-
t.true(props.header.failed);
|
|
235
|
-
t.is(props.header.cta.title, '__Next');
|
|
236
|
-
});
|
|
237
|
-
//# sourceMappingURL=popin-correction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popin-correction.js","names":["Vimeo","Player","options","translate","mockTranslate","mapStateToVNode","stateToVNode","dispatch","test","t","vNode","statePopinSuccess","testRendering","props","is","header","lives","false","failed","title","subtitle","question","answerPrefix","answer","resources","open","klf","true","tips","resetHandler","cta","onClick","actionReset","toggleAccordionHandler","actionToggleAccordion","deepEqual","type","UI_TOGGLE_ACCORDION","payload","id","statePopinFailure","value","length","selected","resource","onPlay","onPause","onEnded","onResume","actionSelectResource","actionPlayVideo","actionPauseVideo","actionResumeVideo","actionEndedVideo","baseResource","selectResource","_id","UI_VIDEO_PAUSE","UI_VIDEO_ENDED","UI_VIDEO_RESUME","corrections","isCorrect","statePopinLoading","statePopinWithoutRessources","statePopinFailureMultipleAnswers","statePopinExtraLife","gameOver","quit","statePopinRevival"],"sources":["../../../src/views/test/popin-correction.js"],"sourcesContent":["import test from 'ava';\nimport {forEach, identity, isArray, isFunction, set, omit} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {\n UI_TOGGLE_ACCORDION,\n UI_VIDEO_RESUME,\n UI_VIDEO_PAUSE,\n UI_VIDEO_ENDED,\n selectResource\n} from '@coorpacademy/player-store';\nimport statePopinFailure from '../../map-state-to-props/test/fixtures/popin-correction/popin-failure';\nimport statePopinSuccess from '../../map-state-to-props/test/fixtures/popin-correction/popin-success';\nimport statePopinFailureMultipleAnswers from '../../map-state-to-props/test/fixtures/popin-correction/state-fail-multiple-answers';\nimport statePopinExtraLife from '../../map-state-to-props/test/fixtures/popin-correction/popin-extra-life';\nimport statePopinRevival from '../../map-state-to-props/test/fixtures/popin-correction/popin-revival';\nimport stateToVNode from './helpers/state-to-vnode';\nimport testRendering from './helpers/render';\n\nconst Vimeo = {Player: () => true};\nconst options = {\n translate: mockTranslate,\n Vimeo\n};\n\nconst mapStateToVNode = stateToVNode(options, {dispatch: identity});\n\ntest('should set properties for success popin', t => {\n const vNode = mapStateToVNode(statePopinSuccess);\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 1);\n t.false(props.header.failed);\n t.is(props.header.title, '__Good job');\n t.is(props.header.subtitle, '__Good answer');\n t.is(props.question.answerPrefix, '__Correct answer');\n t.is(props.question.answer, '2');\n t.false(props.resources.open);\n t.false(props.klf.open);\n t.true(props.tips.open);\n\n const resetHandler = props.header.cta.onClick;\n t.true(isFunction(resetHandler));\n const actionReset = resetHandler();\n t.true(isFunction(actionReset));\n\n const toggleAccordionHandler = props.onClick;\n t.true(isFunction(toggleAccordionHandler));\n const actionToggleAccordion = toggleAccordionHandler(0);\n t.deepEqual(actionToggleAccordion, {\n type: UI_TOGGLE_ACCORDION,\n payload: {id: 0}\n });\n});\n\ntest('should set properties to open resource tab if wrong answer and no resource viewed', t => {\n const vNode = mapStateToVNode(statePopinFailure);\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 0);\n t.true(props.header.failed);\n t.is(props.header.title, '__Ouch');\n t.is(props.header.subtitle, '__Wrong answer');\n t.is(props.question.answer, 'Text');\n t.true(props.resources.open);\n t.false(props.klf.open);\n t.false(props.tips.open);\n\n const resources = props.resources.value;\n\n t.true(isArray(resources));\n t.is(resources.length, 2);\n t.true(resources[0].selected);\n t.false(resources[1].selected);\n});\n\ntest('should trigger actions for resources', t => {\n const vNode = mapStateToVNode(statePopinFailure);\n testRendering(vNode);\n const {props} = vNode;\n const resources = props.resources.value;\n\n forEach(resource => {\n const {onClick, onPlay, onPause, onEnded, onResume} = resource;\n const actionSelectResource = onClick();\n const actionPlayVideo = onPlay();\n const actionPauseVideo = onPause();\n const actionResumeVideo = onResume();\n const actionEndedVideo = onEnded();\n const baseResource = omit(\n ['onClick', 'onPause', 'onPlay', 'onEnded', 'onResume', 'selected'],\n resource\n );\n\n t.deepEqual(selectResource(resource._id), actionSelectResource);\n t.true(isFunction(actionPlayVideo));\n\n t.deepEqual(baseResource, actionPauseVideo.resource);\n t.is(actionPauseVideo.type, UI_VIDEO_PAUSE);\n\n t.deepEqual(baseResource, actionEndedVideo.resource);\n t.is(actionEndedVideo.type, UI_VIDEO_ENDED);\n\n t.is(actionResumeVideo.type, UI_VIDEO_RESUME);\n }, resources);\n});\n\ntest('should set properties when selecting second resource', t => {\n const vNode = mapStateToVNode(\n set('ui.corrections.playResource', '590b862e2e967f64333ad4fc', statePopinFailure)\n );\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 0);\n t.true(props.header.failed);\n t.is(props.header.title, '__Ouch');\n t.is(props.header.subtitle, '__Wrong answer');\n t.deepEqual(props.header.corrections, [{answer: 'Toto', isCorrect: false}]);\n t.is(props.question.answer, 'Text');\n t.true(props.resources.open);\n t.false(props.klf.open);\n t.false(props.tips.open);\n\n const resources = props.resources.value;\n\n t.true(isArray(resources));\n t.is(resources.length, 2);\n t.false(resources[0].selected);\n t.true(resources[1].selected);\n});\n\ntest('should display loading when correction is not still fetched', t => {\n const statePopinLoading = set('data.answers.entities.0.sli_Vy88~R-bX', null, statePopinSuccess);\n\n const vNode = mapStateToVNode(statePopinLoading);\n testRendering(vNode);\n const {props} = vNode;\n\n t.deepEqual(props.header, {type: 'popinCorrection'});\n t.is(props.question.answer, '');\n t.false(props.resources.open);\n t.false(props.klf.open);\n t.true(props.tips.open);\n});\n\ntest(\"should display loading state when answer's result is not still received\", t => {\n const statePopinLoading = set(\n 'data.progressions.entities.0.state.isCorrect',\n null,\n statePopinSuccess\n );\n\n const vNode = mapStateToVNode(statePopinLoading);\n testRendering(vNode);\n const {props} = vNode;\n\n t.deepEqual(props.header, {type: 'popinCorrection'});\n t.is(props.question.answer, '2');\n t.false(props.resources.open);\n t.false(props.klf.open);\n t.true(props.tips.open);\n});\n\ntest('should display correction view when slide has not ressources', t => {\n const statePopinWithoutRessources = set(\n ['data', 'contents', 'slide', 'entities', '1.B2.4', 'lessons'],\n [],\n statePopinFailure\n );\n const vNode = mapStateToVNode(statePopinWithoutRessources);\n testRendering(vNode);\n const {props} = vNode;\n\n t.true(props.resources.open);\n t.false(props.klf.open);\n t.false(props.tips.open);\n\n const resources = props.resources.value;\n\n t.true(isArray(resources));\n t.is(resources.length, 0);\n});\n\ntest('should show correction on multiple answers for a slide', t => {\n const vNode = mapStateToVNode(statePopinFailureMultipleAnswers);\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 0);\n t.true(props.header.failed);\n t.is(props.header.title, '__Ouch');\n t.is(props.header.subtitle, '__Wrong answer');\n t.is(props.question.answer, 'France, Suisse');\n t.deepEqual(props.header.corrections, [\n {answer: 'Suisse', isCorrect: true},\n {answer: 'Fiji', isCorrect: false}\n ]);\n t.true(props.resources.open);\n t.false(props.klf.open);\n t.false(props.tips.open);\n});\n\ntest('should show correction for extra life state', t => {\n const vNode = mapStateToVNode(statePopinExtraLife);\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 0);\n t.true(props.header.failed);\n t.is(props.gameOver, false);\n t.is(props.quit.cta.title, '__Quit');\n});\n\ntest('should show correction for revival state', t => {\n const vNode = mapStateToVNode(statePopinRevival);\n testRendering(vNode);\n const {props} = vNode;\n\n t.is(props.header.lives, 0);\n t.true(props.header.failed);\n t.is(props.header.cta.title, '__Next');\n});\n"],"mappings":";;;;;;;;;;;;;;AAAA;;AAGA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG;EAACC,MAAM,EAAE,MAAM;AAAf,CAAd;AACA,MAAMC,OAAO,GAAG;EACdC,SAAS,EAAEC,wBADG;EAEdJ;AAFc,CAAhB;AAKA,MAAMK,eAAe,GAAG,IAAAC,qBAAA,EAAaJ,OAAb,EAAsB;EAACK,QAAQ;AAAT,CAAtB,CAAxB;AAEA,IAAAC,YAAA,EAAK,yCAAL,EAAgDC,CAAC,IAAI;EACnD,MAAMC,KAAK,GAAGL,eAAe,CAACM,qBAAD,CAA7B;EACA,IAAAC,eAAA,EAAcF,KAAd;EACA,MAAM;IAACG;EAAD,IAAUH,KAAhB;EAEAD,CAAC,CAACK,EAAF,CAAKD,KAAK,CAACE,MAAN,CAAaC,KAAlB,EAAyB,CAAzB;EACAP,CAAC,CAACQ,KAAF,CAAQJ,KAAK,CAACE,MAAN,CAAaG,MAArB;EACAT,CAAC,CAACK,EAAF,CAAKD,KAAK,CAACE,MAAN,CAAaI,KAAlB,EAAyB,YAAzB;EACAV,CAAC,CAACK,E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var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
4
|
-
|
|
5
|
-
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
6
|
-
|
|
7
|
-
var _ava = _interopRequireDefault(require("ava"));
|
|
8
|
-
|
|
9
|
-
var _translate = require("@coorpacademy/translate");
|
|
10
|
-
|
|
11
|
-
var _success = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-end/success"));
|
|
12
|
-
|
|
13
|
-
var _fail = _interopRequireDefault(require("../../map-state-to-props/test/fixtures/popin-end/fail"));
|
|
14
|
-
|
|
15
|
-
var _stateToVnode = _interopRequireDefault(require("./helpers/state-to-vnode"));
|
|
16
|
-
|
|
17
|
-
var _render = _interopRequireDefault(require("./helpers/render"));
|
|
18
|
-
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
21
|
-
const options = {
|
|
22
|
-
translate: _translate.mockTranslate
|
|
23
|
-
};
|
|
24
|
-
const toVNode = (0, _stateToVnode.default)(options, {
|
|
25
|
-
dispatch: _identity2.default
|
|
26
|
-
});
|
|
27
|
-
(0, _ava.default)('should set properties for success popin for microlearning', async t => {
|
|
28
|
-
const vNode = toVNode(_success.default);
|
|
29
|
-
(0, _render.default)(vNode);
|
|
30
|
-
const {
|
|
31
|
-
props
|
|
32
|
-
} = vNode;
|
|
33
|
-
t.is(props.header.lives.count, 0);
|
|
34
|
-
t.is(props.summary.header.title, '');
|
|
35
|
-
t.is(props.summary.header.subtitle, '__Congratulations!');
|
|
36
|
-
t.is(props.summary.header.failed, false);
|
|
37
|
-
t.is(props.summary.header.stars, '+10');
|
|
38
|
-
t.is(props.summary.header.rank, '+10');
|
|
39
|
-
t.is(props.summary.recommendation.title, '__Related subjects');
|
|
40
|
-
t.is(props.summary.recommendation.cards.length, 3);
|
|
41
|
-
t.is(props.summary.action.type, 'nextCourse');
|
|
42
|
-
t.is(props.summary.action.title, 'Chapter 2');
|
|
43
|
-
t.is(props.summary.action.card.view, 'grid');
|
|
44
|
-
const card = props.summary.recommendation.cards[1];
|
|
45
|
-
t.is(card.view, 'grid');
|
|
46
|
-
t.is(props.summary.footer.title, '__Back to home');
|
|
47
|
-
const exitHandler = props.summary.footer.onClick;
|
|
48
|
-
await t.notThrows(exitHandler);
|
|
49
|
-
});
|
|
50
|
-
(0, _ava.default)("should display +0 when user don't get higher score than his best score", t => {
|
|
51
|
-
const vNode = toVNode((0, _set2.default)(['data', 'contents', 'chapter', 'entities', '1.B2', 'bestScore'], 20, _success.default));
|
|
52
|
-
(0, _render.default)(vNode);
|
|
53
|
-
const {
|
|
54
|
-
props
|
|
55
|
-
} = vNode;
|
|
56
|
-
t.is(props.summary.header.stars, '+0');
|
|
57
|
-
});
|
|
58
|
-
(0, _ava.default)('should set properties for failure popin', async t => {
|
|
59
|
-
const vNode = toVNode(_fail.default);
|
|
60
|
-
(0, _render.default)(vNode);
|
|
61
|
-
const {
|
|
62
|
-
props
|
|
63
|
-
} = vNode;
|
|
64
|
-
t.is(props.header.lives.count, 0);
|
|
65
|
-
t.is(props.summary.header.title, '__Ooops');
|
|
66
|
-
t.is(props.summary.header.subtitle, '__You are out of lives!');
|
|
67
|
-
t.is(props.summary.header.failed, true);
|
|
68
|
-
t.is(props.summary.header.stars, null);
|
|
69
|
-
t.is(props.summary.header.rank, null);
|
|
70
|
-
t.is(props.summary.action.title, 'Les réseaux sociaux au service du crowdfunding');
|
|
71
|
-
t.is(props.summary.recommendation.title, '__Related subjects');
|
|
72
|
-
t.is(props.summary.recommendation.cards.length, 3);
|
|
73
|
-
const card = props.summary.recommendation.cards[1];
|
|
74
|
-
t.is(card.view, 'grid');
|
|
75
|
-
t.is(props.summary.footer.title, '__Back to home');
|
|
76
|
-
const exitHandler = props.summary.footer.onClick;
|
|
77
|
-
await t.notThrows(exitHandler);
|
|
78
|
-
t.is(props.summary.header.cta.title, '__Retry chapter');
|
|
79
|
-
const headerRetryHandler = props.summary.header.cta.onClick;
|
|
80
|
-
await t.notThrows(headerRetryHandler);
|
|
81
|
-
t.is(props.summary.action.button.title, '__Retry chapter');
|
|
82
|
-
const retryHandler = props.summary.action.button.onClick;
|
|
83
|
-
await t.notThrows(retryHandler);
|
|
84
|
-
});
|
|
85
|
-
(0, _ava.default)('should set properties for failure popin when losing rank', async t => {
|
|
86
|
-
const vNode = toVNode((0, _set2.default)('data.rank.start', 90, _fail.default));
|
|
87
|
-
(0, _render.default)(vNode);
|
|
88
|
-
const {
|
|
89
|
-
props
|
|
90
|
-
} = vNode;
|
|
91
|
-
t.is(props.header.lives.count, 0);
|
|
92
|
-
t.is(props.summary.header.title, '__Ooops');
|
|
93
|
-
t.is(props.summary.header.subtitle, '__You are out of lives!');
|
|
94
|
-
t.is(props.summary.header.failed, true);
|
|
95
|
-
t.is(props.summary.header.stars, null);
|
|
96
|
-
t.is(props.summary.header.rank, '-10');
|
|
97
|
-
t.is(props.summary.recommendation.title, '__Related subjects');
|
|
98
|
-
t.is(props.summary.recommendation.cards.length, 3);
|
|
99
|
-
const card = props.summary.recommendation.cards[1];
|
|
100
|
-
t.is(card.view, 'grid');
|
|
101
|
-
t.is(props.summary.footer.title, '__Back to home');
|
|
102
|
-
const exitHandler = props.summary.footer.onClick;
|
|
103
|
-
await t.notThrows(exitHandler);
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=popin-end.js.map
|