@coorpacademy/app-review 0.1.16 → 0.1.18
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/api/fetch-skills.d.ts +3 -3
- package/es/actions/api/fetch-skills.js +7 -2
- package/es/actions/api/fetch-slide.d.ts +1 -1
- package/es/actions/api/fetch-slide.js +3 -1
- package/es/actions/api/post-answer.d.ts +14 -0
- package/es/actions/api/post-answer.js +25 -0
- package/es/actions/api/post-progression.d.ts +3 -3
- package/es/actions/api/post-progression.js +5 -2
- package/es/actions/api/test/fetch-skills.test.js +7 -4
- package/es/actions/api/test/fetch-slide.test.js +7 -4
- package/es/actions/api/test/post-answer.test.d.ts +1 -0
- package/es/actions/api/test/post-answer.test.js +82 -0
- package/es/actions/api/test/post-progression.test.js +7 -4
- package/es/actions/data/test/token.test.d.ts +1 -0
- package/es/actions/data/test/token.test.js +25 -0
- package/es/actions/index.d.ts +1 -8
- package/es/actions/{api/test → test}/create-test-store.d.ts +2 -2
- package/es/actions/{api/test → test}/create-test-store.js +1 -1
- package/es/actions/ui/answers.d.ts +17 -3
- package/es/actions/ui/answers.js +41 -3
- package/es/actions/ui/slides.d.ts +0 -5
- package/es/actions/ui/slides.js +0 -4
- package/es/actions/ui/test/answers.test.d.ts +1 -0
- package/es/actions/ui/test/answers.test.js +100 -0
- package/es/actions/ui/test/slides.test.d.ts +1 -0
- package/es/actions/ui/test/slides.test.js +26 -0
- package/es/common/index.d.ts +0 -3
- package/es/common/index.js +0 -4
- package/es/index.js +1 -3
- package/es/reducers/data/index.d.ts +1 -1
- package/es/reducers/data/progression.d.ts +3 -3
- package/es/reducers/data/progression.js +2 -5
- package/es/reducers/data/slides.d.ts +2 -3
- package/es/reducers/data/test/progression.test.js +12 -27
- package/es/reducers/index.d.ts +2 -1
- package/es/reducers/ui/answers.d.ts +2 -2
- package/es/reducers/ui/answers.js +4 -8
- package/es/reducers/ui/index.d.ts +4 -1
- package/es/reducers/ui/index.js +3 -1
- package/es/reducers/ui/slide.d.ts +8 -0
- package/es/reducers/ui/slide.js +26 -0
- package/es/reducers/ui/test/answers.test.js +23 -3
- package/es/reducers/ui/test/current-slide-ref.test.js +1 -1
- package/es/reducers/ui/test/navigation.test.js +5 -5
- package/es/reducers/ui/test/slide.test.d.ts +1 -0
- package/es/reducers/ui/test/slide.test.js +12 -0
- package/es/test/util/services.mock.d.ts +3 -1
- package/es/test/util/services.mock.js +89 -72
- package/es/types/common.d.ts +0 -25
- package/es/views/skills/index.d.ts +1 -1
- package/es/views/skills/index.js +0 -3
- package/es/views/skills/test/skills.test.d.ts +1 -0
- package/es/views/skills/test/skills.test.js +94 -0
- package/es/views/slides/index.d.ts +13 -2
- package/es/views/slides/index.js +19 -15
- package/es/views/slides/map-api-slide-to-ui.js +65 -68
- package/es/views/slides/test/fixtures/free-text.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-drag.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-graphic.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm.d.ts +2 -1
- package/es/views/slides/test/fixtures/slider.d.ts +2 -1
- package/es/views/slides/test/fixtures/template.d.ts +4 -0
- package/{lib/views/slides/test/fixtures/select-template.js → es/views/slides/test/fixtures/template.js} +82 -4
- package/es/views/slides/test/index.test.d.ts +1 -0
- package/es/views/slides/test/index.test.js +473 -0
- package/es/views/slides/test/map-api-slide-to-ui.test.js +4 -10
- package/es/views/slides/test/slide.template.on-change.test.d.ts +1 -0
- package/es/views/slides/test/slide.template.on-change.test.js +79 -0
- package/lib/actions/api/fetch-skills.d.ts +3 -3
- package/lib/actions/api/fetch-skills.js +22 -19
- package/lib/actions/api/fetch-slide.d.ts +1 -1
- package/lib/actions/api/fetch-slide.js +3 -1
- package/lib/actions/api/post-answer.d.ts +14 -0
- package/lib/actions/api/post-answer.js +75 -0
- package/lib/actions/api/post-progression.d.ts +3 -3
- package/lib/actions/api/post-progression.js +6 -3
- package/lib/actions/api/test/fetch-skills.test.js +7 -4
- package/lib/actions/api/test/fetch-slide.test.js +7 -4
- package/lib/actions/api/test/post-answer.test.d.ts +1 -0
- package/lib/actions/api/test/post-answer.test.js +145 -0
- package/lib/actions/api/test/post-progression.test.js +7 -4
- package/lib/actions/data/test/token.test.d.ts +1 -0
- package/lib/actions/data/test/token.test.js +70 -0
- package/lib/actions/index.d.ts +1 -8
- package/lib/actions/{api/test → test}/create-test-store.d.ts +2 -2
- package/lib/actions/{api/test → test}/create-test-store.js +1 -1
- package/lib/actions/ui/answers.d.ts +17 -3
- package/lib/actions/ui/answers.js +50 -3
- package/lib/actions/ui/slides.d.ts +0 -5
- package/lib/actions/ui/slides.js +0 -4
- package/lib/actions/ui/test/answers.test.d.ts +1 -0
- package/lib/actions/ui/test/answers.test.js +190 -0
- package/lib/actions/ui/test/slides.test.d.ts +1 -0
- package/lib/actions/ui/test/slides.test.js +71 -0
- package/lib/common/index.d.ts +0 -3
- package/lib/common/index.js +0 -4
- package/lib/index.js +1 -3
- package/lib/reducers/data/index.d.ts +1 -1
- package/lib/reducers/data/progression.d.ts +3 -3
- package/lib/reducers/data/progression.js +2 -5
- package/lib/reducers/data/slides.d.ts +2 -3
- package/lib/reducers/data/test/progression.test.js +12 -27
- package/lib/reducers/index.d.ts +2 -1
- package/lib/reducers/ui/answers.d.ts +2 -2
- package/lib/reducers/ui/answers.js +4 -8
- package/lib/reducers/ui/index.d.ts +4 -1
- package/lib/reducers/ui/index.js +3 -1
- package/lib/reducers/ui/slide.d.ts +8 -0
- package/lib/reducers/ui/slide.js +27 -0
- package/lib/reducers/ui/test/answers.test.js +23 -3
- package/lib/reducers/ui/test/current-slide-ref.test.js +1 -1
- package/lib/reducers/ui/test/navigation.test.js +5 -5
- package/lib/reducers/ui/test/slide.test.d.ts +1 -0
- package/lib/reducers/ui/test/slide.test.js +12 -0
- package/lib/test/util/services.mock.d.ts +3 -1
- package/lib/test/util/services.mock.js +89 -72
- package/lib/types/common.d.ts +0 -25
- package/lib/views/skills/index.d.ts +1 -1
- package/lib/views/skills/index.js +0 -3
- package/lib/views/skills/test/skills.test.d.ts +1 -0
- package/lib/views/skills/test/skills.test.js +94 -0
- package/lib/views/slides/index.d.ts +13 -2
- package/lib/views/slides/index.js +19 -15
- package/lib/views/slides/map-api-slide-to-ui.js +106 -99
- package/lib/views/slides/test/fixtures/free-text.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-drag.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm.d.ts +2 -1
- package/lib/views/slides/test/fixtures/slider.d.ts +2 -1
- package/lib/views/slides/test/fixtures/template.d.ts +4 -0
- package/{es/views/slides/test/fixtures/select-template.js → lib/views/slides/test/fixtures/template.js} +82 -4
- package/lib/views/slides/test/index.test.d.ts +1 -0
- package/lib/views/slides/test/index.test.js +473 -0
- package/lib/views/slides/test/map-api-slide-to-ui.test.js +4 -10
- package/lib/views/slides/test/slide.template.on-change.test.d.ts +1 -0
- package/lib/views/slides/test/slide.template.on-change.test.js +82 -0
- package/package.json +6 -5
- package/src/actions/api/fetch-skills.ts +18 -11
- package/src/actions/api/fetch-slide.ts +3 -1
- package/src/actions/api/post-answer.ts +44 -0
- package/src/actions/api/post-progression.ts +7 -4
- package/src/actions/api/test/fetch-skills.test.ts +9 -6
- package/src/actions/api/test/fetch-slide.test.ts +9 -6
- package/src/actions/api/test/post-answer.test.ts +101 -0
- package/src/actions/api/test/post-progression.test.ts +9 -6
- package/src/actions/data/test/token.test.ts +29 -0
- package/src/actions/index.ts +1 -17
- package/src/actions/{api/test → test}/create-test-store.ts +2 -2
- package/src/actions/ui/answers.ts +55 -6
- package/src/actions/ui/slides.ts +1 -8
- package/src/actions/ui/test/answers.test.ts +115 -0
- package/src/actions/ui/test/slides.test.ts +30 -0
- package/src/common/index.ts +0 -7
- package/src/index.tsx +1 -3
- package/src/reducers/data/progression.ts +4 -7
- package/src/reducers/data/slides.ts +2 -3
- package/src/reducers/data/test/progression.test.ts +15 -31
- package/src/reducers/ui/answers.ts +5 -9
- package/src/reducers/ui/index.ts +4 -1
- package/src/reducers/ui/slide.ts +43 -0
- package/src/reducers/ui/test/answers.test.ts +29 -4
- package/src/reducers/ui/test/current-slide-ref.test.ts +1 -1
- package/src/reducers/ui/test/navigation.test.ts +5 -5
- package/src/reducers/ui/test/slide.test.ts +15 -0
- package/src/test/util/services.mock.ts +94 -73
- package/src/types/common.ts +0 -30
- package/src/views/skills/index.ts +1 -5
- package/src/views/skills/test/skills.test.ts +101 -0
- package/src/views/slides/index.ts +38 -23
- package/src/views/slides/map-api-slide-to-ui.ts +146 -113
- package/src/views/slides/test/fixtures/free-text.ts +2 -1
- package/src/views/slides/test/fixtures/qcm-drag.ts +2 -1
- package/src/views/slides/test/fixtures/qcm-graphic.ts +2 -1
- package/src/views/slides/test/fixtures/qcm.ts +2 -1
- package/src/views/slides/test/fixtures/slider.ts +2 -1
- package/src/views/slides/test/fixtures/{select-template.ts → template.ts} +84 -5
- package/src/views/slides/test/index.test.ts +493 -0
- package/src/views/slides/test/map-api-slide-to-ui.test.ts +6 -11
- package/src/views/slides/test/slide.template.on-change.test.ts +92 -0
- package/es/fixtures/qcm-slide.d.ts +0 -2
- package/es/fixtures/qcm-slide.js +0 -33
- package/es/fixtures/temp-fixture.d.ts +0 -3
- package/es/fixtures/temp-fixture.js +0 -84
- package/es/views/slides/test/fixtures/select-template.d.ts +0 -3
- package/es/views/slides/test/fixtures/text-template.d.ts +0 -3
- package/es/views/slides/test/fixtures/text-template.js +0 -58
- package/lib/fixtures/qcm-slide.d.ts +0 -2
- package/lib/fixtures/qcm-slide.js +0 -33
- package/lib/fixtures/temp-fixture.d.ts +0 -3
- package/lib/fixtures/temp-fixture.js +0 -84
- package/lib/views/slides/test/fixtures/select-template.d.ts +0 -3
- package/lib/views/slides/test/fixtures/text-template.d.ts +0 -3
- package/lib/views/slides/test/fixtures/text-template.js +0 -58
- package/src/fixtures/qcm-slide.ts +0 -35
- package/src/fixtures/temp-fixture.ts +0 -94
- package/src/views/slides/test/fixtures/text-template.ts +0 -61
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import identity from 'lodash/fp/identity';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import { mapStateToSlidesProps } from '..';
|
|
5
|
+
import { freeTextSlide } from './fixtures/free-text';
|
|
6
|
+
test('should create initial props when fetched slide is still not received', t => {
|
|
7
|
+
const state = {
|
|
8
|
+
data: {
|
|
9
|
+
progression: {
|
|
10
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
11
|
+
content: {
|
|
12
|
+
ref: '_skillref',
|
|
13
|
+
type: 'skill'
|
|
14
|
+
},
|
|
15
|
+
engine: {
|
|
16
|
+
ref: 'review'
|
|
17
|
+
},
|
|
18
|
+
state: {
|
|
19
|
+
allAnswers: [],
|
|
20
|
+
isCorrect: true,
|
|
21
|
+
nextContent: {
|
|
22
|
+
ref: 'sli_N1XACJobn',
|
|
23
|
+
type: 'slide'
|
|
24
|
+
},
|
|
25
|
+
pendingSlides: [],
|
|
26
|
+
slides: [],
|
|
27
|
+
step: {
|
|
28
|
+
current: 1
|
|
29
|
+
},
|
|
30
|
+
stars: 0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
skills: [],
|
|
34
|
+
slides: {
|
|
35
|
+
sli_N1XACJobn: null
|
|
36
|
+
},
|
|
37
|
+
token: '1234'
|
|
38
|
+
},
|
|
39
|
+
ui: {
|
|
40
|
+
currentSlideRef: '',
|
|
41
|
+
navigation: ['loader', 'slides'],
|
|
42
|
+
answers: [],
|
|
43
|
+
slide: {
|
|
44
|
+
validateButton: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const props = mapStateToSlidesProps(state, identity);
|
|
49
|
+
t.is(props.congratsProps, undefined);
|
|
50
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
51
|
+
'aria-label': 'aria-header-wrapper',
|
|
52
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
53
|
+
mode: '__revision_mode',
|
|
54
|
+
skillName: '__agility',
|
|
55
|
+
steps: [
|
|
56
|
+
{
|
|
57
|
+
current: true,
|
|
58
|
+
icon: 'no-answer',
|
|
59
|
+
value: '1'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
current: false,
|
|
63
|
+
icon: 'no-answer',
|
|
64
|
+
value: '2'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
current: false,
|
|
68
|
+
icon: 'no-answer',
|
|
69
|
+
value: '3'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
current: false,
|
|
73
|
+
icon: 'no-answer',
|
|
74
|
+
value: '4'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
current: false,
|
|
78
|
+
icon: 'no-answer',
|
|
79
|
+
value: '5'
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
t.deepEqual(omit(['validateButton'], props.stack), {
|
|
84
|
+
correctionPopinProps: undefined,
|
|
85
|
+
endReview: false,
|
|
86
|
+
slides: {
|
|
87
|
+
'0': {
|
|
88
|
+
hidden: false,
|
|
89
|
+
position: 0,
|
|
90
|
+
loading: true
|
|
91
|
+
},
|
|
92
|
+
'1': {
|
|
93
|
+
hidden: false,
|
|
94
|
+
position: 1,
|
|
95
|
+
loading: true
|
|
96
|
+
},
|
|
97
|
+
'2': {
|
|
98
|
+
hidden: false,
|
|
99
|
+
position: 2,
|
|
100
|
+
loading: true
|
|
101
|
+
},
|
|
102
|
+
'3': {
|
|
103
|
+
hidden: false,
|
|
104
|
+
position: 3,
|
|
105
|
+
loading: true
|
|
106
|
+
},
|
|
107
|
+
'4': {
|
|
108
|
+
hidden: false,
|
|
109
|
+
position: 4,
|
|
110
|
+
loading: true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
test('should create initial props when the slide is on the state', t => {
|
|
116
|
+
const state = {
|
|
117
|
+
data: {
|
|
118
|
+
progression: {
|
|
119
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
120
|
+
content: {
|
|
121
|
+
ref: '_skillref',
|
|
122
|
+
type: 'skill'
|
|
123
|
+
},
|
|
124
|
+
engine: {
|
|
125
|
+
ref: 'review'
|
|
126
|
+
},
|
|
127
|
+
state: {
|
|
128
|
+
allAnswers: [],
|
|
129
|
+
isCorrect: true,
|
|
130
|
+
nextContent: {
|
|
131
|
+
ref: 'sli_N1XACJobn',
|
|
132
|
+
type: 'slide'
|
|
133
|
+
},
|
|
134
|
+
pendingSlides: [],
|
|
135
|
+
slides: [],
|
|
136
|
+
step: {
|
|
137
|
+
current: 1
|
|
138
|
+
},
|
|
139
|
+
stars: 0
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
skills: [],
|
|
143
|
+
slides: {
|
|
144
|
+
sli_N1XACJobn: freeTextSlide
|
|
145
|
+
},
|
|
146
|
+
token: '1234'
|
|
147
|
+
},
|
|
148
|
+
ui: {
|
|
149
|
+
currentSlideRef: 'sli_N1XACJobn',
|
|
150
|
+
navigation: ['loader', 'slides'],
|
|
151
|
+
answers: ['My value'],
|
|
152
|
+
slide: {
|
|
153
|
+
validateButton: true
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const props = mapStateToSlidesProps(state, identity);
|
|
158
|
+
t.is(props.congratsProps, undefined);
|
|
159
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
160
|
+
'aria-label': 'aria-header-wrapper',
|
|
161
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
162
|
+
mode: '__revision_mode',
|
|
163
|
+
skillName: '__agility',
|
|
164
|
+
steps: [
|
|
165
|
+
{
|
|
166
|
+
current: true,
|
|
167
|
+
icon: 'no-answer',
|
|
168
|
+
value: '1'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
current: false,
|
|
172
|
+
icon: 'no-answer',
|
|
173
|
+
value: '2'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
current: false,
|
|
177
|
+
icon: 'no-answer',
|
|
178
|
+
value: '3'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
current: false,
|
|
182
|
+
icon: 'no-answer',
|
|
183
|
+
value: '4'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
current: false,
|
|
187
|
+
icon: 'no-answer',
|
|
188
|
+
value: '5'
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
|
|
193
|
+
correctionPopinProps: undefined,
|
|
194
|
+
endReview: false
|
|
195
|
+
});
|
|
196
|
+
t.false(props.stack.validateButton.disabled);
|
|
197
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
198
|
+
hidden: false,
|
|
199
|
+
position: 0,
|
|
200
|
+
loading: false,
|
|
201
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
202
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
203
|
+
});
|
|
204
|
+
t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
|
|
205
|
+
help: 'Type your answer.',
|
|
206
|
+
model: {
|
|
207
|
+
placeholder: 'Type here',
|
|
208
|
+
type: 'freeText',
|
|
209
|
+
value: 'My value'
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
t.deepEqual(omit(['0'], props.stack.slides), {
|
|
213
|
+
'1': {
|
|
214
|
+
hidden: false,
|
|
215
|
+
position: 1,
|
|
216
|
+
loading: true
|
|
217
|
+
},
|
|
218
|
+
'2': {
|
|
219
|
+
hidden: false,
|
|
220
|
+
position: 2,
|
|
221
|
+
loading: true
|
|
222
|
+
},
|
|
223
|
+
'3': {
|
|
224
|
+
hidden: false,
|
|
225
|
+
position: 3,
|
|
226
|
+
loading: true
|
|
227
|
+
},
|
|
228
|
+
'4': {
|
|
229
|
+
hidden: false,
|
|
230
|
+
position: 4,
|
|
231
|
+
loading: true
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
test('should create props when the next slide is on the state', t => {
|
|
236
|
+
const state = {
|
|
237
|
+
data: {
|
|
238
|
+
progression: {
|
|
239
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
240
|
+
content: {
|
|
241
|
+
ref: '_skill-ref',
|
|
242
|
+
type: 'skill'
|
|
243
|
+
},
|
|
244
|
+
engine: {
|
|
245
|
+
ref: 'review'
|
|
246
|
+
},
|
|
247
|
+
state: {
|
|
248
|
+
allAnswers: [
|
|
249
|
+
{
|
|
250
|
+
slideRef: 'sli_VJYjJnJhg',
|
|
251
|
+
isCorrect: true,
|
|
252
|
+
answer: ['Benchmark']
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
isCorrect: true,
|
|
256
|
+
nextContent: {
|
|
257
|
+
ref: 'sli_VkSQroQnx',
|
|
258
|
+
type: 'slide'
|
|
259
|
+
},
|
|
260
|
+
content: {
|
|
261
|
+
ref: 'sli_VJYjJnJhg',
|
|
262
|
+
type: 'slide'
|
|
263
|
+
},
|
|
264
|
+
pendingSlides: [],
|
|
265
|
+
slides: ['sli_VJYjJnJhg'],
|
|
266
|
+
step: {
|
|
267
|
+
current: 2
|
|
268
|
+
},
|
|
269
|
+
stars: 4
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
skills: [],
|
|
273
|
+
slides: {
|
|
274
|
+
sli_VJYjJnJhg: {
|
|
275
|
+
question: {
|
|
276
|
+
content: {
|
|
277
|
+
media: {
|
|
278
|
+
src: [],
|
|
279
|
+
posters: [],
|
|
280
|
+
subtitles: []
|
|
281
|
+
},
|
|
282
|
+
label: '',
|
|
283
|
+
placeholder: 'Type here',
|
|
284
|
+
id: 'sli_VJYjJnJhg.choice_1'
|
|
285
|
+
},
|
|
286
|
+
type: 'basic',
|
|
287
|
+
header: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?',
|
|
288
|
+
explanation: 'Type your answer.'
|
|
289
|
+
},
|
|
290
|
+
klf: '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.',
|
|
291
|
+
tips: 'According to Insee, Paris salaries are 20-25% higher compared with those of the provinces in 2015.',
|
|
292
|
+
universalRef: 'sli_VJYjJnJhg',
|
|
293
|
+
id: 'sli_VJYjJnJhg',
|
|
294
|
+
parentContentTitle: {
|
|
295
|
+
title: 'Developing the review app',
|
|
296
|
+
type: 'course'
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
sli_VkSQroQnx: {
|
|
300
|
+
question: {
|
|
301
|
+
content: {
|
|
302
|
+
media: {
|
|
303
|
+
src: [],
|
|
304
|
+
posters: [],
|
|
305
|
+
subtitles: []
|
|
306
|
+
},
|
|
307
|
+
choices: [
|
|
308
|
+
{
|
|
309
|
+
media: {
|
|
310
|
+
src: [
|
|
311
|
+
{
|
|
312
|
+
_id: '624efd915948a7013083e986',
|
|
313
|
+
mimeType: 'image/jpeg',
|
|
314
|
+
url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
|
|
315
|
+
id: '624efd915948a7013083e986'
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
posters: [],
|
|
319
|
+
subtitles: [],
|
|
320
|
+
type: 'img'
|
|
321
|
+
},
|
|
322
|
+
items: [],
|
|
323
|
+
_id: '624efd915948a7013083e985',
|
|
324
|
+
label: 'Vrai',
|
|
325
|
+
value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
|
|
326
|
+
id: '624efd915948a7013083e985'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
media: {
|
|
330
|
+
src: [
|
|
331
|
+
{
|
|
332
|
+
_id: '624efd915948a7013083e988',
|
|
333
|
+
mimeType: 'image/jpeg',
|
|
334
|
+
url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
|
|
335
|
+
id: '624efd915948a7013083e988'
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
posters: [],
|
|
339
|
+
subtitles: [],
|
|
340
|
+
type: 'img'
|
|
341
|
+
},
|
|
342
|
+
items: [],
|
|
343
|
+
_id: '624efd915948a7013083e987',
|
|
344
|
+
label: 'Faux',
|
|
345
|
+
value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
|
|
346
|
+
id: '624efd915948a7013083e987'
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
type: 'qcmGraphic',
|
|
351
|
+
header: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
|
|
352
|
+
explanation: 'Sélectionnez la bonne réponse.'
|
|
353
|
+
},
|
|
354
|
+
klf: "Il ne faut pas prendre la négociation comme une affaire personnelle, afin de rester centré sur son sujet. Mais cela ne signifie pas être dépourvu de toute émotion, car celles-ci peuvent être de vrais atouts. À condition de réussir à les exprimer sans accuser l'autre d'en être à l'origine.",
|
|
355
|
+
tips: "Pour gérer ses émotions, il faut d'abord les identifier, notamment en analysant ses ressentis physiques et en trouvant l'élément déclencheur.",
|
|
356
|
+
universalRef: 'sli_VkSQroQnx',
|
|
357
|
+
id: 'sli_VkSQroQnx',
|
|
358
|
+
parentContentTitle: {
|
|
359
|
+
title: 'Developing the review app',
|
|
360
|
+
type: 'course'
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
token: 'undefined'
|
|
365
|
+
},
|
|
366
|
+
ui: {
|
|
367
|
+
currentSlideRef: 'sli_VJYjJnJhg',
|
|
368
|
+
navigation: ['loader', 'slides'],
|
|
369
|
+
answers: ['My value'],
|
|
370
|
+
slide: {
|
|
371
|
+
validateButton: false
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
const props = mapStateToSlidesProps(state, identity);
|
|
376
|
+
t.is(props.congratsProps, undefined);
|
|
377
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
378
|
+
'aria-label': 'aria-header-wrapper',
|
|
379
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
380
|
+
mode: '__revision_mode',
|
|
381
|
+
skillName: '__agility',
|
|
382
|
+
steps: [
|
|
383
|
+
{
|
|
384
|
+
current: true,
|
|
385
|
+
icon: 'right',
|
|
386
|
+
value: '1'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
// FIX ME: update on PR -> https://trello.com/c/qOSDa8Fm/2715-app-review-props-dynamiques-pour-les-step-items-du-header-bas%C3%A9-sur-le-state
|
|
390
|
+
current: true,
|
|
391
|
+
icon: 'no-answer',
|
|
392
|
+
value: '2'
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
current: false,
|
|
396
|
+
icon: 'no-answer',
|
|
397
|
+
value: '3'
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
current: false,
|
|
401
|
+
icon: 'no-answer',
|
|
402
|
+
value: '4'
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
current: false,
|
|
406
|
+
icon: 'no-answer',
|
|
407
|
+
value: '5'
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
|
|
412
|
+
correctionPopinProps: undefined,
|
|
413
|
+
endReview: false
|
|
414
|
+
});
|
|
415
|
+
t.true(props.stack.validateButton.disabled);
|
|
416
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
417
|
+
hidden: false,
|
|
418
|
+
position: 0,
|
|
419
|
+
loading: false,
|
|
420
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
421
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
422
|
+
});
|
|
423
|
+
t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
|
|
424
|
+
help: 'Type your answer.',
|
|
425
|
+
model: {
|
|
426
|
+
placeholder: 'Type here',
|
|
427
|
+
type: 'freeText',
|
|
428
|
+
value: 'My value'
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
t.deepEqual(omit(['0', '1.answerUI.model.answers.0.onClick', '1.answerUI.model.answers.1.onClick'], props.stack.slides), {
|
|
432
|
+
'1': {
|
|
433
|
+
answerUI: {
|
|
434
|
+
help: 'Sélectionnez la bonne réponse.',
|
|
435
|
+
model: {
|
|
436
|
+
answers: [
|
|
437
|
+
{
|
|
438
|
+
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
|
|
439
|
+
selected: false,
|
|
440
|
+
title: 'Vrai'
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
|
|
444
|
+
selected: false,
|
|
445
|
+
title: 'Faux'
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
type: 'qcmGraphic'
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
hidden: false,
|
|
452
|
+
loading: false,
|
|
453
|
+
position: 1,
|
|
454
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
455
|
+
questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
|
|
456
|
+
},
|
|
457
|
+
'2': {
|
|
458
|
+
hidden: false,
|
|
459
|
+
position: 2,
|
|
460
|
+
loading: true
|
|
461
|
+
},
|
|
462
|
+
'3': {
|
|
463
|
+
hidden: false,
|
|
464
|
+
position: 3,
|
|
465
|
+
loading: true
|
|
466
|
+
},
|
|
467
|
+
'4': {
|
|
468
|
+
hidden: false,
|
|
469
|
+
position: 4,
|
|
470
|
+
loading: true
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
});
|
|
@@ -5,8 +5,7 @@ import { qcmUISlide, qcmSlide } from './fixtures/qcm';
|
|
|
5
5
|
import { qcmDragUISlide, qcmDragSlide } from './fixtures/qcm-drag';
|
|
6
6
|
import { freeTextSlide, freeTextUISlide } from './fixtures/free-text';
|
|
7
7
|
import { qcmGraphicUISlide, qcmGraphicSlide } from './fixtures/qcm-graphic';
|
|
8
|
-
import {
|
|
9
|
-
import { selectTemplateSlide, selectTemplateUISlide } from './fixtures/select-template';
|
|
8
|
+
import { templateSlide, templateUISlide } from './fixtures/template';
|
|
10
9
|
import { sliderSlide, sliderUISlide } from './fixtures/slider';
|
|
11
10
|
const _mapApiSlideToUi = mapApiSlideToUi(identity);
|
|
12
11
|
const macro = test.macro({
|
|
@@ -24,15 +23,10 @@ test('qcm graphic', macro, {
|
|
|
24
23
|
answers: [],
|
|
25
24
|
expectedUiSlide: qcmGraphicUISlide
|
|
26
25
|
});
|
|
27
|
-
test('
|
|
28
|
-
slide:
|
|
26
|
+
test('template', macro, {
|
|
27
|
+
slide: templateSlide,
|
|
29
28
|
answers: [],
|
|
30
|
-
expectedUiSlide:
|
|
31
|
-
});
|
|
32
|
-
test('select template', macro, {
|
|
33
|
-
slide: selectTemplateSlide,
|
|
34
|
-
answers: [],
|
|
35
|
-
expectedUiSlide: selectTemplateUISlide
|
|
29
|
+
expectedUiSlide: templateUISlide
|
|
36
30
|
});
|
|
37
31
|
test('free text', macro, { slide: freeTextSlide, answers: [], expectedUiSlide: freeTextUISlide });
|
|
38
32
|
test('slider', macro, { slide: sliderSlide, answers: [], expectedUiSlide: sliderUISlide });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import omit from 'lodash/fp/omit';
|
|
3
|
+
import get from 'lodash/fp/get';
|
|
4
|
+
import { mapStateToSlidesProps } from '..';
|
|
5
|
+
import { services } from '../../../test/util/services.mock';
|
|
6
|
+
import { createTestStore } from '../../../actions/test/create-test-store';
|
|
7
|
+
import { EDIT_TEMPLATE } from '../../../actions/ui/answers';
|
|
8
|
+
import { templateSlide } from './fixtures/template';
|
|
9
|
+
const progression = {
|
|
10
|
+
_id: '123456789123',
|
|
11
|
+
content: { type: 'skill', ref: '_skill-ref' },
|
|
12
|
+
engine: {
|
|
13
|
+
ref: 'review'
|
|
14
|
+
},
|
|
15
|
+
state: {
|
|
16
|
+
allAnswers: [],
|
|
17
|
+
isCorrect: true,
|
|
18
|
+
nextContent: {
|
|
19
|
+
ref: templateSlide.id,
|
|
20
|
+
type: 'slide'
|
|
21
|
+
},
|
|
22
|
+
pendingSlides: [],
|
|
23
|
+
slides: [],
|
|
24
|
+
step: {
|
|
25
|
+
current: 1
|
|
26
|
+
},
|
|
27
|
+
stars: 0
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const initialState = {
|
|
31
|
+
data: {
|
|
32
|
+
progression,
|
|
33
|
+
slides: {
|
|
34
|
+
[templateSlide.id]: templateSlide
|
|
35
|
+
},
|
|
36
|
+
skills: [],
|
|
37
|
+
token: '1234'
|
|
38
|
+
},
|
|
39
|
+
ui: {
|
|
40
|
+
currentSlideRef: templateSlide.id,
|
|
41
|
+
navigation: ['skills', 'slides'],
|
|
42
|
+
answers: [],
|
|
43
|
+
slide: {
|
|
44
|
+
validateButton: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Text slide', t => {
|
|
49
|
+
t.plan(2);
|
|
50
|
+
const expectedActions = [{ type: EDIT_TEMPLATE, payload: ['', 'test', ''] }];
|
|
51
|
+
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
52
|
+
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
53
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
54
|
+
hidden: false,
|
|
55
|
+
position: 0,
|
|
56
|
+
loading: false,
|
|
57
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
58
|
+
questionText: 'Complétez la phrase ci-dessous.'
|
|
59
|
+
});
|
|
60
|
+
const SlideProps = props.stack.slides['0'].answerUI?.model;
|
|
61
|
+
const onChange = get(['1', 'onChange'], SlideProps.answers);
|
|
62
|
+
onChange('test');
|
|
63
|
+
});
|
|
64
|
+
test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Select slide', t => {
|
|
65
|
+
t.plan(2);
|
|
66
|
+
const expectedActions = [{ type: EDIT_TEMPLATE, payload: ['Catalogue', '', ''] }];
|
|
67
|
+
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
68
|
+
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
69
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
70
|
+
hidden: false,
|
|
71
|
+
position: 0,
|
|
72
|
+
loading: false,
|
|
73
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
74
|
+
questionText: 'Complétez la phrase ci-dessous.'
|
|
75
|
+
});
|
|
76
|
+
const SlideProps = props.stack.slides['0'].answerUI?.model;
|
|
77
|
+
const onChange = get(['0', 'onChange'], SlideProps.answers);
|
|
78
|
+
onChange('Catalogue');
|
|
79
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Dispatch } from 'redux';
|
|
1
|
+
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import { Options, Skill } from '../../types/common';
|
|
3
|
+
import type { Options, Skill } from '../../types/common';
|
|
4
4
|
export declare const SKILLS_FETCH_REQUEST: "@@skills/FETCH_REQUEST";
|
|
5
5
|
export declare const SKILLS_FETCH_SUCCESS: "@@skills/FETCH_SUCCESS";
|
|
6
6
|
export declare const SKILLS_FETCH_FAILURE: "@@skills/FETCH_FAILURE";
|
|
@@ -8,4 +8,4 @@ export declare type ReceivedSkills = {
|
|
|
8
8
|
type: '@@skills/FETCH_SUCCESS';
|
|
9
9
|
payload: Skill[];
|
|
10
10
|
};
|
|
11
|
-
export declare const fetchSkills: (
|
|
11
|
+
export declare const fetchSkills: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => Promise<void>;
|
|
@@ -35,27 +35,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import buildTask from '@coorpacademy/redux-task';
|
|
38
|
+
import get from 'lodash/fp/get';
|
|
38
39
|
export var SKILLS_FETCH_REQUEST = '@@skills/FETCH_REQUEST';
|
|
39
40
|
export var SKILLS_FETCH_SUCCESS = '@@skills/FETCH_SUCCESS';
|
|
40
41
|
export var SKILLS_FETCH_FAILURE = '@@skills/FETCH_FAILURE';
|
|
41
|
-
export var fetchSkills = function (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
export var fetchSkills = function (dispatch, getState, _a) {
|
|
43
|
+
var services = _a.services;
|
|
44
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var action;
|
|
46
|
+
return __generator(this, function (_b) {
|
|
47
|
+
switch (_b.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
action = buildTask({
|
|
50
|
+
types: [SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS, SKILLS_FETCH_FAILURE],
|
|
51
|
+
task: function () {
|
|
52
|
+
var state = getState();
|
|
53
|
+
var token = get('data.token', state);
|
|
54
|
+
return services.fetchSkills(token);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return [4 /*yield*/, dispatch(action)];
|
|
58
|
+
case 1:
|
|
59
|
+
_b.sent();
|
|
60
|
+
return [2 /*return*/];
|
|
61
|
+
}
|
|
59
62
|
});
|
|
60
|
-
};
|
|
63
|
+
});
|
|
61
64
|
};
|
|
@@ -17,4 +17,4 @@ export declare type ReceivedSlide = {
|
|
|
17
17
|
slideRef: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare const fetchSlide: (slideRef: string
|
|
20
|
+
export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => Promise<void>;
|
|
@@ -42,7 +42,7 @@ import { setCurrentSlide } from '../ui/slides';
|
|
|
42
42
|
export var SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
|
|
43
43
|
export var SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
|
|
44
44
|
export var SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
|
|
45
|
-
export var fetchSlide = function (slideRef
|
|
45
|
+
export var fetchSlide = function (slideRef) {
|
|
46
46
|
return function (dispatch, getState, _a) {
|
|
47
47
|
var services = _a.services;
|
|
48
48
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -56,6 +56,8 @@ export var fetchSlide = function (slideRef, token) {
|
|
|
56
56
|
return has("data.slide.".concat(slideRef), state);
|
|
57
57
|
},
|
|
58
58
|
task: function () {
|
|
59
|
+
var state = getState();
|
|
60
|
+
var token = get('data.token', state);
|
|
59
61
|
return services.fetchSlide(slideRef, token);
|
|
60
62
|
},
|
|
61
63
|
meta: { slideRef: slideRef }
|