@coorpacademy/app-review 0.5.6-alpha.9 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib/src → es}/index.d.ts +1 -0
- package/es/{src/index.js → index.js} +4 -4
- package/es/{src/test → test}/index.test.js +0 -1
- package/{lib/src → es}/test/util/services.mock.d.ts +0 -1
- package/es/{src/test → test}/util/services.mock.js +0 -1
- package/{lib/src → es}/types/common.d.ts +2 -5
- package/{lib/src → es}/views/slides/index.d.ts +1 -2
- package/es/{src/views → views}/slides/index.js +18 -20
- package/{es/src → lib}/index.d.ts +1 -0
- package/lib/{src/index.js → index.js} +5 -4
- package/lib/{src/test → test}/index.test.js +0 -1
- package/{es/src → lib}/test/util/services.mock.d.ts +0 -1
- package/lib/{src/test → test}/util/services.mock.js +0 -1
- package/{es/src → lib}/types/common.d.ts +2 -5
- package/{es/src → lib}/views/slides/index.d.ts +1 -2
- package/lib/{src/views → views}/slides/index.js +18 -20
- package/package.json +4 -7
- package/src/index.tsx +6 -5
- package/src/test/index.test.tsx +0 -1
- package/src/test/util/services.mock.ts +0 -2
- package/src/types/common.ts +2 -6
- package/src/types/globals.d.ts +0 -1
- package/src/views/slides/index.ts +19 -43
- package/src/views/slides/test/header.on-click.test.ts +3 -10
- package/src/views/slides/test/index.test.ts +55 -58
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +3 -12
- package/src/views/slides/test/slide.free-text.on-change.test.ts +2 -4
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +3 -6
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.qcm.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.slider.on-change.test.ts +2 -3
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +2 -3
- package/src/views/slides/test/slide.template.on-change.test.ts +4 -5
- package/es/locales/en/review.json +0 -14
- package/es/sandbox/index.d.ts +0 -9
- package/es/sandbox/index.js +0 -56
- package/lib/locales/en/review.json +0 -14
- package/lib/sandbox/index.d.ts +0 -9
- package/lib/sandbox/index.js +0 -67
- package/locales/en/review.json +0 -14
- /package/es/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-correction.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.js +0 -0
- /package/es/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-answer.js +0 -0
- /package/es/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-progression.js +0 -0
- /package/es/{src/actions → actions}/data/token.d.ts +0 -0
- /package/es/{src/actions → actions}/data/token.js +0 -0
- /package/es/{src/actions → actions}/index.d.ts +0 -0
- /package/es/{src/actions → actions}/index.js +0 -0
- /package/es/{src/actions → actions}/test/create-test-store.d.ts +0 -0
- /package/es/{src/actions → actions}/test/create-test-store.js +0 -0
- /package/es/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/answers.js +0 -0
- /package/es/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/navigation.js +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.js +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.js +0 -0
- /package/es/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/slides.js +0 -0
- /package/es/{src/common → common}/index.d.ts +0 -0
- /package/es/{src/common → common}/index.js +0 -0
- /package/es/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/es/{src/configure-store.js → configure-store.js} +0 -0
- /package/es/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/es/{src/helpers → helpers}/css-register.js +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.js +0 -0
- /package/es/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/index.js +0 -0
- /package/es/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/progression.js +0 -0
- /package/es/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/rank.js +0 -0
- /package/es/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/skills.js +0 -0
- /package/es/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/slides.js +0 -0
- /package/es/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/token.js +0 -0
- /package/es/{src/reducers → reducers}/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.js +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
- /package/es/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.js +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.js +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.js +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.js +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.js +0 -0
- /package/es/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/es/{src/services → services}/fetch-correction.js +0 -0
- /package/es/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/es/{src/services → services}/fetch-rank.js +0 -0
- /package/es/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/es/{src/services → services}/fetch-skills.js +0 -0
- /package/es/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slide.js +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/es/{src/services → services}/index.d.ts +0 -0
- /package/es/{src/services → services}/index.js +0 -0
- /package/es/{src/services → services}/post-answer.d.ts +0 -0
- /package/es/{src/services → services}/post-answer.js +0 -0
- /package/es/{src/services → services}/post-progression.d.ts +0 -0
- /package/es/{src/services → services}/post-progression.js +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.js +0 -0
- /package/es/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/es/{src/services → services}/tools/sleep.js +0 -0
- /package/es/{src/test → test}/index.test.d.ts +0 -0
- /package/es/{src/types → types}/common.js +0 -0
- /package/es/{src/types → types}/slides.d.ts +0 -0
- /package/es/{src/types → types}/slides.js +0 -0
- /package/es/{src/views → views}/skills/index.d.ts +0 -0
- /package/es/{src/views → views}/skills/index.js +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/free-text.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/slider.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/template.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/template.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-correction.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-rank.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-skills.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-slide.js +0 -0
- /package/lib/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-answer.js +0 -0
- /package/lib/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-progression.js +0 -0
- /package/lib/{src/actions → actions}/data/token.d.ts +0 -0
- /package/lib/{src/actions → actions}/data/token.js +0 -0
- /package/lib/{src/actions → actions}/index.d.ts +0 -0
- /package/lib/{src/actions → actions}/index.js +0 -0
- /package/lib/{src/actions → actions}/test/create-test-store.d.ts +0 -0
- /package/lib/{src/actions → actions}/test/create-test-store.js +0 -0
- /package/lib/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/answers.js +0 -0
- /package/lib/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/navigation.js +0 -0
- /package/lib/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/next-slide.js +0 -0
- /package/lib/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/quit-popin.js +0 -0
- /package/lib/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/slides.js +0 -0
- /package/lib/{src/common → common}/index.d.ts +0 -0
- /package/lib/{src/common → common}/index.js +0 -0
- /package/lib/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/lib/{src/configure-store.js → configure-store.js} +0 -0
- /package/lib/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/lib/{src/helpers → helpers}/css-register.js +0 -0
- /package/lib/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/corrections.js +0 -0
- /package/lib/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/index.js +0 -0
- /package/lib/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/progression.js +0 -0
- /package/lib/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/rank.js +0 -0
- /package/lib/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/skills.js +0 -0
- /package/lib/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/slides.js +0 -0
- /package/lib/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/token.js +0 -0
- /package/lib/{src/reducers → reducers}/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/index.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/answers.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/index.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/navigation.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/positions.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/quit-popin.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/show-congrats.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/slide.js +0 -0
- /package/lib/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-correction.js +0 -0
- /package/lib/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-rank.js +0 -0
- /package/lib/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-skills.js +0 -0
- /package/lib/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slide.js +0 -0
- /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/lib/{src/services → services}/index.d.ts +0 -0
- /package/lib/{src/services → services}/index.js +0 -0
- /package/lib/{src/services → services}/post-answer.d.ts +0 -0
- /package/lib/{src/services → services}/post-answer.js +0 -0
- /package/lib/{src/services → services}/post-progression.d.ts +0 -0
- /package/lib/{src/services → services}/post-progression.js +0 -0
- /package/lib/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/lib/{src/services → services}/tools/fetch-responses.js +0 -0
- /package/lib/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/lib/{src/services → services}/tools/sleep.js +0 -0
- /package/lib/{src/test → test}/index.test.d.ts +0 -0
- /package/lib/{src/types → types}/common.js +0 -0
- /package/lib/{src/types → types}/slides.d.ts +0 -0
- /package/lib/{src/types → types}/slides.js +0 -0
- /package/lib/{src/views → views}/skills/index.d.ts +0 -0
- /package/lib/{src/views → views}/skills/index.js +0 -0
- /package/lib/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/lib/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/free-text.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/slider.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/template.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/template.js +0 -0
|
@@ -8,12 +8,7 @@ import toInteger from 'lodash/fp/toInteger';
|
|
|
8
8
|
import type {Dispatch} from 'redux';
|
|
9
9
|
import join from 'lodash/fp/join';
|
|
10
10
|
import {closeQuitPopin, openQuitPopin} from '../../actions/ui/quit-popin';
|
|
11
|
-
import type {
|
|
12
|
-
ConnectedOptions,
|
|
13
|
-
ProgressionAnswerItem,
|
|
14
|
-
ProgressionFromAPI,
|
|
15
|
-
SlideContent
|
|
16
|
-
} from '../../types/common';
|
|
11
|
+
import type {ProgressionAnswerItem, ProgressionFromAPI, SlideContent} from '../../types/common';
|
|
17
12
|
import {getProgressionSlidesRefs, type SlideIndexes} from '../../common';
|
|
18
13
|
import type {StoreState} from '../../reducers';
|
|
19
14
|
import type {AnswerUI} from '../../types/slides';
|
|
@@ -351,27 +346,22 @@ export const buildStepItems = (state: StoreState): StepItem[] => {
|
|
|
351
346
|
|
|
352
347
|
const getCorrectionPopinProps =
|
|
353
348
|
(dispatch: Dispatch) =>
|
|
354
|
-
(
|
|
355
|
-
isCorrect: boolean,
|
|
356
|
-
correctAnswer: string[],
|
|
357
|
-
klf: string,
|
|
358
|
-
translate: (key: string, data?: unknown) => string
|
|
359
|
-
): CorrectionPopinProps => {
|
|
349
|
+
(isCorrect: boolean, correctAnswer: string[], klf: string): CorrectionPopinProps => {
|
|
360
350
|
return {
|
|
361
351
|
klf: isCorrect
|
|
362
352
|
? undefined
|
|
363
353
|
: {
|
|
364
|
-
label:
|
|
354
|
+
label: '_klf',
|
|
365
355
|
tooltip: klf
|
|
366
356
|
},
|
|
367
|
-
resultLabel: isCorrect ?
|
|
357
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
368
358
|
information: {
|
|
369
|
-
label: isCorrect ?
|
|
359
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
370
360
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
371
361
|
},
|
|
372
362
|
next: {
|
|
373
|
-
ariaLabel:
|
|
374
|
-
label:
|
|
363
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
364
|
+
label: '_correctionNextLabel',
|
|
375
365
|
onClick: (): void => {
|
|
376
366
|
dispatch(nextSlide);
|
|
377
367
|
}
|
|
@@ -408,10 +398,7 @@ const buildQuitPopinProps =
|
|
|
408
398
|
};
|
|
409
399
|
};
|
|
410
400
|
|
|
411
|
-
const buildRankCard = (
|
|
412
|
-
rank: number,
|
|
413
|
-
translate: (key: string, data?: unknown) => string
|
|
414
|
-
): CongratsCardProps => {
|
|
401
|
+
const buildRankCard = (rank: number): CongratsCardProps => {
|
|
415
402
|
return {
|
|
416
403
|
'aria-label': 'Review Card Congrats Container',
|
|
417
404
|
'data-name': 'card-rank',
|
|
@@ -427,17 +414,14 @@ const buildRankCard = (
|
|
|
427
414
|
cardType: 'card-rank',
|
|
428
415
|
iconAriaLabel: 'Image without information',
|
|
429
416
|
className: undefined,
|
|
430
|
-
reviewCardTitle:
|
|
417
|
+
reviewCardTitle: 'You are now',
|
|
431
418
|
reviewCardValue: `${rank}`,
|
|
432
419
|
rankSuffix: 'th',
|
|
433
420
|
timerAnimation: 200
|
|
434
421
|
};
|
|
435
422
|
};
|
|
436
423
|
|
|
437
|
-
const buildCongratsProps = (
|
|
438
|
-
state: StoreState,
|
|
439
|
-
translate: (key: string, data?: unknown) => string
|
|
440
|
-
): CongratsProps | undefined => {
|
|
424
|
+
const buildCongratsProps = (state: StoreState): CongratsProps | undefined => {
|
|
441
425
|
if (!state.ui.showCongrats) return;
|
|
442
426
|
|
|
443
427
|
const progression = state.data.progression as ProgressionFromAPI;
|
|
@@ -461,21 +445,20 @@ const buildCongratsProps = (
|
|
|
461
445
|
iconAriaLabel: 'Image without information',
|
|
462
446
|
className: undefined,
|
|
463
447
|
cardType: 'card-star',
|
|
464
|
-
reviewCardTitle:
|
|
448
|
+
reviewCardTitle: 'You have won',
|
|
465
449
|
reviewCardValue: `${stars}`,
|
|
466
450
|
timerAnimation: 200
|
|
467
451
|
};
|
|
468
452
|
|
|
469
453
|
const {start, end} = state.data.rank;
|
|
470
454
|
const newRank = start - end;
|
|
471
|
-
const cardCongratsRank =
|
|
472
|
-
!Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
455
|
+
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
|
|
473
456
|
|
|
474
457
|
return {
|
|
475
458
|
'aria-label': 'Review Congratulations',
|
|
476
459
|
'data-name': 'review-congrats',
|
|
477
460
|
animationLottie: confettiAnimation,
|
|
478
|
-
title:
|
|
461
|
+
title: 'Congratulations!',
|
|
479
462
|
cardCongratsStar,
|
|
480
463
|
cardCongratsRank,
|
|
481
464
|
buttonRevising: undefined, // TODO make boutons and actions
|
|
@@ -491,9 +474,8 @@ const isEndOfProgression = (progression: ProgressionState): boolean => {
|
|
|
491
474
|
export const mapStateToSlidesProps = (
|
|
492
475
|
state: StoreState,
|
|
493
476
|
dispatch: Dispatch,
|
|
494
|
-
|
|
477
|
+
onQuitClick: Function
|
|
495
478
|
): SlidesViewProps => {
|
|
496
|
-
const {translate, onQuitClick} = options;
|
|
497
479
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
498
480
|
const endReview = isEndOfProgression(state.data.progression);
|
|
499
481
|
const correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -502,8 +484,8 @@ export const mapStateToSlidesProps = (
|
|
|
502
484
|
const showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
503
485
|
return {
|
|
504
486
|
header: {
|
|
505
|
-
mode:
|
|
506
|
-
skillName:
|
|
487
|
+
mode: '__revision_mode',
|
|
488
|
+
skillName: '__agility',
|
|
507
489
|
onQuitClick: () => dispatch(openQuitPopin),
|
|
508
490
|
'aria-label': 'aria-header-wrapper',
|
|
509
491
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -512,23 +494,17 @@ export const mapStateToSlidesProps = (
|
|
|
512
494
|
stack: {
|
|
513
495
|
slides: buildStackSlides(state, dispatch),
|
|
514
496
|
validateButton: {
|
|
515
|
-
label:
|
|
497
|
+
label: '__validate',
|
|
516
498
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
517
499
|
onClick: (): void => {
|
|
518
500
|
dispatch(postAnswer);
|
|
519
501
|
}
|
|
520
502
|
},
|
|
521
503
|
correctionPopinProps:
|
|
522
|
-
correction &&
|
|
523
|
-
getCorrectionPopinProps(dispatch)(
|
|
524
|
-
isCorrect,
|
|
525
|
-
correction.correctAnswer,
|
|
526
|
-
klf,
|
|
527
|
-
options.translate
|
|
528
|
-
),
|
|
504
|
+
correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
529
505
|
endReview: endReview && state.ui.showCongrats
|
|
530
506
|
},
|
|
531
|
-
congrats: buildCongratsProps(state
|
|
507
|
+
congrats: buildCongratsProps(state),
|
|
532
508
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
533
509
|
};
|
|
534
510
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
4
|
-
import {
|
|
5
|
-
incorrectFreeTextPostAnswerResponse,
|
|
6
|
-
services,
|
|
7
|
-
translate
|
|
8
|
-
} from '../../../test/util/services.mock';
|
|
4
|
+
import {incorrectFreeTextPostAnswerResponse, services} from '../../../test/util/services.mock';
|
|
9
5
|
import {StoreState} from '../../../reducers';
|
|
10
6
|
import {OPEN_POPIN} from '../../../actions/ui/quit-popin';
|
|
11
7
|
import {mapStateToSlidesProps} from '..';
|
|
@@ -41,13 +37,10 @@ const state: StoreState = {
|
|
|
41
37
|
test('should dispatch OPEN_POPIN action after a click on close button in header', async t => {
|
|
42
38
|
const expectedAction = [{type: OPEN_POPIN}];
|
|
43
39
|
const {dispatch, getState} = createTestStore(t, state, services, expectedAction);
|
|
44
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
40
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
45
41
|
t.is(props.quitPopin, undefined);
|
|
46
42
|
await props.header.onQuitClick();
|
|
47
|
-
const updatedProps = mapStateToSlidesProps(getState(), dispatch,
|
|
48
|
-
translate,
|
|
49
|
-
onQuitClick: identity
|
|
50
|
-
});
|
|
43
|
+
const updatedProps = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
51
44
|
t.not(updatedProps.quitPopin, undefined);
|
|
52
45
|
t.pass();
|
|
53
46
|
});
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
postAnswerResponses,
|
|
9
9
|
progressionSlideWithPendingSlide,
|
|
10
10
|
getChoicesCorrection,
|
|
11
|
-
incorrectFreeTextPostAnswerResponse
|
|
12
|
-
translate
|
|
11
|
+
incorrectFreeTextPostAnswerResponse
|
|
13
12
|
} from '../../../test/util/services.mock';
|
|
14
13
|
import {CongratsCardProps, CongratsProps, mapStateToSlidesProps} from '..';
|
|
15
14
|
import type {StoreState} from '../../../reducers';
|
|
@@ -19,8 +18,6 @@ import {templateSlide} from './fixtures/template';
|
|
|
19
18
|
import {qcmSlide} from './fixtures/qcm';
|
|
20
19
|
import {sliderSlide} from './fixtures/slider';
|
|
21
20
|
|
|
22
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
23
|
-
|
|
24
21
|
test('should create initial props when fetched slide is not still received', t => {
|
|
25
22
|
// SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
|
|
26
23
|
const state: StoreState = {
|
|
@@ -51,13 +48,13 @@ test('should create initial props when fetched slide is not still received', t =
|
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
50
|
|
|
54
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
51
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
55
52
|
t.is(props.congrats, undefined);
|
|
56
53
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
57
54
|
'aria-label': 'aria-header-wrapper',
|
|
58
55
|
closeButtonAriaLabel: 'aria-close-button',
|
|
59
|
-
mode:
|
|
60
|
-
skillName:
|
|
56
|
+
mode: '__revision_mode',
|
|
57
|
+
skillName: '__agility',
|
|
61
58
|
steps: [
|
|
62
59
|
{
|
|
63
60
|
current: true,
|
|
@@ -144,13 +141,13 @@ test('should create props when first slide is on the state', t => {
|
|
|
144
141
|
}
|
|
145
142
|
};
|
|
146
143
|
|
|
147
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
144
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
148
145
|
t.is(props.congrats, undefined);
|
|
149
146
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
150
147
|
'aria-label': 'aria-header-wrapper',
|
|
151
148
|
closeButtonAriaLabel: 'aria-close-button',
|
|
152
|
-
mode:
|
|
153
|
-
skillName:
|
|
149
|
+
mode: '__revision_mode',
|
|
150
|
+
skillName: '__agility',
|
|
154
151
|
steps: [
|
|
155
152
|
{
|
|
156
153
|
current: true,
|
|
@@ -252,13 +249,13 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
252
249
|
}
|
|
253
250
|
};
|
|
254
251
|
|
|
255
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
252
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
256
253
|
t.is(props.congrats, undefined);
|
|
257
254
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
258
255
|
'aria-label': 'aria-header-wrapper',
|
|
259
256
|
closeButtonAriaLabel: 'aria-close-button',
|
|
260
|
-
mode:
|
|
261
|
-
skillName:
|
|
257
|
+
mode: '__revision_mode',
|
|
258
|
+
skillName: '__agility',
|
|
262
259
|
steps: [
|
|
263
260
|
{
|
|
264
261
|
current: true,
|
|
@@ -366,13 +363,13 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
366
363
|
}
|
|
367
364
|
};
|
|
368
365
|
|
|
369
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
366
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
370
367
|
t.is(props.congrats, undefined);
|
|
371
368
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
372
369
|
'aria-label': 'aria-header-wrapper',
|
|
373
370
|
closeButtonAriaLabel: 'aria-close-button',
|
|
374
|
-
mode:
|
|
375
|
-
skillName:
|
|
371
|
+
mode: '__revision_mode',
|
|
372
|
+
skillName: '__agility',
|
|
376
373
|
steps: [
|
|
377
374
|
{
|
|
378
375
|
current: true,
|
|
@@ -484,13 +481,13 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
484
481
|
}
|
|
485
482
|
};
|
|
486
483
|
|
|
487
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
484
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
488
485
|
t.is(props.congrats, undefined);
|
|
489
486
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
490
487
|
'aria-label': 'aria-header-wrapper',
|
|
491
488
|
closeButtonAriaLabel: 'aria-close-button',
|
|
492
|
-
mode:
|
|
493
|
-
skillName:
|
|
489
|
+
mode: '__revision_mode',
|
|
490
|
+
skillName: '__agility',
|
|
494
491
|
steps: [
|
|
495
492
|
{
|
|
496
493
|
current: true,
|
|
@@ -559,13 +556,13 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
559
556
|
}
|
|
560
557
|
};
|
|
561
558
|
|
|
562
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
559
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
563
560
|
t.is(props.congrats, undefined);
|
|
564
561
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
565
562
|
'aria-label': 'aria-header-wrapper',
|
|
566
563
|
closeButtonAriaLabel: 'aria-close-button',
|
|
567
|
-
mode:
|
|
568
|
-
skillName:
|
|
564
|
+
mode: '__revision_mode',
|
|
565
|
+
skillName: '__agility',
|
|
569
566
|
steps: [
|
|
570
567
|
{
|
|
571
568
|
current: true,
|
|
@@ -596,16 +593,16 @@ test('should verify props when first slide was answered, next slide is fetched &
|
|
|
596
593
|
});
|
|
597
594
|
t.is(props.stack.endReview, false);
|
|
598
595
|
t.deepEqual(omit('next.onClick', props.stack.correctionPopinProps), {
|
|
599
|
-
resultLabel:
|
|
596
|
+
resultLabel: '_right',
|
|
600
597
|
information: {
|
|
601
|
-
label:
|
|
598
|
+
label: '_klf',
|
|
602
599
|
message:
|
|
603
600
|
'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
|
|
604
601
|
},
|
|
605
602
|
klf: undefined,
|
|
606
603
|
next: {
|
|
607
|
-
ariaLabel:
|
|
608
|
-
label:
|
|
604
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
605
|
+
label: '_correctionNextLabel'
|
|
609
606
|
},
|
|
610
607
|
type: 'right'
|
|
611
608
|
});
|
|
@@ -691,13 +688,13 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
691
688
|
}
|
|
692
689
|
};
|
|
693
690
|
|
|
694
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
691
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
695
692
|
t.is(props.congrats, undefined);
|
|
696
693
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
697
694
|
'aria-label': 'aria-header-wrapper',
|
|
698
695
|
closeButtonAriaLabel: 'aria-close-button',
|
|
699
|
-
mode:
|
|
700
|
-
skillName:
|
|
696
|
+
mode: '__revision_mode',
|
|
697
|
+
skillName: '__agility',
|
|
701
698
|
steps: [
|
|
702
699
|
{
|
|
703
700
|
current: true,
|
|
@@ -728,19 +725,19 @@ test('should verify props when first slide was answered incorrectly, next slide
|
|
|
728
725
|
});
|
|
729
726
|
t.is(props.stack.endReview, false);
|
|
730
727
|
t.deepEqual(omit('next.onClick', props.stack.correctionPopinProps), {
|
|
731
|
-
resultLabel:
|
|
728
|
+
resultLabel: '_wrong',
|
|
732
729
|
information: {
|
|
733
|
-
label:
|
|
730
|
+
label: '_correctAnswer',
|
|
734
731
|
message: 'Benchmark'
|
|
735
732
|
},
|
|
736
733
|
klf: {
|
|
737
|
-
label:
|
|
734
|
+
label: '_klf',
|
|
738
735
|
tooltip:
|
|
739
736
|
'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
|
|
740
737
|
},
|
|
741
738
|
next: {
|
|
742
|
-
ariaLabel:
|
|
743
|
-
label:
|
|
739
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
740
|
+
label: '_correctionNextLabel'
|
|
744
741
|
},
|
|
745
742
|
type: 'wrong'
|
|
746
743
|
});
|
|
@@ -830,13 +827,13 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
830
827
|
}
|
|
831
828
|
};
|
|
832
829
|
|
|
833
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
830
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
834
831
|
t.is(props.congrats, undefined);
|
|
835
832
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
836
833
|
'aria-label': 'aria-header-wrapper',
|
|
837
834
|
closeButtonAriaLabel: 'aria-close-button',
|
|
838
|
-
mode:
|
|
839
|
-
skillName:
|
|
835
|
+
mode: '__revision_mode',
|
|
836
|
+
skillName: '__agility',
|
|
840
837
|
steps: [
|
|
841
838
|
{
|
|
842
839
|
current: false,
|
|
@@ -963,13 +960,13 @@ test('should verify props when progression is in success, showing last correctio
|
|
|
963
960
|
}
|
|
964
961
|
};
|
|
965
962
|
|
|
966
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
963
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
967
964
|
t.is(props.congrats, undefined);
|
|
968
965
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
969
966
|
'aria-label': 'aria-header-wrapper',
|
|
970
967
|
closeButtonAriaLabel: 'aria-close-button',
|
|
971
|
-
mode:
|
|
972
|
-
skillName:
|
|
968
|
+
mode: '__revision_mode',
|
|
969
|
+
skillName: '__agility',
|
|
973
970
|
steps: [
|
|
974
971
|
{
|
|
975
972
|
current: false,
|
|
@@ -1001,16 +998,16 @@ test('should verify props when progression is in success, showing last correctio
|
|
|
1001
998
|
|
|
1002
999
|
t.deepEqual(omit(['next.onClick'], props.stack.correctionPopinProps), {
|
|
1003
1000
|
information: {
|
|
1004
|
-
label:
|
|
1001
|
+
label: '_klf',
|
|
1005
1002
|
message:
|
|
1006
1003
|
'L’apprenant peut aussi évaluer sa performance grâce à un classement disponible sur la vue leaderboard. Elle compare sa position par rapport à celle des autres apprenants de la plateforme.'
|
|
1007
1004
|
},
|
|
1008
1005
|
klf: undefined,
|
|
1009
1006
|
next: {
|
|
1010
|
-
ariaLabel:
|
|
1011
|
-
label:
|
|
1007
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
1008
|
+
label: '_correctionNextLabel'
|
|
1012
1009
|
},
|
|
1013
|
-
resultLabel:
|
|
1010
|
+
resultLabel: '_right',
|
|
1014
1011
|
type: 'right'
|
|
1015
1012
|
});
|
|
1016
1013
|
});
|
|
@@ -1085,9 +1082,9 @@ test('should verify props showing congrats', t => {
|
|
|
1085
1082
|
}
|
|
1086
1083
|
};
|
|
1087
1084
|
|
|
1088
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
1085
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1089
1086
|
const congrats = props.congrats as CongratsProps;
|
|
1090
|
-
t.is(congrats.title,
|
|
1087
|
+
t.is(congrats.title, 'Congratulations!');
|
|
1091
1088
|
t.is(
|
|
1092
1089
|
congrats.animationLottie.animationSrc,
|
|
1093
1090
|
'https://static-staging.coorpacademy.com/animations/review/confetti.json'
|
|
@@ -1112,7 +1109,7 @@ test('should verify props showing congrats', t => {
|
|
|
1112
1109
|
loop: true
|
|
1113
1110
|
},
|
|
1114
1111
|
rankSuffix: 'th',
|
|
1115
|
-
reviewCardTitle:
|
|
1112
|
+
reviewCardTitle: 'You are now',
|
|
1116
1113
|
reviewCardValue: '9'
|
|
1117
1114
|
}
|
|
1118
1115
|
);
|
|
@@ -1138,7 +1135,7 @@ test('should verify props showing congrats', t => {
|
|
|
1138
1135
|
}
|
|
1139
1136
|
},
|
|
1140
1137
|
rankSuffix: undefined,
|
|
1141
|
-
reviewCardTitle:
|
|
1138
|
+
reviewCardTitle: 'You have won',
|
|
1142
1139
|
reviewCardValue: '40'
|
|
1143
1140
|
}
|
|
1144
1141
|
);
|
|
@@ -1217,9 +1214,9 @@ test('should verify props showing congrats, with only stars card, if user has no
|
|
|
1217
1214
|
}
|
|
1218
1215
|
};
|
|
1219
1216
|
|
|
1220
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
1217
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1221
1218
|
const congrats = props.congrats as CongratsProps;
|
|
1222
|
-
t.is(congrats.title,
|
|
1219
|
+
t.is(congrats.title, 'Congratulations!');
|
|
1223
1220
|
t.is(
|
|
1224
1221
|
congrats.animationLottie.animationSrc,
|
|
1225
1222
|
'https://static-staging.coorpacademy.com/animations/review/confetti.json'
|
|
@@ -1247,7 +1244,7 @@ test('should verify props showing congrats, with only stars card, if user has no
|
|
|
1247
1244
|
}
|
|
1248
1245
|
},
|
|
1249
1246
|
rankSuffix: undefined,
|
|
1250
|
-
reviewCardTitle:
|
|
1247
|
+
reviewCardTitle: 'You have won',
|
|
1251
1248
|
reviewCardValue: '40'
|
|
1252
1249
|
}
|
|
1253
1250
|
);
|
|
@@ -1328,12 +1325,12 @@ test('should verify props when progression has answered a current pendingSlide',
|
|
|
1328
1325
|
}
|
|
1329
1326
|
};
|
|
1330
1327
|
|
|
1331
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
1328
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1332
1329
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
1333
1330
|
'aria-label': 'aria-header-wrapper',
|
|
1334
1331
|
closeButtonAriaLabel: 'aria-close-button',
|
|
1335
|
-
mode:
|
|
1336
|
-
skillName:
|
|
1332
|
+
mode: '__revision_mode',
|
|
1333
|
+
skillName: '__agility',
|
|
1337
1334
|
steps: [
|
|
1338
1335
|
{
|
|
1339
1336
|
current: true,
|
|
@@ -1434,12 +1431,12 @@ test('should verify props when progression still has a pendingSlide', t => {
|
|
|
1434
1431
|
}
|
|
1435
1432
|
};
|
|
1436
1433
|
|
|
1437
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
1434
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1438
1435
|
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
1439
1436
|
'aria-label': 'aria-header-wrapper',
|
|
1440
1437
|
closeButtonAriaLabel: 'aria-close-button',
|
|
1441
|
-
mode:
|
|
1442
|
-
skillName:
|
|
1438
|
+
mode: '__revision_mode',
|
|
1439
|
+
skillName: '__agility',
|
|
1443
1440
|
steps: [
|
|
1444
1441
|
{
|
|
1445
1442
|
current: false,
|
|
@@ -1498,6 +1495,6 @@ test('should verify that props quitPopin is not undefined when popin is displaye
|
|
|
1498
1495
|
showQuitPopin: true
|
|
1499
1496
|
}
|
|
1500
1497
|
};
|
|
1501
|
-
const props = mapStateToSlidesProps(state, identity,
|
|
1498
|
+
const props = mapStateToSlidesProps(state, identity, identity);
|
|
1502
1499
|
t.not(props.quitPopin, undefined);
|
|
1503
1500
|
});
|
|
@@ -2,18 +2,12 @@ import test from 'ava';
|
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
4
4
|
import {CLOSE_POPIN} from '../../../actions/ui/quit-popin';
|
|
5
|
-
import {
|
|
6
|
-
incorrectFreeTextPostAnswerResponse,
|
|
7
|
-
services,
|
|
8
|
-
translate
|
|
9
|
-
} from '../../../test/util/services.mock';
|
|
5
|
+
import {incorrectFreeTextPostAnswerResponse, services} from '../../../test/util/services.mock';
|
|
10
6
|
import {StoreState} from '../../../reducers';
|
|
11
7
|
import {mapStateToSlidesProps, QuitPopinProps} from '..';
|
|
12
8
|
import {freeTextSlide} from './fixtures/free-text';
|
|
13
9
|
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
14
10
|
|
|
15
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
16
|
-
|
|
17
11
|
const state: StoreState = {
|
|
18
12
|
data: {
|
|
19
13
|
progression: incorrectFreeTextPostAnswerResponse,
|
|
@@ -51,7 +45,7 @@ const state: StoreState = {
|
|
|
51
45
|
test('should dispatch CLOSE_POPIN action via the property handleOnclick of secondButton when popin is open', async t => {
|
|
52
46
|
const expectedAction = [{type: CLOSE_POPIN}];
|
|
53
47
|
const {dispatch, getState} = createTestStore(t, state, services, expectedAction);
|
|
54
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
48
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
55
49
|
const quitPopin = props.quitPopin as QuitPopinProps;
|
|
56
50
|
await quitPopin.secondButton.handleOnclick();
|
|
57
51
|
const updatedState = getState();
|
|
@@ -64,10 +58,7 @@ test('should dispatch onQuitClick function via the property handleOnclick of fir
|
|
|
64
58
|
|
|
65
59
|
const expectedAction = [{type: CLOSE_POPIN}];
|
|
66
60
|
const {dispatch, getState} = createTestStore(t, state, services, expectedAction);
|
|
67
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
68
|
-
translate,
|
|
69
|
-
onQuitClick: () => t.pass()
|
|
70
|
-
});
|
|
61
|
+
const props = mapStateToSlidesProps(getState(), dispatch, () => t.pass());
|
|
71
62
|
const quitPopin = props.quitPopin as QuitPopinProps;
|
|
72
63
|
await quitPopin.firstButton.handleOnclick();
|
|
73
64
|
t.pass();
|
|
@@ -13,8 +13,7 @@ import {ProgressionFromAPI} from '../../../types/common';
|
|
|
13
13
|
import {
|
|
14
14
|
getChoicesCorrection,
|
|
15
15
|
postAnswerResponses,
|
|
16
|
-
services
|
|
17
|
-
translate
|
|
16
|
+
services
|
|
18
17
|
} from '../../../test/util/services.mock';
|
|
19
18
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
20
19
|
import {StoreState} from '../../../reducers';
|
|
@@ -23,7 +22,6 @@ import {FreeText} from '../../../types/slides';
|
|
|
23
22
|
import {freeTextSlide} from './fixtures/free-text';
|
|
24
23
|
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
25
24
|
|
|
26
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
27
25
|
const progression: ProgressionFromAPI = {
|
|
28
26
|
_id: '123456789123',
|
|
29
27
|
content: {type: 'skill', ref: '_skill-ref'},
|
|
@@ -101,7 +99,7 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
|
|
|
101
99
|
];
|
|
102
100
|
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
103
101
|
|
|
104
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
102
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
105
103
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
106
104
|
animationType: undefined,
|
|
107
105
|
animateCorrectionPopin: false,
|
|
@@ -5,8 +5,7 @@ import {
|
|
|
5
5
|
postAnswerResponses,
|
|
6
6
|
getChoicesCorrection,
|
|
7
7
|
incorrectFreeTextPostAnswerResponse,
|
|
8
|
-
services
|
|
9
|
-
translate
|
|
8
|
+
services
|
|
10
9
|
} from '../../../test/util/services.mock';
|
|
11
10
|
import {CorrectionPopinProps, mapStateToSlidesProps} from '..';
|
|
12
11
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
@@ -17,8 +16,6 @@ import {templateSlide} from './fixtures/template';
|
|
|
17
16
|
import {qcmSlide} from './fixtures/qcm';
|
|
18
17
|
import {sliderSlide} from './fixtures/slider';
|
|
19
18
|
|
|
20
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
21
|
-
|
|
22
19
|
test('correction popin actions after click', async t => {
|
|
23
20
|
const state: StoreState = {
|
|
24
21
|
data: {
|
|
@@ -69,7 +66,7 @@ test('correction popin actions after click', async t => {
|
|
|
69
66
|
}
|
|
70
67
|
];
|
|
71
68
|
const {dispatch, getState} = createTestStore(t, state, services, expectedActions);
|
|
72
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
69
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
73
70
|
const correctionPopin = props.stack.correctionPopinProps as CorrectionPopinProps;
|
|
74
71
|
await correctionPopin.next.onClick();
|
|
75
72
|
|
|
@@ -167,7 +164,7 @@ test('correction popin actions after click when progression is finished', async
|
|
|
167
164
|
}
|
|
168
165
|
];
|
|
169
166
|
const {dispatch, getState} = createTestStore(t, state, services, expectedActions);
|
|
170
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
167
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
171
168
|
t.is(props.congrats, undefined);
|
|
172
169
|
const correctionPopin = props.stack.correctionPopinProps as CorrectionPopinProps;
|
|
173
170
|
await correctionPopin.next.onClick();
|
|
@@ -4,14 +4,13 @@ import get from 'lodash/fp/get';
|
|
|
4
4
|
import identity from 'lodash/fp/identity';
|
|
5
5
|
import {mapStateToSlidesProps} from '..';
|
|
6
6
|
import {ProgressionFromAPI} from '../../../types/common';
|
|
7
|
-
import {services
|
|
7
|
+
import {services} from '../../../test/util/services.mock';
|
|
8
8
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
9
9
|
import {StoreState} from '../../../reducers';
|
|
10
10
|
import {EDIT_QCM_DRAG} from '../../../actions/ui/answers';
|
|
11
11
|
import {QcmDrag} from '../../../types/slides';
|
|
12
12
|
import {qcmDragSlide} from './fixtures/qcm-drag';
|
|
13
13
|
|
|
14
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
15
14
|
const progression: ProgressionFromAPI = {
|
|
16
15
|
_id: '123456789123',
|
|
17
16
|
content: {type: 'skill', ref: '_skill-ref'},
|
|
@@ -74,7 +73,7 @@ test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Dra
|
|
|
74
73
|
];
|
|
75
74
|
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
76
75
|
|
|
77
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
76
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
78
77
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
79
78
|
animationType: undefined,
|
|
80
79
|
animateCorrectionPopin: false,
|
|
@@ -4,14 +4,13 @@ import get from 'lodash/fp/get';
|
|
|
4
4
|
import identity from 'lodash/fp/identity';
|
|
5
5
|
import {mapStateToSlidesProps} from '..';
|
|
6
6
|
import {ProgressionFromAPI} from '../../../types/common';
|
|
7
|
-
import {services
|
|
7
|
+
import {services} from '../../../test/util/services.mock';
|
|
8
8
|
import {createTestStore} from '../../../actions/test/create-test-store';
|
|
9
9
|
import {StoreState} from '../../../reducers';
|
|
10
10
|
import {EDIT_QCM_GRAPHIC} from '../../../actions/ui/answers';
|
|
11
11
|
import {QcmGraphic} from '../../../types/slides';
|
|
12
12
|
import {qcmGraphicSlide} from './fixtures/qcm-graphic';
|
|
13
13
|
|
|
14
|
-
const connectedOptions = {translate, onQuitClick: identity};
|
|
15
14
|
const progression: ProgressionFromAPI = {
|
|
16
15
|
_id: '123456789123',
|
|
17
16
|
content: {type: 'skill', ref: '_skill-ref'},
|
|
@@ -74,7 +73,7 @@ test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM
|
|
|
74
73
|
];
|
|
75
74
|
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
76
75
|
|
|
77
|
-
const props = mapStateToSlidesProps(getState(), dispatch,
|
|
76
|
+
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
78
77
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
79
78
|
animationType: undefined,
|
|
80
79
|
animateCorrectionPopin: false,
|