@coorpacademy/player-web 4.22.52 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +1 -8
- package/es/index.js.map +1 -1
- package/es/map-state-to-props/answer.js +0 -35
- package/es/map-state-to-props/answer.js.map +1 -1
- package/es/map-state-to-props/error-popin.js +0 -4
- package/es/map-state-to-props/error-popin.js.map +1 -1
- package/es/map-state-to-props/header.js +3 -14
- package/es/map-state-to-props/header.js.map +1 -1
- package/es/map-state-to-props/index.js +0 -6
- package/es/map-state-to-props/index.js.map +1 -1
- package/es/map-state-to-props/loading.js +0 -1
- package/es/map-state-to-props/loading.js.map +1 -1
- package/es/map-state-to-props/player.js +0 -13
- package/es/map-state-to-props/player.js.map +1 -1
- package/es/map-state-to-props/popin-correction.js +0 -25
- package/es/map-state-to-props/popin-correction.js.map +1 -1
- package/es/map-state-to-props/popin-end.js +6 -35
- package/es/map-state-to-props/popin-end.js.map +1 -1
- package/es/map-state-to-props/resources.js +4 -10
- package/es/map-state-to-props/resources.js.map +1 -1
- package/es/map-state-to-props/slide.js +0 -2
- package/es/map-state-to-props/slide.js.map +1 -1
- package/es/map-state-to-props/test/answer.js +0 -21
- package/es/map-state-to-props/test/answer.js.map +1 -1
- package/es/map-state-to-props/test/header.js +0 -2
- package/es/map-state-to-props/test/header.js.map +1 -1
- package/es/map-state-to-props/test/index.js +22 -29
- package/es/map-state-to-props/test/index.js.map +1 -1
- package/es/map-state-to-props/test/player.js +6 -19
- package/es/map-state-to-props/test/player.js.map +1 -1
- package/es/map-state-to-props/test/popin-correction.create-header-cta.js +0 -15
- package/es/map-state-to-props/test/popin-correction.create-header-cta.js.map +1 -1
- package/es/map-state-to-props/test/popin-correction.js +0 -8
- package/es/map-state-to-props/test/popin-correction.js.map +1 -1
- package/es/map-state-to-props/test/popin-end.js +0 -13
- package/es/map-state-to-props/test/popin-end.js.map +1 -1
- package/es/map-state-to-props/test/popin-error.js.map +1 -1
- package/es/map-state-to-props/test/resources.js +0 -2
- package/es/map-state-to-props/test/resources.js.map +1 -1
- package/es/run-app.js +0 -2
- package/es/run-app.js.map +1 -1
- package/es/store.js +0 -4
- package/es/store.js.map +1 -1
- package/es/test/add-timeout.js.map +1 -1
- package/es/test/helpers/css-register.js.map +1 -1
- package/es/test/helpers/macro.js +0 -1
- package/es/test/helpers/macro.js.map +1 -1
- package/es/test/index.js.map +1 -1
- package/es/test/init-reducers.js.map +1 -1
- package/es/test/locales.js.map +1 -1
- package/es/test/run-app.js.map +1 -1
- package/es/test/store.js.map +1 -1
- package/es/views/index.js.map +1 -1
- package/es/views/test/helpers/render.js +0 -2
- package/es/views/test/helpers/render.js.map +1 -1
- package/es/views/test/helpers/state-to-vnode.js +0 -2
- package/es/views/test/helpers/state-to-vnode.js.map +1 -1
- package/es/views/test/loading.js.map +1 -1
- package/es/views/test/popin-correction.js +0 -6
- package/es/views/test/popin-correction.js.map +1 -1
- package/es/views/test/popin-end.js.map +1 -1
- package/es/views/test/router.js.map +1 -1
- package/es/views/test/slide.js +0 -1
- package/es/views/test/slide.js.map +1 -1
- package/lib/index.js +2 -18
- package/lib/index.js.map +1 -1
- package/lib/map-state-to-props/answer.js +1 -47
- package/lib/map-state-to-props/answer.js.map +1 -1
- package/lib/map-state-to-props/error-popin.js +2 -10
- package/lib/map-state-to-props/error-popin.js.map +1 -1
- package/lib/map-state-to-props/header.js +5 -19
- package/lib/map-state-to-props/header.js.map +1 -1
- package/lib/map-state-to-props/index.js +1 -19
- package/lib/map-state-to-props/index.js.map +1 -1
- package/lib/map-state-to-props/loading.js +1 -4
- package/lib/map-state-to-props/loading.js.map +1 -1
- package/lib/map-state-to-props/player.js +2 -22
- package/lib/map-state-to-props/player.js.map +1 -1
- package/lib/map-state-to-props/popin-correction.js +1 -32
- package/lib/map-state-to-props/popin-correction.js.map +1 -1
- package/lib/map-state-to-props/popin-end.js +8 -47
- package/lib/map-state-to-props/popin-end.js.map +1 -1
- package/lib/map-state-to-props/resources.js +6 -20
- package/lib/map-state-to-props/resources.js.map +1 -1
- package/lib/map-state-to-props/slide.js +2 -11
- package/lib/map-state-to-props/slide.js.map +1 -1
- package/lib/map-state-to-props/test/answer.js +1 -37
- package/lib/map-state-to-props/test/answer.js.map +1 -1
- package/lib/map-state-to-props/test/header.js +1 -12
- package/lib/map-state-to-props/test/header.js.map +1 -1
- package/lib/map-state-to-props/test/index.js +23 -20
- package/lib/map-state-to-props/test/index.js.map +1 -1
- package/lib/map-state-to-props/test/player.js +12 -52
- package/lib/map-state-to-props/test/player.js.map +1 -1
- package/lib/map-state-to-props/test/popin-correction.create-header-cta.js +1 -27
- package/lib/map-state-to-props/test/popin-correction.create-header-cta.js.map +1 -1
- package/lib/map-state-to-props/test/popin-correction.js +1 -11
- package/lib/map-state-to-props/test/popin-correction.js.map +1 -1
- package/lib/map-state-to-props/test/popin-end.js +1 -26
- package/lib/map-state-to-props/test/popin-end.js.map +1 -1
- package/lib/map-state-to-props/test/popin-error.js +1 -6
- package/lib/map-state-to-props/test/popin-error.js.map +1 -1
- package/lib/map-state-to-props/test/resources.js +1 -11
- package/lib/map-state-to-props/test/resources.js.map +1 -1
- package/lib/run-app.js +1 -5
- package/lib/run-app.js.map +1 -1
- package/lib/store.js +1 -11
- package/lib/store.js.map +1 -1
- package/lib/test/add-timeout.js +1 -4
- package/lib/test/add-timeout.js.map +1 -1
- package/lib/test/helpers/css-register.js +1 -3
- package/lib/test/helpers/css-register.js.map +1 -1
- package/lib/test/helpers/macro.js +1 -4
- package/lib/test/helpers/macro.js.map +1 -1
- package/lib/test/index.js +3 -12
- package/lib/test/index.js.map +1 -1
- package/lib/test/init-reducers.js +1 -5
- package/lib/test/init-reducers.js.map +1 -1
- package/lib/test/locales.js +1 -8
- package/lib/test/locales.js.map +1 -1
- package/lib/test/run-app.js +1 -5
- package/lib/test/run-app.js.map +1 -1
- package/lib/test/store.js +1 -5
- package/lib/test/store.js.map +1 -1
- package/lib/views/index.js +2 -9
- package/lib/views/index.js.map +1 -1
- package/lib/views/test/helpers/render.js +2 -10
- package/lib/views/test/helpers/render.js.map +1 -1
- package/lib/views/test/helpers/state-to-vnode.js +1 -6
- package/lib/views/test/helpers/state-to-vnode.js.map +1 -1
- package/lib/views/test/loading.js +1 -5
- package/lib/views/test/loading.js.map +1 -1
- package/lib/views/test/popin-correction.js +1 -18
- package/lib/views/test/popin-correction.js.map +1 -1
- package/lib/views/test/popin-end.js +1 -10
- package/lib/views/test/popin-end.js.map +1 -1
- package/lib/views/test/router.js +1 -8
- package/lib/views/test/router.js.map +1 -1
- package/lib/views/test/slide.js +3 -23
- package/lib/views/test/slide.js.map +1 -1
- package/package.json +13 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.js","names":["options","translate","mockTranslate","store","dispatch","getAnswerProps","createGetAnswerProps","getHelp","createGetHelp","test","t","plan","state","ui","current","progressionId","_getAnswerProps","thunk","true","props","qcm","is","type","answers","every","answer","selected","onClick","value","length","title","false","template","Array","isArray","name","placeholder","onChange","selectOptions","validOption","qcmGraphic","data","configs","entities","version","shuffleChoices","progressions","engine","ref","deepEqual","qcmDrag","order","action","pass","slider","minLabel","maxLabel","basic","help","help1","help2"],"sources":["../../../src/map-state-to-props/test/answer.js"],"sourcesContent":["import test from 'ava';\nimport {omit, isFunction, identity, sortBy, pipe, map, pick} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {createGetAnswerProps, createGetHelp} from '../answer';\nimport basic from './fixtures/slides/basic';\nimport qcm from './fixtures/slides/qcm';\nimport qcmDrag from './fixtures/slides/qcm-drag';\nimport qcmGraphic from './fixtures/slides/qcm-graphic';\nimport template from './fixtures/slides/template';\nimport slider from './fixtures/slides/slider';\n\nconst options = {translate: mockTranslate};\nconst store = {dispatch: identity};\nconst getAnswerProps = createGetAnswerProps(options, store);\nconst getHelp = createGetHelp(options, store);\n\ntest('should create initial qcm props', t => {\n t.plan(3);\n\n const state = {\n ui: {\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.true(props.answers.every(answer => answer.selected === false));\n\n props.answers[0].onClick();\n});\n\ntest('should create edited qcm props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['Case 1', 'Case 3']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.is(props.answers.length, 4);\n t.is(props.answers[0].title, 'Case 1');\n t.true(props.answers[0].selected);\n t.is(props.answers[1].title, 'Case 2');\n t.false(props.answers[1].selected);\n t.is(props.answers[2].title, 'Case 3');\n t.true(props.answers[2].selected);\n t.is(props.answers[3].title, 'Case 4');\n t.false(props.answers[3].selected);\n t.true(isFunction(props.answers[0].onClick));\n});\n\ntest('should create edited template props', t => {\n t.plan(24);\n\n const state = {\n ui: {\n answers: {1234: {value: ['foo', 'exclusive']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n t.is(props.type, 'template');\n t.is(props.template, 'The answer is {{inp81438}} {{sel31191}}');\n t.true(Array.isArray(props.answers));\n t.is(props.answers.length, 2);\n t.is(props.answers[0].type, 'text');\n t.is(props.answers[0].name, 'inp81438');\n t.is(props.answers[0].placeholder, '__Type here');\n t.is(props.answers[0].value, 'foo');\n t.true(isFunction(props.answers[0].onChange));\n t.is(props.answers[1].type, 'select');\n t.is(props.answers[1].name, 'sel31191');\n t.is(props.answers[1]['aria-label'], '__Select an answer');\n t.true(isFunction(props.answers[1].onChange));\n const selectOptions = props.answers[1].options;\n t.true(Array.isArray(selectOptions));\n t.is(selectOptions.length, 2);\n t.is(selectOptions[0].name, 'temporary');\n t.is(selectOptions[0].value, 'temporary');\n t.false(selectOptions[0].selected);\n t.true(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'exclusive');\n t.is(selectOptions[1].value, 'exclusive');\n t.true(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should add an invalid `select an answer` choice for a select field in a template question if there are no answers for it', t => {\n t.plan(13);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n const selectOptions = props.answers[1].options;\n\n t.is(selectOptions.length, 3);\n t.is(selectOptions[0].name, '__Select an answer');\n t.true(selectOptions[0].selected);\n t.false(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'temporary');\n t.is(selectOptions[1].value, 'temporary');\n t.false(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n t.is(selectOptions[2].name, 'exclusive');\n t.is(selectOptions[2].value, 'exclusive');\n t.false(selectOptions[2].selected);\n t.true(selectOptions[2].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should create initial qcmGraphic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmGraphic);\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n t.true(props.answers.every(answer => answer.selected === false));\n});\n\ntest('should create edited qcmGraphic props', t => {\n t.plan(5);\n const state = {\n data: {\n configs: {\n entities: {\n 'learner@2': {\n version: '2',\n shuffleChoices: true\n }\n }\n },\n progressions: {\n entities: {\n 1234: {\n engine: {\n ref: 'learner',\n version: '2'\n }\n }\n }\n }\n },\n ui: {\n answers: {1234: {value: ['Vrai']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmGraphic);\n\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n\n const answers = pipe(map(pick(['title', 'selected'])), sortBy('title'))(props.answers);\n t.deepEqual(answers, [\n {title: 'Faux', selected: false},\n {title: 'Vrai', selected: true}\n ]);\n\n t.true(isFunction(props.answers[0].onClick));\n\n props.answers[0].onClick();\n});\n\ntest('should create initial qcmDrag props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmDrag);\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.false(props.answers[0].selected);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.false(props.answers[2].selected);\n t.true(isFunction(props.answers[2].onClick));\n});\n\ntest('should create edited qcmDrag props', t => {\n t.plan(14);\n const state = {\n ui: {\n answers: {1234: {value: ['Le smartphone', \"L'ordinateur\"]}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmDrag);\n\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.true(props.answers[0].selected);\n t.is(props.answers[0].order, 1);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.true(props.answers[2].selected);\n t.is(props.answers[2].order, 0);\n t.true(isFunction(props.answers[2].onClick));\n\n props.answers[2].onClick();\n});\n\ntest('should create initial slider props', t => {\n t.plan(8);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(state, slider);\n\n t.is(props.type, 'slider');\n t.is(props.placeholder, 'Déplacez le curseur.');\n t.is(props.minLabel, '0 an(s)');\n t.is(props.maxLabel, '1000 an(s)');\n t.is(props.title, '500 an(s)');\n t.is(props.value, 0.5);\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should default slider step to 1', t => {\n t.plan(2);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(\n state,\n omit('question.content.step', slider)\n );\n\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should create edited slider props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['300']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, slider);\n t.is(props.title, '300 an(s)');\n t.is(props.value, 0.3);\n});\n\ntest('should create initial basic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: null}\n }\n };\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n});\n\ntest('should create edited basic props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['foo']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n t.is(props.value, 'foo');\n t.true(isFunction(props.onChange));\n});\n\ntest('should provide an help subtitle depending on question.type', t => {\n const help = getHelp(qcmDrag);\n t.is(help, 'Cliquez sur les réponses dans le bon ordre.');\n const help1 = getHelp(template);\n t.is(help1, 'Type your answers');\n const help2 = getHelp(qcm);\n t.is(help2, '__Select something below');\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,GAAG;EAACC,SAAS,EAAEC;AAAZ,CAAhB;AACA,MAAMC,KAAK,GAAG;EAACC,QAAQ;AAAT,CAAd;AACA,MAAMC,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AE,CAAC,KAAD;QAAR;MAAP,CADP;MAEFd,OAAO,EAAE;QAACC,aAAa,EAAE;MAAhB;IAFP;EADQ,CAAd;EAOA,MAAMI,KAAK,GAAGd,cAAc,CAACO,KAAD,EAAQ6C,cAAR,CAA5B;EACA/C,CAAC,CAACW,EAAF,CAAKF,KAAK,CAACG,IAAX,EAAiB,UAAjB;EACAZ,CAAC,CAACW,EAAF,CAAKF,KAAK,CAACS,KAAX,EAAkB,KAAlB;EACAlB,CAAC,CAACQ,IAAF,CAAO,0BAAWC,KAAK,CAACkB,QAAjB,CAAP;AACD,CAZD;AAcA,IAAA5B,YAAA,EAAK,4DAAL,EAAmEC,CAAC,IAAI;EACtE,MAAMgD,IAAI,GAAGnD,OAAO,CAAC2C,gBAAD,CAApB;EACAxC,CAAC,CAACW,EAAF,CAAKqC,IAAL,EAAW,6CAAX;EACA,MAAMC,KAAK,GAAGpD,OAAO,CAACyB,iBAAD,CAArB;EACAtB,CAAC,CAACW,EAAF,CAAKsC,KAAL,EAAY,mBAAZ;EACA,MAAMC,KAAK,GAAGrD,OAAO,CAACa,YAAD,CAArB;EACAV,CAAC,CAACW,EAAF,CAAKuC,KAAL,EAAY,0BAAZ;AACD,CAPD"}
|
|
1
|
+
{"version":3,"file":"answer.js","names":["_ava","_interopRequireDefault","require","_translate","_answer","_basic","_qcm","_qcmDrag","_qcmGraphic","_template","_slider","e","__esModule","default","options","translate","mockTranslate","store","dispatch","_identity2","getAnswerProps","createGetAnswerProps","getHelp","createGetHelp","test","t","plan","state","ui","current","progressionId","_getAnswerProps","thunk","true","_isFunction2","props","qcm","is","type","answers","every","answer","selected","onClick","value","length","title","false","template","Array","isArray","name","placeholder","onChange","selectOptions","validOption","qcmGraphic","data","configs","entities","version","shuffleChoices","progressions","engine","ref","_pipe2","_map2","_pick2","_sortBy2","deepEqual","qcmDrag","order","action","pass","slider","minLabel","maxLabel","_omit2","basic","help","help1","help2"],"sources":["../../../src/map-state-to-props/test/answer.js"],"sourcesContent":["import test from 'ava';\nimport {omit, isFunction, identity, sortBy, pipe, map, pick} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {createGetAnswerProps, createGetHelp} from '../answer';\nimport basic from './fixtures/slides/basic';\nimport qcm from './fixtures/slides/qcm';\nimport qcmDrag from './fixtures/slides/qcm-drag';\nimport qcmGraphic from './fixtures/slides/qcm-graphic';\nimport template from './fixtures/slides/template';\nimport slider from './fixtures/slides/slider';\n\nconst options = {translate: mockTranslate};\nconst store = {dispatch: identity};\nconst getAnswerProps = createGetAnswerProps(options, store);\nconst getHelp = createGetHelp(options, store);\n\ntest('should create initial qcm props', t => {\n t.plan(3);\n\n const state = {\n ui: {\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.true(props.answers.every(answer => answer.selected === false));\n\n props.answers[0].onClick();\n});\n\ntest('should create edited qcm props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['Case 1', 'Case 3']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, qcm);\n\n t.is(props.type, 'qcm');\n t.is(props.answers.length, 4);\n t.is(props.answers[0].title, 'Case 1');\n t.true(props.answers[0].selected);\n t.is(props.answers[1].title, 'Case 2');\n t.false(props.answers[1].selected);\n t.is(props.answers[2].title, 'Case 3');\n t.true(props.answers[2].selected);\n t.is(props.answers[3].title, 'Case 4');\n t.false(props.answers[3].selected);\n t.true(isFunction(props.answers[0].onClick));\n});\n\ntest('should create edited template props', t => {\n t.plan(24);\n\n const state = {\n ui: {\n answers: {1234: {value: ['foo', 'exclusive']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n t.is(props.type, 'template');\n t.is(props.template, 'The answer is {{inp81438}} {{sel31191}}');\n t.true(Array.isArray(props.answers));\n t.is(props.answers.length, 2);\n t.is(props.answers[0].type, 'text');\n t.is(props.answers[0].name, 'inp81438');\n t.is(props.answers[0].placeholder, '__Type here');\n t.is(props.answers[0].value, 'foo');\n t.true(isFunction(props.answers[0].onChange));\n t.is(props.answers[1].type, 'select');\n t.is(props.answers[1].name, 'sel31191');\n t.is(props.answers[1]['aria-label'], '__Select an answer');\n t.true(isFunction(props.answers[1].onChange));\n const selectOptions = props.answers[1].options;\n t.true(Array.isArray(selectOptions));\n t.is(selectOptions.length, 2);\n t.is(selectOptions[0].name, 'temporary');\n t.is(selectOptions[0].value, 'temporary');\n t.false(selectOptions[0].selected);\n t.true(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'exclusive');\n t.is(selectOptions[1].value, 'exclusive');\n t.true(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should add an invalid `select an answer` choice for a select field in a template question if there are no answers for it', t => {\n t.plan(13);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, template);\n const selectOptions = props.answers[1].options;\n\n t.is(selectOptions.length, 3);\n t.is(selectOptions[0].name, '__Select an answer');\n t.true(selectOptions[0].selected);\n t.false(selectOptions[0].validOption);\n t.is(selectOptions[1].name, 'temporary');\n t.is(selectOptions[1].value, 'temporary');\n t.false(selectOptions[1].selected);\n t.true(selectOptions[1].validOption);\n t.is(selectOptions[2].name, 'exclusive');\n t.is(selectOptions[2].value, 'exclusive');\n t.false(selectOptions[2].selected);\n t.true(selectOptions[2].validOption);\n\n props.answers[1].onChange();\n});\n\ntest('should create initial qcmGraphic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmGraphic);\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n t.true(props.answers.every(answer => answer.selected === false));\n});\n\ntest('should create edited qcmGraphic props', t => {\n t.plan(5);\n const state = {\n data: {\n configs: {\n entities: {\n 'learner@2': {\n version: '2',\n shuffleChoices: true\n }\n }\n },\n progressions: {\n entities: {\n 1234: {\n engine: {\n ref: 'learner',\n version: '2'\n }\n }\n }\n }\n },\n ui: {\n answers: {1234: {value: ['Vrai']}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmGraphic);\n\n t.is(props.type, 'qcmGraphic');\n t.is(props.answers.length, 2);\n\n const answers = pipe(map(pick(['title', 'selected'])), sortBy('title'))(props.answers);\n t.deepEqual(answers, [\n {title: 'Faux', selected: false},\n {title: 'Vrai', selected: true}\n ]);\n\n t.true(isFunction(props.answers[0].onClick));\n\n props.answers[0].onClick();\n});\n\ntest('should create initial qcmDrag props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n const props = getAnswerProps(state, qcmDrag);\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.false(props.answers[0].selected);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.false(props.answers[2].selected);\n t.true(isFunction(props.answers[2].onClick));\n});\n\ntest('should create edited qcmDrag props', t => {\n t.plan(14);\n const state = {\n ui: {\n answers: {1234: {value: ['Le smartphone', \"L'ordinateur\"]}},\n current: {progressionId: '1234'}\n }\n };\n\n const _getAnswerProps = createGetAnswerProps(options, {\n dispatch: thunk => {\n t.true(isFunction(thunk));\n }\n });\n\n const props = _getAnswerProps(state, qcmDrag);\n\n t.is(props.type, 'qcmDrag');\n t.is(props.answers.length, 3);\n\n t.is(props.answers[0].title, \"L'ordinateur\");\n t.true(props.answers[0].selected);\n t.is(props.answers[0].order, 1);\n t.true(isFunction(props.answers[0].onClick));\n t.is(props.answers[1].title, 'La tablette');\n t.false(props.answers[1].selected);\n t.true(isFunction(props.answers[1].onClick));\n t.is(props.answers[2].title, 'Le smartphone');\n t.true(props.answers[2].selected);\n t.is(props.answers[2].order, 0);\n t.true(isFunction(props.answers[2].onClick));\n\n props.answers[2].onClick();\n});\n\ntest('should create initial slider props', t => {\n t.plan(8);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(state, slider);\n\n t.is(props.type, 'slider');\n t.is(props.placeholder, 'Déplacez le curseur.');\n t.is(props.minLabel, '0 an(s)');\n t.is(props.maxLabel, '1000 an(s)');\n t.is(props.title, '500 an(s)');\n t.is(props.value, 0.5);\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should default slider step to 1', t => {\n t.plan(2);\n const state = {\n ui: {\n answers: {},\n current: {progressionId: '1234'}\n }\n };\n\n const dispatch = action => {\n t.pass();\n };\n\n const props = createGetAnswerProps(options, {dispatch})(\n state,\n omit('question.content.step', slider)\n );\n\n t.true(isFunction(props.onChange));\n\n props.onChange(0.87);\n});\n\ntest('should create edited slider props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['300']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, slider);\n t.is(props.title, '300 an(s)');\n t.is(props.value, 0.3);\n});\n\ntest('should create initial basic props', t => {\n const state = {\n ui: {\n answers: {},\n current: {progressionId: null}\n }\n };\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n});\n\ntest('should create edited basic props', t => {\n const state = {\n ui: {\n answers: {1234: {value: ['foo']}},\n current: {progressionId: '1234'}\n }\n };\n\n const props = getAnswerProps(state, basic);\n t.is(props.type, 'freeText');\n t.is(props.value, 'foo');\n t.true(isFunction(props.onChange));\n});\n\ntest('should provide an help subtitle depending on question.type', t => {\n const help = getHelp(qcmDrag);\n t.is(help, 'Cliquez sur les réponses dans le bon ordre.');\n const help1 = getHelp(template);\n t.is(help1, 'Type your answers');\n const help2 = getHelp(qcm);\n t.is(help2, '__Select something below');\n});\n"],"mappings":";;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,IAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,OAAA,GAAAT,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAMG,OAAO,GAAG;EAACC,SAAS,EAAEC;AAAa,CAAC;AAC1C,MAAMC,KAAK,GAAG;EAACC,QAAQ,EAAAC,UAAA,CAAAN;AAAU,CAAC;AAClC,MAAMO,cAAc,GAAG,IAAAC,4BAAoB,EAACP,OAAO,EAAEG,KAAK,CAAC;AAC3D,MAAMK,OAAO,GAAG,IAAAC,qBAAa,EAACT,OAAO,EAAEG,KAAK,CAAC;AAE7C,IAAAO,YAAI,EAAC,iCAAiC,EAAEC,CAAC,IAAI;EAC3CA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;EAET,MAAMC,KAAK,GAAG;IACZC,EAAE,EAAE;MACFC,OAAO,EAAE;QAACC,aAAa,EAAE;MAAM;IACjC;EACF,CAAC;EAED,MAAMC,eAAe,G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CAAC;EAC5Bb,CAAC,CAACY,EAAE,CAACF,KAAK,CAACS,KAAK,EAAE,KAAK,CAAC;EACxBnB,CAAC,CAACQ,IAAI,CAAC,IAAAC,YAAA,CAAArB,OAAA,EAAWsB,KAAK,CAACkB,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,IAAA7B,YAAI,EAAC,4DAA4D,EAAEC,CAAC,IAAI;EACtE,MAAMsD,IAAI,GAAGzD,OAAO,CAACgD,gBAAO,CAAC;EAC7B7C,CAAC,CAACY,EAAE,CAAC0C,IAAI,EAAE,6CAA6C,CAAC;EACzD,MAAMC,KAAK,GAAG1D,OAAO,CAAC0B,iBAAQ,CAAC;EAC/BvB,CAAC,CAACY,EAAE,CAAC2C,KAAK,EAAE,mBAAmB,CAAC;EAChC,MAAMC,KAAK,GAAG3D,OAAO,CAACc,YAAG,CAAC;EAC1BX,CAAC,CAACY,EAAE,CAAC4C,KAAK,EAAE,0BAA0B,CAAC;AACzC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
|
|
4
|
-
|
|
5
4
|
var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
|
|
6
|
-
|
|
7
5
|
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
8
|
-
|
|
9
6
|
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
10
|
-
|
|
11
7
|
var _ava = _interopRequireDefault(require("ava"));
|
|
12
|
-
|
|
13
8
|
var _translate = require("@coorpacademy/translate");
|
|
14
|
-
|
|
15
9
|
var _header = _interopRequireDefault(require("../header"));
|
|
16
|
-
|
|
17
10
|
var _basic = _interopRequireDefault(require("./fixtures/slides/basic"));
|
|
18
|
-
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
12
|
const options = {
|
|
22
13
|
translate: _translate.mockTranslate
|
|
23
14
|
};
|
|
@@ -25,7 +16,6 @@ const store = {
|
|
|
25
16
|
dispatch: _identity2.default
|
|
26
17
|
};
|
|
27
18
|
const headerProps = (0, _header.default)(options, store);
|
|
28
|
-
|
|
29
19
|
const createProgression = slide => ({
|
|
30
20
|
engine: {
|
|
31
21
|
ref: 'microlearning',
|
|
@@ -48,7 +38,6 @@ const createProgression = slide => ({
|
|
|
48
38
|
viewedResources: []
|
|
49
39
|
}
|
|
50
40
|
});
|
|
51
|
-
|
|
52
41
|
const data = {
|
|
53
42
|
contents: {
|
|
54
43
|
chapter: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","names":["options","translate","mockTranslate","store","dispatch","headerProps","createHeader","createProgression","slide","engine","ref","version","content","type","state","nextContent","_id","lives","livesDisabled","step","current","viewedResources","data","contents","chapter","entities","name","level","chapterIds","basicSlide","chapter_id","progressions","basic","test","t","ui","progressionId","props","deepEqual","count","title","subcontent","details","is"],"sources":["../../../src/map-state-to-props/test/header.js"],"sourcesContent":["import test from 'ava';\nimport {set, identity, omit, pipe} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport createHeader from '../header';\nimport basicSlide from './fixtures/slides/basic';\n\nconst options = {translate: mockTranslate};\nconst store = {dispatch: identity};\nconst headerProps = createHeader(options, store);\n\nconst createProgression = slide => ({\n engine: {\n ref: 'microlearning',\n version: '1'\n },\n content: {\n ref: '1.B1',\n type: 'chapter'\n },\n state: {\n nextContent: {\n ref: slide._id,\n type: 'slide'\n },\n lives: 100,\n livesDisabled: false,\n step: {\n current: 1\n },\n viewedResources: []\n }\n});\n\nconst data = {\n contents: {\n chapter: {\n entities: {\n '1.B2': {\n _id: '1.B2',\n name: 'some-title'\n }\n }\n },\n level: {\n entities: {\n '1.B': {\n name: 'level-with-chapters',\n chapterIds: ['1.B1', '1.B2', '1.B3']\n }\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {\n chapter_id: '1.B2'\n }\n }\n }\n },\n progressions: {\n entities: {\n basic: createProgression(basicSlide)\n }\n }\n};\n\ntest('should create header with the number of lives in the state', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data, ui};\n const props = headerProps(state);\n t.deepEqual(props.lives, {\n count: 100\n });\n});\n\ntest('should read title from the content when available', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data: set('progressions.entities.basic.content.ref', '1.B2', data), ui};\n const props = headerProps(state);\n\n t.deepEqual(omit('onClick', props.content), {\n title: 'some-title'\n });\n});\n\ntest('should find chapter details within learner.header.subcontent', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {\n data: pipe(\n set('progressions.entities.basic.engine.ref', 'learner'),\n set('progressions.entities.basic.content.type', 'level'),\n set('progressions.entities.basic.content.ref', '1.B')\n )(data),\n ui\n };\n const props = headerProps(state);\n\n t.deepEqual(props.subcontent, {\n title: 'some-title',\n details: '2/3'\n });\n});\n\ntest('should set lives to null if lives are disabled in the progression', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data: set('progressions.entities.basic.state.livesDisabled', true, data), ui};\n const props = headerProps(state);\n\n t.is(props.lives, false);\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"header.js","names":["_ava","_interopRequireDefault","require","_translate","_header","_basic","e","__esModule","default","options","translate","mockTranslate","store","dispatch","_identity2","headerProps","createHeader","createProgression","slide","engine","ref","version","content","type","state","nextContent","_id","lives","livesDisabled","step","current","viewedResources","data","contents","chapter","entities","name","level","chapterIds","basicSlide","chapter_id","progressions","basic","test","t","ui","progressionId","props","deepEqual","count","_set2","_omit2","title","_pipe2","subcontent","details","is"],"sources":["../../../src/map-state-to-props/test/header.js"],"sourcesContent":["import test from 'ava';\nimport {set, identity, omit, pipe} from 'lodash/fp';\n\nimport {mockTranslate} from '@coorpacademy/translate';\nimport createHeader from '../header';\nimport basicSlide from './fixtures/slides/basic';\n\nconst options = {translate: mockTranslate};\nconst store = {dispatch: identity};\nconst headerProps = createHeader(options, store);\n\nconst createProgression = slide => ({\n engine: {\n ref: 'microlearning',\n version: '1'\n },\n content: {\n ref: '1.B1',\n type: 'chapter'\n },\n state: {\n nextContent: {\n ref: slide._id,\n type: 'slide'\n },\n lives: 100,\n livesDisabled: false,\n step: {\n current: 1\n },\n viewedResources: []\n }\n});\n\nconst data = {\n contents: {\n chapter: {\n entities: {\n '1.B2': {\n _id: '1.B2',\n name: 'some-title'\n }\n }\n },\n level: {\n entities: {\n '1.B': {\n name: 'level-with-chapters',\n chapterIds: ['1.B1', '1.B2', '1.B3']\n }\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {\n chapter_id: '1.B2'\n }\n }\n }\n },\n progressions: {\n entities: {\n basic: createProgression(basicSlide)\n }\n }\n};\n\ntest('should create header with the number of lives in the state', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data, ui};\n const props = headerProps(state);\n t.deepEqual(props.lives, {\n count: 100\n });\n});\n\ntest('should read title from the content when available', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data: set('progressions.entities.basic.content.ref', '1.B2', data), ui};\n const props = headerProps(state);\n\n t.deepEqual(omit('onClick', props.content), {\n title: 'some-title'\n });\n});\n\ntest('should find chapter details within learner.header.subcontent', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {\n data: pipe(\n set('progressions.entities.basic.engine.ref', 'learner'),\n set('progressions.entities.basic.content.type', 'level'),\n set('progressions.entities.basic.content.ref', '1.B')\n )(data),\n ui\n };\n const props = headerProps(state);\n\n t.deepEqual(props.subcontent, {\n title: 'some-title',\n details: '2/3'\n });\n});\n\ntest('should set lives to null if lives are disabled in the progression', t => {\n const ui = {current: {progressionId: 'basic'}};\n const state = {data: set('progressions.entities.basic.state.livesDisabled', true, data), ui};\n const props = headerProps(state);\n\n t.is(props.lives, false);\n});\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,G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AqB,MAAA,CAAA7C,OAAA,EACJ,IAAA0C,KAAA,CAAA1C,OAAA,EAAI,wCAAwC,EAAE,SAAS,CAAC,EACxD,IAAA0C,KAAA,CAAA1C,OAAA,EAAI,0CAA0C,EAAE,OAAO,CAAC,EACxD,IAAA0C,KAAA,CAAA1C,OAAA,EAAI,yCAAyC,EAAE,KAAK,CACtD,CAAC,CAACwB,IAAI,CAAC;IACPa;EACF,CAAC;EACD,MAAME,KAAK,GAAGhC,WAAW,CAACS,KAAK,CAAC;EAEhCoB,CAAC,CAACI,SAAS,CAACD,KAAK,CAACO,UAAU,EAAE;IAC5BF,KAAK,EAAE,YAAY;IACnBG,OAAO,EAAE;EACX,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,IAAAZ,YAAI,EAAC,mEAAmE,EAAEC,CAAC,IAAI;EAC7E,MAAMC,EAAE,GAAG;IAACf,OAAO,EAAE;MAACgB,aAAa,EAAE;IAAO;EAAC,CAAC;EAC9C,MAAMtB,KAAK,GAAG;IAACQ,IAAI,EAAE,IAAAkB,KAAA,CAAA1C,OAAA,EAAI,iDAAiD,EAAE,IAAI,EAAEwB,IAAI,CAAC;IAAEa;EAAE,CAAC;EAC5F,MAAME,KAAK,GAAGhC,WAAW,CAACS,KAAK,CAAC;EAEhCoB,CAAC,CAACY,EAAE,CAACT,KAAK,CAACpB,KAAK,EAAE,KAAK,CAAC;AAC1B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
4
|
-
|
|
5
4
|
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
6
|
-
|
|
7
5
|
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
|
|
8
|
-
|
|
9
6
|
var _ava = _interopRequireDefault(require("ava"));
|
|
10
|
-
|
|
11
7
|
var _player = _interopRequireDefault(require("../player"));
|
|
12
|
-
|
|
13
8
|
var _player2 = require("./player");
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
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); }
|
|
18
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
10
|
(0, _ava.default)('memoize choices > QCM', t => {
|
|
20
11
|
// state fixture
|
|
21
12
|
const initialState = (0, _set2.default)(['data', 'configs', 'entities', 'microlearning@1'], {
|
|
@@ -39,19 +30,24 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
39
30
|
label: 'foo'
|
|
40
31
|
}, {
|
|
41
32
|
label: 'bar'
|
|
42
|
-
}], initialState);
|
|
33
|
+
}], initialState);
|
|
43
34
|
|
|
44
|
-
|
|
35
|
+
// initiate player
|
|
36
|
+
const player = (0, _player.default)(_player2.options, _player2.store);
|
|
45
37
|
|
|
38
|
+
// test answers values
|
|
46
39
|
const props = player(initialState);
|
|
47
|
-
const expected = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props));
|
|
40
|
+
const expected = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props));
|
|
48
41
|
|
|
42
|
+
// test new answers values when state is updated
|
|
49
43
|
const props2 = player(secondState);
|
|
50
44
|
const expected2 = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props2));
|
|
51
|
-
t.deepEqual(expected2, expected);
|
|
45
|
+
t.deepEqual(expected2, expected);
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
// new player instance
|
|
48
|
+
const newPlayer = (0, _player.default)(_player2.options, _player2.store);
|
|
54
49
|
|
|
50
|
+
// test new answers values when store and state are updated
|
|
55
51
|
const props3 = newPlayer(secondState);
|
|
56
52
|
const expected3 = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props3));
|
|
57
53
|
t.deepEqual([...expected3].sort(), ['bar', 'foo']);
|
|
@@ -79,20 +75,27 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
79
75
|
label: 'foo'
|
|
80
76
|
}, {
|
|
81
77
|
label: 'bar'
|
|
82
|
-
}],
|
|
78
|
+
}], {
|
|
79
|
+
...initialState
|
|
80
|
+
});
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
// initiate player
|
|
83
|
+
const player = (0, _player.default)(_player2.options, _player2.store);
|
|
85
84
|
|
|
85
|
+
// test answers values
|
|
86
86
|
const props = player(initialState);
|
|
87
87
|
const expected = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props));
|
|
88
|
-
t.deepEqual([...expected].sort(), ["L'ordinateur", 'La tablette', 'Le smartphone']);
|
|
88
|
+
t.deepEqual([...expected].sort(), ["L'ordinateur", 'La tablette', 'Le smartphone']);
|
|
89
89
|
|
|
90
|
+
// test new answers values when state is updated
|
|
90
91
|
const props2 = player(secondState);
|
|
91
92
|
const expected2 = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props2));
|
|
92
|
-
t.deepEqual(expected2, expected);
|
|
93
|
+
t.deepEqual(expected2, expected);
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
// new player instance
|
|
96
|
+
const newPlayer = (0, _player.default)(_player2.options, _player2.store);
|
|
95
97
|
|
|
98
|
+
// test new answers values when store and state are updated
|
|
96
99
|
const props3 = newPlayer(secondState);
|
|
97
100
|
const expected3 = (0, _map2.default)('title', (0, _get2.default)(['answerType', 'model', 'answers'], props3));
|
|
98
101
|
t.deepEqual([...expected3].sort(), ['bar', 'foo']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["test","t","initialState","version","shuffleChoices","data","ui","route","qcm","current","progressionId","coaches","availableCoaches","secondState","label","player","createPlayer","options","store","props","expected","props2","expected2","deepEqual","newPlayer","props3","expected3","sort","qcmDrag"],"sources":["../../../src/map-state-to-props/test/index.js"],"sourcesContent":["import test from 'ava';\nimport {map, get, set} from 'lodash/fp';\nimport createPlayer from '../player';\n\nimport {data, options, store} from './player';\n\ntest('memoize choices > QCM', t => {\n // state fixture\n const initialState = set(\n ['data', 'configs', 'entities', 'microlearning@1'],\n {version: '1', shuffleChoices: true},\n {\n data,\n ui: {\n route: {qcm: 'answer'},\n current: {progressionId: 'qcm'},\n coaches: {availableCoaches: 1}\n }\n }\n );\n const secondState = set(\n ['data', 'contents', 'slide', 'entities', 'qcmSlide-1', 'question', 'content', 'choices'],\n [\n {\n label: 'foo'\n },\n {\n label: 'bar'\n }\n ],\n initialState\n );\n\n // initiate player\n const player = createPlayer(options, store);\n\n // test answers values\n const props = player(initialState);\n const expected = map('title', get(['answerType', 'model', 'answers'], props));\n\n // test new answers values when state is updated\n const props2 = player(secondState);\n const expected2 = map('title', get(['answerType', 'model', 'answers'], props2));\n t.deepEqual(expected2, expected);\n\n // new player instance\n const newPlayer = createPlayer(options, store);\n\n // test new answers values when store and state are updated\n const props3 = newPlayer(secondState);\n const expected3 = map('title', get(['answerType', 'model', 'answers'], props3));\n t.deepEqual([...expected3].sort(), ['bar', 'foo']);\n});\n\ntest('memoize choices > QCM DRAG', t => {\n // state fixture\n const initialState = set(\n ['data', 'configs', 'entities', 'microlearning@1'],\n {version: '1', shuffleChoices: true},\n {\n data,\n ui: {\n route: {qcmDrag: 'answer'},\n current: {progressionId: 'qcmDrag'},\n coaches: {availableCoaches: 1}\n }\n }\n );\n const secondState = set(\n ['data', 'contents', 'slide', 'entities', '8.B2.2', 'question', 'content', 'choices'],\n [\n {\n label: 'foo'\n },\n {\n label: 'bar'\n }\n ],\n {...initialState}\n );\n\n // initiate player\n const player = createPlayer(options, store);\n\n // test answers values\n const props = player(initialState);\n const expected = map('title', get(['answerType', 'model', 'answers'], props));\n t.deepEqual([...expected].sort(), [\"L'ordinateur\", 'La tablette', 'Le smartphone']);\n\n // test new answers values when state is updated\n const props2 = player(secondState);\n\n const expected2 = map('title', get(['answerType', 'model', 'answers'], props2));\n t.deepEqual(expected2, expected);\n\n // new player instance\n const newPlayer = createPlayer(options, store);\n\n // test new answers values when store and state are updated\n const props3 = newPlayer(secondState);\n const expected3 = map('title', get(['answerType', 'model', 'answers'], props3));\n t.deepEqual([...expected3].sort(), ['bar', 'foo']);\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_ava","_interopRequireDefault","require","_player","_player2","e","__esModule","default","test","t","initialState","_set2","version","shuffleChoices","data","ui","route","qcm","current","progressionId","coaches","availableCoaches","secondState","label","player","createPlayer","options","store","props","expected","_map2","_get2","props2","expected2","deepEqual","newPlayer","props3","expected3","sort","qcmDrag"],"sources":["../../../src/map-state-to-props/test/index.js"],"sourcesContent":["import test from 'ava';\nimport {map, get, set} from 'lodash/fp';\nimport createPlayer from '../player';\n\nimport {data, options, store} from './player';\n\ntest('memoize choices > QCM', t => {\n // state fixture\n const initialState = set(\n ['data', 'configs', 'entities', 'microlearning@1'],\n {version: '1', shuffleChoices: true},\n {\n data,\n ui: {\n route: {qcm: 'answer'},\n current: {progressionId: 'qcm'},\n coaches: {availableCoaches: 1}\n }\n }\n );\n const secondState = set(\n ['data', 'contents', 'slide', 'entities', 'qcmSlide-1', 'question', 'content', 'choices'],\n [\n {\n label: 'foo'\n },\n {\n label: 'bar'\n }\n ],\n initialState\n );\n\n // initiate player\n const player = createPlayer(options, store);\n\n // test answers values\n const props = player(initialState);\n const expected = map('title', get(['answerType', 'model', 'answers'], props));\n\n // test new answers values when state is updated\n const props2 = player(secondState);\n const expected2 = map('title', get(['answerType', 'model', 'answers'], props2));\n t.deepEqual(expected2, expected);\n\n // new player instance\n const newPlayer = createPlayer(options, store);\n\n // test new answers values when store and state are updated\n const props3 = newPlayer(secondState);\n const expected3 = map('title', get(['answerType', 'model', 'answers'], props3));\n t.deepEqual([...expected3].sort(), ['bar', 'foo']);\n});\n\ntest('memoize choices > QCM DRAG', t => {\n // state fixture\n const initialState = set(\n ['data', 'configs', 'entities', 'microlearning@1'],\n {version: '1', shuffleChoices: true},\n {\n data,\n ui: {\n route: {qcmDrag: 'answer'},\n current: {progressionId: 'qcmDrag'},\n coaches: {availableCoaches: 1}\n }\n }\n );\n const secondState = set(\n ['data', 'contents', 'slide', 'entities', '8.B2.2', 'question', 'content', 'choices'],\n [\n {\n label: 'foo'\n },\n {\n label: 'bar'\n }\n ],\n {...initialState}\n );\n\n // initiate player\n const player = createPlayer(options, store);\n\n // test answers values\n const props = player(initialState);\n const expected = map('title', get(['answerType', 'model', 'answers'], props));\n t.deepEqual([...expected].sort(), [\"L'ordinateur\", 'La tablette', 'Le smartphone']);\n\n // test new answers values when state is updated\n const props2 = player(secondState);\n\n const expected2 = map('title', get(['answerType', 'model', 'answers'], props2));\n t.deepEqual(expected2, expected);\n\n // new player instance\n const newPlayer = createPlayer(options, store);\n\n // test new answers values when store and state are updated\n const props3 = newPlayer(secondState);\n const expected3 = map('title', get(['answerType', 'model', 'answers'], props3));\n t.deepEqual([...expected3].sort(), ['bar', 'foo']);\n});\n"],"mappings":";;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,IAAAG,YAAI,EAAC,uBAAuB,EAAEC,CAAC,IAAI;EACjC;EACA,MAAMC,YAAY,GAAG,IAAAC,KAAA,CAAAJ,OAAA,EACnB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC,EAClD;IAACK,OAAO,EAAE,GAAG;IAAEC,cAAc,EAAE;EAAI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,EAAI,OAAO,EAAE,IAAAwB,KAAA,CAAAxB,OAAA,EAAI,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,CAAC,EAAEqB,KAAK,CAAC,CAAC;EAC7EnB,CAAC,CAACyB,SAAS,CAAC,CAAC,GAAGL,QAAQ,CAAC,CAACS,IAAI,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;;EAEnF;EACA,MAAMN,MAAM,GAAGR,MAAM,CAACF,WAAW,CAAC;EAElC,MAAMW,SAAS,GAAG,IAAAH,KAAA,CAAAvB,OAAA,EAAI,OAAO,EAAE,IAAAwB,KAAA,CAAAxB,OAAA,EAAI,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,CAAC,EAAEyB,MAAM,CAAC,CAAC;EAC/EvB,CAAC,CAACyB,SAAS,CAACD,SAAS,EAAEJ,QAAQ,CAAC;;EAEhC;EACA,MAAMM,SAAS,GAAG,IAAAV,eAAY,EAACC,gBAAO,EAAEC,cAAK,CAAC;;EAE9C;EACA,MAAMS,MAAM,GAAGD,SAAS,CAACb,WAAW,CAAC;EACrC,MAAMe,SAAS,GAAG,IAAAP,KAAA,CAAAvB,OAAA,EAAI,OAAO,EAAE,IAAAwB,KAAA,CAAAxB,OAAA,EAAI,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE6B,MAAM,CAAC,CAAC;EAC/E3B,CAAC,CAACyB,SAAS,CAAC,CAAC,GAAGG,SAAS,CAAC,CAACC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,63 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.store = exports.options = exports.data = void 0;
|
|
5
|
-
|
|
6
5
|
var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
|
|
7
|
-
|
|
8
6
|
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
9
|
-
|
|
10
7
|
var _isFunction2 = _interopRequireDefault(require("lodash/fp/isFunction"));
|
|
11
|
-
|
|
12
8
|
var _fromPairs2 = _interopRequireDefault(require("lodash/fp/fromPairs"));
|
|
13
|
-
|
|
14
9
|
var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
|
|
15
|
-
|
|
16
10
|
var _set2 = _interopRequireDefault(require("lodash/fp/set"));
|
|
17
|
-
|
|
18
11
|
var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
19
|
-
|
|
20
12
|
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
21
|
-
|
|
22
13
|
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
|
|
23
|
-
|
|
24
14
|
var _ava = _interopRequireDefault(require("ava"));
|
|
25
|
-
|
|
26
15
|
var _translate = require("@coorpacademy/translate");
|
|
27
|
-
|
|
28
16
|
var _playerServices = require("@coorpacademy/player-services");
|
|
29
|
-
|
|
30
17
|
var _playerStore = require("@coorpacademy/player-store");
|
|
31
|
-
|
|
32
18
|
var _player = _interopRequireDefault(require("../player"));
|
|
33
|
-
|
|
34
19
|
var _header = _interopRequireDefault(require("../header"));
|
|
35
|
-
|
|
36
20
|
var fixtures = _interopRequireWildcard(require("../../../sandbox/fixtures"));
|
|
37
|
-
|
|
38
21
|
var _progressionLearner = _interopRequireDefault(require("./fixtures/progression-learner"));
|
|
39
|
-
|
|
40
22
|
var _plop = _interopRequireDefault(require("./fixtures/slides/plop"));
|
|
41
|
-
|
|
42
23
|
var _basic = _interopRequireDefault(require("./fixtures/slides/basic"));
|
|
43
|
-
|
|
44
24
|
var _withContext = _interopRequireDefault(require("./fixtures/slides/with-context"));
|
|
45
|
-
|
|
46
25
|
var _template = _interopRequireDefault(require("./fixtures/slides/template"));
|
|
47
|
-
|
|
48
26
|
var _qcm = _interopRequireDefault(require("./fixtures/slides/qcm"));
|
|
49
|
-
|
|
50
27
|
var _qcmDrag = _interopRequireDefault(require("./fixtures/slides/qcm-drag"));
|
|
51
|
-
|
|
52
28
|
var _qcmGraphic = _interopRequireDefault(require("./fixtures/slides/qcm-graphic"));
|
|
53
|
-
|
|
54
|
-
function
|
|
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
|
-
|
|
29
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
62
32
|
const services = {
|
|
63
33
|
Analytics: _playerServices.Analytics,
|
|
64
34
|
Answers: (0, _playerServices.Answers)(fixtures),
|
|
@@ -73,19 +43,16 @@ const services = {
|
|
|
73
43
|
Progressions: (0, _playerServices.Progressions)(fixtures),
|
|
74
44
|
Recommendations: (0, _playerServices.Recommendations)(fixtures)
|
|
75
45
|
};
|
|
76
|
-
const options = {
|
|
46
|
+
const options = exports.options = {
|
|
77
47
|
translate: _translate.mockTranslate,
|
|
78
48
|
services
|
|
79
49
|
};
|
|
80
|
-
exports.
|
|
81
|
-
const store = {
|
|
50
|
+
const store = exports.store = {
|
|
82
51
|
dispatch: _identity2.default
|
|
83
52
|
};
|
|
84
|
-
exports.store = store;
|
|
85
53
|
const createPlayerProps = (0, _player.default)(options, store);
|
|
86
54
|
const createHeaderProps = (0, _header.default)(options, store);
|
|
87
55
|
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
56
|
const createProgression = (slide, contentRef) => ({
|
|
90
57
|
engine: {
|
|
91
58
|
ref: 'microlearning',
|
|
@@ -108,8 +75,7 @@ const createProgression = (slide, contentRef) => ({
|
|
|
108
75
|
viewedResources: []
|
|
109
76
|
}
|
|
110
77
|
});
|
|
111
|
-
|
|
112
|
-
const data = {
|
|
78
|
+
const data = exports.data = {
|
|
113
79
|
contents: {
|
|
114
80
|
chapter: {
|
|
115
81
|
entities: {
|
|
@@ -145,8 +111,6 @@ const data = {
|
|
|
145
111
|
}
|
|
146
112
|
}
|
|
147
113
|
};
|
|
148
|
-
exports.data = data;
|
|
149
|
-
|
|
150
114
|
const isDisabledFor = (slide, isConditional, answer) => {
|
|
151
115
|
const progressionId = 'progression';
|
|
152
116
|
const chapterId = 'chapter';
|
|
@@ -155,9 +119,10 @@ const isDisabledFor = (slide, isConditional, answer) => {
|
|
|
155
119
|
contents: {
|
|
156
120
|
slide: {
|
|
157
121
|
entities: {
|
|
158
|
-
[slide._id]:
|
|
122
|
+
[slide._id]: {
|
|
123
|
+
...slide,
|
|
159
124
|
chapter_id: chapterId
|
|
160
|
-
}
|
|
125
|
+
}
|
|
161
126
|
}
|
|
162
127
|
},
|
|
163
128
|
chapter: {
|
|
@@ -190,7 +155,6 @@ const isDisabledFor = (slide, isConditional, answer) => {
|
|
|
190
155
|
}
|
|
191
156
|
}).cta.disabled;
|
|
192
157
|
};
|
|
193
|
-
|
|
194
158
|
(0, _ava.default)('should create player props for basic question and show coaches', t => {
|
|
195
159
|
const state = {
|
|
196
160
|
data,
|
|
@@ -379,7 +343,6 @@ const isDisabledFor = (slide, isConditional, answer) => {
|
|
|
379
343
|
}
|
|
380
344
|
}
|
|
381
345
|
};
|
|
382
|
-
|
|
383
346
|
const dispatch = action => {
|
|
384
347
|
t.deepEqual(action, {
|
|
385
348
|
type: _playerStore.UI_SELECT_ROUTE,
|
|
@@ -389,7 +352,6 @@ const isDisabledFor = (slide, isConditional, answer) => {
|
|
|
389
352
|
}
|
|
390
353
|
});
|
|
391
354
|
};
|
|
392
|
-
|
|
393
355
|
const props = (0, _player.default)(options, {
|
|
394
356
|
dispatch: action => action(dispatch, () => state)
|
|
395
357
|
})(state);
|
|
@@ -613,7 +575,6 @@ const isDisabledFor = (slide, isConditional, answer) => {
|
|
|
613
575
|
const props = createPlayerProps(_progressionLearner.default);
|
|
614
576
|
t.is((0, _get2.default)('resources.0.id', props), undefined);
|
|
615
577
|
});
|
|
616
|
-
|
|
617
578
|
const createLearnerProgression = (slide, contentRef) => ({
|
|
618
579
|
engine: {
|
|
619
580
|
ref: 'learner',
|
|
@@ -636,7 +597,6 @@ const createLearnerProgression = (slide, contentRef) => ({
|
|
|
636
597
|
viewedResources: []
|
|
637
598
|
}
|
|
638
599
|
});
|
|
639
|
-
|
|
640
600
|
const check = (slide, answer) => {
|
|
641
601
|
const progressionId = 'progression';
|
|
642
602
|
const levelId = 'level';
|
|
@@ -646,9 +606,10 @@ const check = (slide, answer) => {
|
|
|
646
606
|
contents: {
|
|
647
607
|
slide: {
|
|
648
608
|
entities: {
|
|
649
|
-
[slide._id]:
|
|
609
|
+
[slide._id]: {
|
|
610
|
+
...slide,
|
|
650
611
|
chapter_id: chapterId
|
|
651
|
-
}
|
|
612
|
+
}
|
|
652
613
|
}
|
|
653
614
|
},
|
|
654
615
|
level: {
|
|
@@ -690,7 +651,6 @@ const check = (slide, answer) => {
|
|
|
690
651
|
}
|
|
691
652
|
}).cta.disabled;
|
|
692
653
|
};
|
|
693
|
-
|
|
694
654
|
(0, _ava.default)('should allow multi answers on adaptive level if the current chapter is not adaptive', t => {
|
|
695
655
|
t.true(check(_basic.default, []));
|
|
696
656
|
t.true(check(_qcm.default, []));
|