@coorpacademy/app-review 0.4.5 → 0.5.1-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/actions/ui/next-slide.d.ts +4 -2
- package/es/actions/ui/next-slide.js +7 -4
- package/es/actions/ui/quit-popin.d.ts +8 -0
- package/es/actions/ui/quit-popin.js +8 -0
- package/es/actions/ui/slides.d.ts +2 -3
- package/es/common/index.d.ts +2 -0
- package/es/common/index.js +9 -0
- package/es/reducers/index.d.ts +7 -1
- package/es/reducers/ui/answers.d.ts +2 -2
- package/es/reducers/ui/current-slide-ref.d.ts +3 -2
- package/es/reducers/ui/current-slide-ref.js +3 -0
- package/es/reducers/ui/index.d.ts +11 -1
- package/es/reducers/ui/index.js +5 -1
- package/es/reducers/ui/positions.d.ts +5 -0
- package/es/reducers/ui/positions.js +25 -0
- package/es/reducers/ui/quit-popin.d.ts +4 -0
- package/es/reducers/ui/quit-popin.js +16 -0
- package/es/reducers/ui/slide.d.ts +2 -2
- package/es/views/slides/index.d.ts +19 -2
- package/es/views/slides/index.js +45 -25
- package/lib/actions/ui/next-slide.d.ts +4 -2
- package/lib/actions/ui/next-slide.js +7 -4
- package/lib/actions/ui/quit-popin.d.ts +8 -0
- package/lib/actions/ui/quit-popin.js +8 -0
- package/lib/actions/ui/slides.d.ts +2 -3
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +9 -0
- package/lib/reducers/index.d.ts +7 -1
- package/lib/reducers/ui/answers.d.ts +2 -2
- package/lib/reducers/ui/current-slide-ref.d.ts +3 -2
- package/lib/reducers/ui/current-slide-ref.js +3 -0
- package/lib/reducers/ui/index.d.ts +11 -1
- package/lib/reducers/ui/index.js +5 -1
- package/lib/reducers/ui/positions.d.ts +5 -0
- package/lib/reducers/ui/positions.js +26 -0
- package/lib/reducers/ui/quit-popin.d.ts +4 -0
- package/lib/reducers/ui/quit-popin.js +17 -0
- package/lib/reducers/ui/slide.d.ts +2 -2
- package/lib/views/slides/index.d.ts +19 -2
- package/lib/views/slides/index.js +47 -26
- package/package.json +10 -11
- package/src/actions/api/test/fetch-correction.test.ts +3 -1
- package/src/actions/api/test/fetch-rank.test.ts +3 -1
- package/src/actions/api/test/fetch-skills.test.ts +3 -1
- package/src/actions/api/test/fetch-slide.test.ts +3 -1
- package/src/actions/api/test/post-answer.test.ts +6 -2
- package/src/actions/api/test/post-progression.test.ts +3 -1
- package/src/actions/data/test/token.test.ts +3 -1
- package/src/actions/ui/next-slide.ts +15 -9
- package/src/actions/ui/quit-popin.ts +10 -0
- package/src/actions/ui/slides.ts +2 -4
- package/src/actions/ui/test/answers.test.ts +3 -1
- package/src/actions/ui/test/next-slide.test.ts +9 -3
- package/src/actions/ui/test/quit-popin.test.ts +38 -0
- package/src/actions/ui/test/slides.test.ts +3 -1
- package/src/common/index.ts +12 -0
- package/src/common/test/get-progression-slide-ref.test.ts +35 -0
- package/src/reducers/ui/answers.ts +2 -2
- package/src/reducers/ui/current-slide-ref.ts +5 -2
- package/src/reducers/ui/index.ts +7 -1
- package/src/reducers/ui/positions.ts +32 -0
- package/src/reducers/ui/quit-popin.ts +22 -0
- package/src/reducers/ui/slide.ts +7 -2
- package/src/reducers/ui/test/answers.test.ts +3 -1
- package/src/reducers/ui/test/current-slide-ref.test.ts +2 -2
- package/src/reducers/ui/test/positions.test.ts +68 -0
- package/src/reducers/ui/test/quit-popin.test.ts +24 -0
- package/src/reducers/ui/test/slide.test.ts +3 -1
- package/src/types/common.ts +0 -1
- package/src/views/skills/test/skills.test.ts +6 -2
- package/src/views/slides/index.ts +70 -32
- package/src/views/slides/test/header.on-click.test.ts +42 -0
- package/src/views/slides/test/index.test.ts +90 -42
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +64 -0
- package/src/views/slides/test/slide.free-text.on-change.test.ts +3 -2
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +10 -2
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-change.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +17 -4
- package/src/views/slides/test/slide.template.on-change.test.ts +11 -11
- package/es/actions/ui/is-fetching.d.ts +0 -10
- package/es/actions/ui/is-fetching.js +0 -4
- package/lib/actions/ui/is-fetching.d.ts +0 -10
- package/lib/actions/ui/is-fetching.js +0 -4
- package/src/actions/ui/is-fetching.ts +0 -13
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
3
4
|
import identity from 'lodash/fp/identity';
|
|
4
5
|
import {ProgressionFromAPI} from '../../../types/common';
|
|
5
6
|
import {StoreState} from '../../../reducers';
|
|
@@ -47,18 +48,20 @@ const initialState: StoreState = {
|
|
|
47
48
|
currentSlideRef: sliderSlide._id,
|
|
48
49
|
navigation: ['skills', 'slides'],
|
|
49
50
|
answers: {},
|
|
51
|
+
positions: [0, 1, 2, 3, 4],
|
|
50
52
|
slide: {
|
|
51
53
|
[sliderSlide._id]: {
|
|
52
54
|
validateButton: false,
|
|
53
55
|
animateCorrectionPopin: false,
|
|
54
56
|
showCorrectionPopin: false
|
|
55
57
|
}
|
|
56
|
-
}
|
|
58
|
+
},
|
|
59
|
+
showQuitPopin: false
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
test('should dispatch EDIT_SLIDER action via the property onSliderChange of a Slider slide', t => {
|
|
61
|
-
t.plan(
|
|
64
|
+
t.plan(2);
|
|
62
65
|
|
|
63
66
|
const expectedActions = [
|
|
64
67
|
{
|
|
@@ -70,8 +73,18 @@ test('should dispatch EDIT_SLIDER action via the property onSliderChange of a Sl
|
|
|
70
73
|
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
71
74
|
const props = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
72
75
|
|
|
73
|
-
const
|
|
76
|
+
const slideProps = props.stack.slides['0'].answerUI?.model as QuestionRange;
|
|
77
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
78
|
+
animationType: undefined,
|
|
79
|
+
animateCorrectionPopin: false,
|
|
80
|
+
showCorrectionPopin: false,
|
|
81
|
+
position: 0,
|
|
82
|
+
loading: false,
|
|
83
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
84
|
+
questionText:
|
|
85
|
+
'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?'
|
|
86
|
+
});
|
|
74
87
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
75
|
-
const onSliderChange = get('onSliderChange',
|
|
88
|
+
const onSliderChange = get('onSliderChange', slideProps)!;
|
|
76
89
|
onSliderChange(111);
|
|
77
90
|
});
|
|
@@ -49,13 +49,15 @@ const initialState: StoreState = {
|
|
|
49
49
|
currentSlideRef: templateSlide._id,
|
|
50
50
|
navigation: ['skills', 'slides'],
|
|
51
51
|
answers: {},
|
|
52
|
+
positions: [0, 1, 2, 3, 4],
|
|
52
53
|
slide: {
|
|
53
54
|
[templateSlide._id]: {
|
|
54
55
|
validateButton: false,
|
|
55
56
|
animateCorrectionPopin: false,
|
|
56
57
|
showCorrectionPopin: false
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
},
|
|
60
|
+
showQuitPopin: false
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -73,17 +75,16 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
73
75
|
animationType: undefined,
|
|
74
76
|
animateCorrectionPopin: false,
|
|
75
77
|
showCorrectionPopin: false,
|
|
76
|
-
hidden: false,
|
|
77
78
|
position: 0,
|
|
78
79
|
loading: false,
|
|
79
80
|
parentContentTitle: 'From "Developing the review app" course',
|
|
80
81
|
questionText: 'Complétez la phrase ci-dessous.'
|
|
81
82
|
});
|
|
82
83
|
|
|
83
|
-
const
|
|
84
|
-
const onChangeText = get(['1', 'onChange'],
|
|
84
|
+
const slideProps = props.stack.slides['0'].answerUI?.model as Template;
|
|
85
|
+
const onChangeText = get(['1', 'onChange'], slideProps.answers);
|
|
85
86
|
onChangeText('test');
|
|
86
|
-
const onChangeSelect = get(['0', 'onChange'],
|
|
87
|
+
const onChangeSelect = get(['0', 'onChange'], slideProps.answers);
|
|
87
88
|
onChangeSelect('Catalogue');
|
|
88
89
|
});
|
|
89
90
|
|
|
@@ -105,21 +106,20 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
105
106
|
animationType: undefined,
|
|
106
107
|
animateCorrectionPopin: false,
|
|
107
108
|
showCorrectionPopin: false,
|
|
108
|
-
hidden: false,
|
|
109
109
|
position: 0,
|
|
110
110
|
loading: false,
|
|
111
111
|
parentContentTitle: 'From "Developing the review app" course',
|
|
112
112
|
questionText: 'Complétez la phrase ci-dessous.'
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
const
|
|
116
|
-
const textAnswerProps =
|
|
115
|
+
const slideProps = props.stack.slides['0'].answerUI?.model as Template;
|
|
116
|
+
const textAnswerProps = slideProps.answers[1] as TextTemplate;
|
|
117
117
|
t.is(textAnswerProps.value, 'Test');
|
|
118
|
-
const onChangeText = get(['1', 'onChange'],
|
|
118
|
+
const onChangeText = get(['1', 'onChange'], slideProps.answers);
|
|
119
119
|
onChangeText('');
|
|
120
120
|
|
|
121
121
|
const newProps = mapStateToSlidesProps(getState(), dispatch, identity);
|
|
122
|
-
const
|
|
123
|
-
const textAnswerPropsAfterOnChange =
|
|
122
|
+
const slidePropsAfterOnChange = newProps.stack.slides['0'].answerUI?.model as Template;
|
|
123
|
+
const textAnswerPropsAfterOnChange = slidePropsAfterOnChange.answers[1] as TextTemplate;
|
|
124
124
|
t.is(textAnswerPropsAfterOnChange.value, '');
|
|
125
125
|
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const START_FETCHING = "@@ui/START_FETCHING";
|
|
2
|
-
export declare const STOP_FETCHING = "@@ui/STOP_FETCHING";
|
|
3
|
-
export declare type StartFetching = {
|
|
4
|
-
type: typeof START_FETCHING;
|
|
5
|
-
};
|
|
6
|
-
export declare type StopFetching = {
|
|
7
|
-
type: typeof STOP_FETCHING;
|
|
8
|
-
};
|
|
9
|
-
export declare const startFetching: () => StartFetching;
|
|
10
|
-
export declare const stopFetching: () => StopFetching;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const START_FETCHING = "@@ui/START_FETCHING";
|
|
2
|
-
export declare const STOP_FETCHING = "@@ui/STOP_FETCHING";
|
|
3
|
-
export declare type StartFetching = {
|
|
4
|
-
type: typeof START_FETCHING;
|
|
5
|
-
};
|
|
6
|
-
export declare type StopFetching = {
|
|
7
|
-
type: typeof STOP_FETCHING;
|
|
8
|
-
};
|
|
9
|
-
export declare const startFetching: () => StartFetching;
|
|
10
|
-
export declare const stopFetching: () => StopFetching;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const START_FETCHING = '@@ui/START_FETCHING';
|
|
2
|
-
export const STOP_FETCHING = '@@ui/STOP_FETCHING';
|
|
3
|
-
|
|
4
|
-
export type StartFetching = {
|
|
5
|
-
type: typeof START_FETCHING;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type StopFetching = {
|
|
9
|
-
type: typeof STOP_FETCHING;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const startFetching = (): StartFetching => ({type: START_FETCHING});
|
|
13
|
-
export const stopFetching = (): StopFetching => ({type: STOP_FETCHING});
|