@inseefr/lunatic 0.3.4-experimental → 0.3.7-experimental
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/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/breadcrumb/component.js +29 -29
- package/src/components/button/component.js +53 -53
- package/src/components/button/index.js +1 -1
- package/src/components/checkbox/index.js +3 -3
- package/src/components/datepicker/index.js +1 -1
- package/src/components/declarations/index.js +1 -1
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -232
- package/src/components/filter-description/component.js +42 -42
- package/src/components/icon/component.js +33 -33
- package/src/components/index.js +2 -0
- package/src/components/input/index.js +2 -2
- package/src/components/loop/index.js +1 -1
- package/src/components/loop-constructor/wrapper/body-component.js +13 -1
- package/src/components/radio/index.js +1 -1
- package/src/components/sequence/index.js +1 -1
- package/src/components/subsequence/index.js +1 -1
- package/src/components/suggester/check-store.js +70 -70
- package/src/components/suggester/components/create-on-keydown-callback.js +28 -28
- package/src/components/tooltip/response.js +52 -52
- package/src/stories/checkbox-boolean/data-forced.json +48 -48
- package/src/stories/checkbox-group/data-vtl.json +102 -102
- package/src/stories/icons/icons.stories.js +16 -16
- package/src/stories/questionnaire/kish.json +275 -0
- package/src/stories/questionnaire/questionnaire.stories.js +12 -0
- package/src/stories/utils/custom-lunatic.scss +23 -23
- package/src/tests/components/breadcrumb.spec.js +13 -13
- package/src/tests/components/button.spec.js +11 -11
- package/src/tests/components/checkbox-boolean.spec.js +45 -45
- package/src/tests/components/checkbox-group.spec.js +53 -53
- package/src/tests/components/checkbox-one.spec.js +32 -32
- package/src/tests/components/datepicker.spec.js +22 -22
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -67
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -52
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -21
- package/src/tests/components/declarations.spec.js +46 -46
- package/src/tests/components/input.spec.js +18 -18
- package/src/tests/components/loops/loop-static.json +66 -66
- package/src/tests/components/loops/loop.json +258 -258
- package/src/tests/components/loops/loop.spec.js +30 -30
- package/src/tests/components/loops/roster-for-loop.spec.js +18 -18
- package/src/tests/components/progress-bar.spec.js +15 -15
- package/src/tests/components/radio.spec.js +27 -27
- package/src/tests/components/sequence.spec.js +9 -9
- package/src/tests/components/subsequence.spec.js +9 -9
- package/src/tests/components/table.spec.js +11 -11
- package/src/tests/components/textarea.spec.js +18 -18
- package/src/tests/components/tooltip.spec.js +25 -25
- package/src/tests/setup/setupTests.js +4 -4
- package/src/tests/utils/lib/alphabet.spec.js +36 -36
- package/src/tests/utils/lib/array.spec.js +22 -22
- package/src/tests/utils/lib/checkbox/group.spec.js +72 -72
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +12 -12
- package/src/tests/utils/lib/input-number.spec.js +18 -18
- package/src/tests/utils/lib/items-positioning.spec.js +17 -17
- package/src/tests/utils/lib/label-position.spec.js +22 -22
- package/src/tests/utils/lib/loops/bindings.spec.js +75 -75
- package/src/tests/utils/lib/loops/shared.spec.js +82 -82
- package/src/tests/utils/lib/missing/missing.spec.js +74 -74
- package/src/tests/utils/lib/missing/mock.js +137 -137
- package/src/tests/utils/lib/pagination/shared.spec.js +42 -42
- package/src/tests/utils/lib/responses.spec.js +64 -64
- package/src/tests/utils/lib/style.spec.js +26 -26
- package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -95
- package/src/tests/utils/lib/tooltip/content.spec.js +109 -109
- package/src/tests/utils/to-expose/handler/handler.spec.js +94 -94
- package/src/tests/utils/to-expose/handler/questionnaire.json +158 -158
- package/src/tests/utils/to-expose/handler/results/index.js +6 -6
- package/src/tests/utils/to-expose/handler/results/res-double.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -158
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +46 -46
- package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -12
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -19
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -48
- package/src/tests/utils/to-expose/state/questionnaire.json +61 -61
- package/src/tests/utils/to-expose/state/results.js +78 -78
- package/src/utils/lib/tooltip/build-response.js +41 -41
- package/src/utils/store-tools/create/index.js +1 -1
- package/src/utils/store-tools/create/update-store-info.js +26 -26
- package/src/utils/store-tools/index.js +5 -5
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildMultiTooltipResponse,
|
|
3
|
-
buildBooleanTooltipResponse,
|
|
4
|
-
} from 'utils/lib';
|
|
5
|
-
|
|
6
|
-
const options = [
|
|
7
|
-
{ value: '1', label: 'Yes' },
|
|
8
|
-
{ value: '0', label: 'No' },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
const responseNull = {
|
|
12
|
-
name: 'Response',
|
|
13
|
-
values: {
|
|
14
|
-
PREVIOUS: null,
|
|
15
|
-
COLLECTED: null,
|
|
16
|
-
FORCED: null,
|
|
17
|
-
EDITED: null,
|
|
18
|
-
INPUTED: null,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const response = {
|
|
23
|
-
name: 'Response',
|
|
24
|
-
values: {
|
|
25
|
-
PREVIOUS: null,
|
|
26
|
-
COLLECTED: '1',
|
|
27
|
-
FORCED: '0',
|
|
28
|
-
EDITED: '1',
|
|
29
|
-
INPUTED: null,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const finalResponse = {
|
|
34
|
-
name: 'Response',
|
|
35
|
-
values: {
|
|
36
|
-
PREVIOUS: null,
|
|
37
|
-
COLLECTED: 'Yes',
|
|
38
|
-
FORCED: 'No',
|
|
39
|
-
EDITED: 'Yes',
|
|
40
|
-
INPUTED: null,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const booleanResponse = {
|
|
45
|
-
name: 'Response',
|
|
46
|
-
values: {
|
|
47
|
-
PREVIOUS: null,
|
|
48
|
-
COLLECTED: true,
|
|
49
|
-
FORCED: false,
|
|
50
|
-
EDITED: true,
|
|
51
|
-
INPUTED: null,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const booleanFinalResponse = {
|
|
56
|
-
name: 'Response',
|
|
57
|
-
values: {
|
|
58
|
-
PREVIOUS: null,
|
|
59
|
-
COLLECTED: 'Vrai',
|
|
60
|
-
FORCED: 'Faux',
|
|
61
|
-
EDITED: 'Vrai',
|
|
62
|
-
INPUTED: null,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
describe('build response', () => {
|
|
67
|
-
describe('buildMultiTooltipResponse', () => {
|
|
68
|
-
it('should return default value', () => {
|
|
69
|
-
expect(buildMultiTooltipResponse()()).toEqual({});
|
|
70
|
-
});
|
|
71
|
-
it('should return same response', () => {
|
|
72
|
-
expect(buildMultiTooltipResponse(options)(responseNull)).toEqual(
|
|
73
|
-
responseNull
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
it('should return updated response', () => {
|
|
77
|
-
expect(buildMultiTooltipResponse(options)(response)).toEqual(
|
|
78
|
-
finalResponse
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
describe('buildBooleanTooltipResponse', () => {
|
|
83
|
-
it('should return default value', () => {
|
|
84
|
-
expect(buildBooleanTooltipResponse()).toEqual({});
|
|
85
|
-
});
|
|
86
|
-
it('should return same response', () => {
|
|
87
|
-
expect(buildBooleanTooltipResponse(responseNull)).toEqual(responseNull);
|
|
88
|
-
});
|
|
89
|
-
it('should return updated response', () => {
|
|
90
|
-
expect(buildBooleanTooltipResponse(booleanResponse)).toEqual(
|
|
91
|
-
booleanFinalResponse
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
buildMultiTooltipResponse,
|
|
3
|
+
buildBooleanTooltipResponse,
|
|
4
|
+
} from 'utils/lib';
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
{ value: '1', label: 'Yes' },
|
|
8
|
+
{ value: '0', label: 'No' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const responseNull = {
|
|
12
|
+
name: 'Response',
|
|
13
|
+
values: {
|
|
14
|
+
PREVIOUS: null,
|
|
15
|
+
COLLECTED: null,
|
|
16
|
+
FORCED: null,
|
|
17
|
+
EDITED: null,
|
|
18
|
+
INPUTED: null,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const response = {
|
|
23
|
+
name: 'Response',
|
|
24
|
+
values: {
|
|
25
|
+
PREVIOUS: null,
|
|
26
|
+
COLLECTED: '1',
|
|
27
|
+
FORCED: '0',
|
|
28
|
+
EDITED: '1',
|
|
29
|
+
INPUTED: null,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const finalResponse = {
|
|
34
|
+
name: 'Response',
|
|
35
|
+
values: {
|
|
36
|
+
PREVIOUS: null,
|
|
37
|
+
COLLECTED: 'Yes',
|
|
38
|
+
FORCED: 'No',
|
|
39
|
+
EDITED: 'Yes',
|
|
40
|
+
INPUTED: null,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const booleanResponse = {
|
|
45
|
+
name: 'Response',
|
|
46
|
+
values: {
|
|
47
|
+
PREVIOUS: null,
|
|
48
|
+
COLLECTED: true,
|
|
49
|
+
FORCED: false,
|
|
50
|
+
EDITED: true,
|
|
51
|
+
INPUTED: null,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const booleanFinalResponse = {
|
|
56
|
+
name: 'Response',
|
|
57
|
+
values: {
|
|
58
|
+
PREVIOUS: null,
|
|
59
|
+
COLLECTED: 'Vrai',
|
|
60
|
+
FORCED: 'Faux',
|
|
61
|
+
EDITED: 'Vrai',
|
|
62
|
+
INPUTED: null,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
describe('build response', () => {
|
|
67
|
+
describe('buildMultiTooltipResponse', () => {
|
|
68
|
+
it('should return default value', () => {
|
|
69
|
+
expect(buildMultiTooltipResponse()()).toEqual({});
|
|
70
|
+
});
|
|
71
|
+
it('should return same response', () => {
|
|
72
|
+
expect(buildMultiTooltipResponse(options)(responseNull)).toEqual(
|
|
73
|
+
responseNull
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
it('should return updated response', () => {
|
|
77
|
+
expect(buildMultiTooltipResponse(options)(response)).toEqual(
|
|
78
|
+
finalResponse
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('buildBooleanTooltipResponse', () => {
|
|
83
|
+
it('should return default value', () => {
|
|
84
|
+
expect(buildBooleanTooltipResponse()).toEqual({});
|
|
85
|
+
});
|
|
86
|
+
it('should return same response', () => {
|
|
87
|
+
expect(buildBooleanTooltipResponse(responseNull)).toEqual(responseNull);
|
|
88
|
+
});
|
|
89
|
+
it('should return updated response', () => {
|
|
90
|
+
expect(buildBooleanTooltipResponse(booleanResponse)).toEqual(
|
|
91
|
+
booleanFinalResponse
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { buildTooltip } from 'utils/lib';
|
|
2
|
-
|
|
3
|
-
describe('build tooltip content', () => {
|
|
4
|
-
describe('buildTooltip', () => {
|
|
5
|
-
it('should return default value', () => {
|
|
6
|
-
expect(buildTooltip()).toEqual({});
|
|
7
|
-
expect(buildTooltip({ values: {} })).toEqual({});
|
|
8
|
-
expect(
|
|
9
|
-
buildTooltip({
|
|
10
|
-
values: { COLLECTED: 'Collected' },
|
|
11
|
-
})
|
|
12
|
-
).toEqual({});
|
|
13
|
-
});
|
|
14
|
-
it('should return COLLECTED', () => {
|
|
15
|
-
expect(
|
|
16
|
-
buildTooltip({
|
|
17
|
-
values: { COLLECTED: 'Collected', FORCED: 'Forced' },
|
|
18
|
-
})
|
|
19
|
-
).toEqual({
|
|
20
|
-
content: [
|
|
21
|
-
{
|
|
22
|
-
key: 'Brute',
|
|
23
|
-
value: 'Collected',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
imgName: 'forcedImg',
|
|
27
|
-
});
|
|
28
|
-
expect(
|
|
29
|
-
buildTooltip({
|
|
30
|
-
values: { COLLECTED: null, FORCED: 'Forced' },
|
|
31
|
-
})
|
|
32
|
-
).toEqual({
|
|
33
|
-
content: [
|
|
34
|
-
{
|
|
35
|
-
key: 'Brute',
|
|
36
|
-
value: ' - ',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
imgName: 'forcedImg',
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
it('should return COLLECTED FORCED', () => {
|
|
43
|
-
expect(
|
|
44
|
-
buildTooltip({
|
|
45
|
-
values: {
|
|
46
|
-
COLLECTED: 'Collected',
|
|
47
|
-
FORCED: 'Forced',
|
|
48
|
-
EDITED: 'Edited',
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
).toEqual({
|
|
52
|
-
content: [
|
|
53
|
-
{
|
|
54
|
-
key: 'Brute',
|
|
55
|
-
value: 'Collected',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
key: 'Correction automatique',
|
|
59
|
-
value: 'Forced',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
imgName: 'editedImg',
|
|
63
|
-
});
|
|
64
|
-
expect(
|
|
65
|
-
buildTooltip({
|
|
66
|
-
values: { COLLECTED: null, FORCED: null, EDITED: 'Edited' },
|
|
67
|
-
})
|
|
68
|
-
).toEqual({
|
|
69
|
-
content: [
|
|
70
|
-
{
|
|
71
|
-
key: 'Brute',
|
|
72
|
-
value: ' - ',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
imgName: 'editedImg',
|
|
76
|
-
});
|
|
77
|
-
expect(
|
|
78
|
-
buildTooltip({
|
|
79
|
-
values: { COLLECTED: 'Collected', FORCED: null, EDITED: 'Edited' },
|
|
80
|
-
})
|
|
81
|
-
).toEqual({
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
key: 'Brute',
|
|
85
|
-
value: 'Collected',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
imgName: 'editedImg',
|
|
89
|
-
});
|
|
90
|
-
expect(
|
|
91
|
-
buildTooltip({
|
|
92
|
-
values: { COLLECTED: null, FORCED: 'Forced', EDITED: 'Edited' },
|
|
93
|
-
})
|
|
94
|
-
).toEqual({
|
|
95
|
-
content: [
|
|
96
|
-
{
|
|
97
|
-
key: 'Brute',
|
|
98
|
-
value: ' - ',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
key: 'Correction automatique',
|
|
102
|
-
value: 'Forced',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
imgName: 'editedImg',
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
1
|
+
import { buildTooltip } from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
describe('build tooltip content', () => {
|
|
4
|
+
describe('buildTooltip', () => {
|
|
5
|
+
it('should return default value', () => {
|
|
6
|
+
expect(buildTooltip()).toEqual({});
|
|
7
|
+
expect(buildTooltip({ values: {} })).toEqual({});
|
|
8
|
+
expect(
|
|
9
|
+
buildTooltip({
|
|
10
|
+
values: { COLLECTED: 'Collected' },
|
|
11
|
+
})
|
|
12
|
+
).toEqual({});
|
|
13
|
+
});
|
|
14
|
+
it('should return COLLECTED', () => {
|
|
15
|
+
expect(
|
|
16
|
+
buildTooltip({
|
|
17
|
+
values: { COLLECTED: 'Collected', FORCED: 'Forced' },
|
|
18
|
+
})
|
|
19
|
+
).toEqual({
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
key: 'Brute',
|
|
23
|
+
value: 'Collected',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
imgName: 'forcedImg',
|
|
27
|
+
});
|
|
28
|
+
expect(
|
|
29
|
+
buildTooltip({
|
|
30
|
+
values: { COLLECTED: null, FORCED: 'Forced' },
|
|
31
|
+
})
|
|
32
|
+
).toEqual({
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
key: 'Brute',
|
|
36
|
+
value: ' - ',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
imgName: 'forcedImg',
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
it('should return COLLECTED FORCED', () => {
|
|
43
|
+
expect(
|
|
44
|
+
buildTooltip({
|
|
45
|
+
values: {
|
|
46
|
+
COLLECTED: 'Collected',
|
|
47
|
+
FORCED: 'Forced',
|
|
48
|
+
EDITED: 'Edited',
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
).toEqual({
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
key: 'Brute',
|
|
55
|
+
value: 'Collected',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: 'Correction automatique',
|
|
59
|
+
value: 'Forced',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
imgName: 'editedImg',
|
|
63
|
+
});
|
|
64
|
+
expect(
|
|
65
|
+
buildTooltip({
|
|
66
|
+
values: { COLLECTED: null, FORCED: null, EDITED: 'Edited' },
|
|
67
|
+
})
|
|
68
|
+
).toEqual({
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
key: 'Brute',
|
|
72
|
+
value: ' - ',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
imgName: 'editedImg',
|
|
76
|
+
});
|
|
77
|
+
expect(
|
|
78
|
+
buildTooltip({
|
|
79
|
+
values: { COLLECTED: 'Collected', FORCED: null, EDITED: 'Edited' },
|
|
80
|
+
})
|
|
81
|
+
).toEqual({
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
key: 'Brute',
|
|
85
|
+
value: 'Collected',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
imgName: 'editedImg',
|
|
89
|
+
});
|
|
90
|
+
expect(
|
|
91
|
+
buildTooltip({
|
|
92
|
+
values: { COLLECTED: null, FORCED: 'Forced', EDITED: 'Edited' },
|
|
93
|
+
})
|
|
94
|
+
).toEqual({
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
key: 'Brute',
|
|
98
|
+
value: ' - ',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'Correction automatique',
|
|
102
|
+
value: 'Forced',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
imgName: 'editedImg',
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import * as H from 'utils/to-expose/handler';
|
|
2
|
-
import questionnaire from './questionnaire';
|
|
3
|
-
import * as R from './results';
|
|
4
|
-
|
|
5
|
-
describe('handler', () => {
|
|
6
|
-
describe('updateQuestionnaire', () => {
|
|
7
|
-
it('should return empty object', () => {
|
|
8
|
-
expect(H.updateQuestionnaire('')({})([])()).toEqual({});
|
|
9
|
-
});
|
|
10
|
-
it('should return empty initial questionnaire', () => {
|
|
11
|
-
expect(H.updateQuestionnaire('')(questionnaire)([])()).toEqual(
|
|
12
|
-
questionnaire
|
|
13
|
-
);
|
|
14
|
-
expect(
|
|
15
|
-
H.updateQuestionnaire('EDITED')({})(['COLLECTED', 'EDITED'])({
|
|
16
|
-
inputOk: 'My input',
|
|
17
|
-
})
|
|
18
|
-
).toEqual({});
|
|
19
|
-
expect(
|
|
20
|
-
H.updateQuestionnaire('EDITED')(questionnaire)(['COLLECTED', 'EDITED'])(
|
|
21
|
-
{
|
|
22
|
-
inputOk: 'My input',
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
).toEqual(questionnaire);
|
|
26
|
-
expect(
|
|
27
|
-
H.updateQuestionnaire('EDITED')(questionnaire)([
|
|
28
|
-
'COLLECTED',
|
|
29
|
-
'FORCED',
|
|
30
|
-
'EDITED',
|
|
31
|
-
])({
|
|
32
|
-
inputOk: 'My input',
|
|
33
|
-
})
|
|
34
|
-
).toEqual(questionnaire);
|
|
35
|
-
expect(
|
|
36
|
-
H.updateQuestionnaire('FORCED')(questionnaire)(['COLLECTED', 'FORCED'])(
|
|
37
|
-
{
|
|
38
|
-
check2: true,
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
).toEqual(questionnaire);
|
|
42
|
-
});
|
|
43
|
-
it('should return an updated questionnaire with response component', () => {
|
|
44
|
-
expect(
|
|
45
|
-
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
46
|
-
inputOk: 'My new input',
|
|
47
|
-
})
|
|
48
|
-
).toEqual(R.resInputCollected);
|
|
49
|
-
|
|
50
|
-
expect(
|
|
51
|
-
H.updateQuestionnaire('EDITED')(questionnaire)(['COLLECTED', 'EDITED'])(
|
|
52
|
-
{
|
|
53
|
-
inputOk: 'My new input',
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
).toEqual(R.resInputEdited);
|
|
57
|
-
});
|
|
58
|
-
it('should return an updated questionnaire with responses component', () => {
|
|
59
|
-
expect(
|
|
60
|
-
H.updateQuestionnaire('FORCED')(questionnaire)(['COLLECTED', 'FORCED'])(
|
|
61
|
-
{
|
|
62
|
-
check2: false,
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
).toEqual(R.resResponses);
|
|
66
|
-
});
|
|
67
|
-
it('should return an updated questionnaire with matrix component', () => {
|
|
68
|
-
expect(
|
|
69
|
-
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
70
|
-
table11: 'My new input',
|
|
71
|
-
})
|
|
72
|
-
).toEqual(R.resMatrix);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should return double updated questionnaire', () => {
|
|
76
|
-
expect(
|
|
77
|
-
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
78
|
-
check1: false,
|
|
79
|
-
table11: '2',
|
|
80
|
-
})
|
|
81
|
-
).toEqual(R.resDouble);
|
|
82
|
-
});
|
|
83
|
-
it('should return loop updated questionnaire with log function', () => {
|
|
84
|
-
expect(
|
|
85
|
-
H.updateQuestionnaire('COLLECTED')(questionnaire)(
|
|
86
|
-
['COLLECTED'],
|
|
87
|
-
console.log
|
|
88
|
-
)({
|
|
89
|
-
Roster: ['ko'],
|
|
90
|
-
})
|
|
91
|
-
).toEqual(R.resLoop);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
1
|
+
import * as H from 'utils/to-expose/handler';
|
|
2
|
+
import questionnaire from './questionnaire';
|
|
3
|
+
import * as R from './results';
|
|
4
|
+
|
|
5
|
+
describe('handler', () => {
|
|
6
|
+
describe('updateQuestionnaire', () => {
|
|
7
|
+
it('should return empty object', () => {
|
|
8
|
+
expect(H.updateQuestionnaire('')({})([])()).toEqual({});
|
|
9
|
+
});
|
|
10
|
+
it('should return empty initial questionnaire', () => {
|
|
11
|
+
expect(H.updateQuestionnaire('')(questionnaire)([])()).toEqual(
|
|
12
|
+
questionnaire
|
|
13
|
+
);
|
|
14
|
+
expect(
|
|
15
|
+
H.updateQuestionnaire('EDITED')({})(['COLLECTED', 'EDITED'])({
|
|
16
|
+
inputOk: 'My input',
|
|
17
|
+
})
|
|
18
|
+
).toEqual({});
|
|
19
|
+
expect(
|
|
20
|
+
H.updateQuestionnaire('EDITED')(questionnaire)(['COLLECTED', 'EDITED'])(
|
|
21
|
+
{
|
|
22
|
+
inputOk: 'My input',
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
).toEqual(questionnaire);
|
|
26
|
+
expect(
|
|
27
|
+
H.updateQuestionnaire('EDITED')(questionnaire)([
|
|
28
|
+
'COLLECTED',
|
|
29
|
+
'FORCED',
|
|
30
|
+
'EDITED',
|
|
31
|
+
])({
|
|
32
|
+
inputOk: 'My input',
|
|
33
|
+
})
|
|
34
|
+
).toEqual(questionnaire);
|
|
35
|
+
expect(
|
|
36
|
+
H.updateQuestionnaire('FORCED')(questionnaire)(['COLLECTED', 'FORCED'])(
|
|
37
|
+
{
|
|
38
|
+
check2: true,
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
).toEqual(questionnaire);
|
|
42
|
+
});
|
|
43
|
+
it('should return an updated questionnaire with response component', () => {
|
|
44
|
+
expect(
|
|
45
|
+
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
46
|
+
inputOk: 'My new input',
|
|
47
|
+
})
|
|
48
|
+
).toEqual(R.resInputCollected);
|
|
49
|
+
|
|
50
|
+
expect(
|
|
51
|
+
H.updateQuestionnaire('EDITED')(questionnaire)(['COLLECTED', 'EDITED'])(
|
|
52
|
+
{
|
|
53
|
+
inputOk: 'My new input',
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
).toEqual(R.resInputEdited);
|
|
57
|
+
});
|
|
58
|
+
it('should return an updated questionnaire with responses component', () => {
|
|
59
|
+
expect(
|
|
60
|
+
H.updateQuestionnaire('FORCED')(questionnaire)(['COLLECTED', 'FORCED'])(
|
|
61
|
+
{
|
|
62
|
+
check2: false,
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
).toEqual(R.resResponses);
|
|
66
|
+
});
|
|
67
|
+
it('should return an updated questionnaire with matrix component', () => {
|
|
68
|
+
expect(
|
|
69
|
+
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
70
|
+
table11: 'My new input',
|
|
71
|
+
})
|
|
72
|
+
).toEqual(R.resMatrix);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should return double updated questionnaire', () => {
|
|
76
|
+
expect(
|
|
77
|
+
H.updateQuestionnaire('COLLECTED')(questionnaire)(['COLLECTED'])({
|
|
78
|
+
check1: false,
|
|
79
|
+
table11: '2',
|
|
80
|
+
})
|
|
81
|
+
).toEqual(R.resDouble);
|
|
82
|
+
});
|
|
83
|
+
it('should return loop updated questionnaire with log function', () => {
|
|
84
|
+
expect(
|
|
85
|
+
H.updateQuestionnaire('COLLECTED')(questionnaire)(
|
|
86
|
+
['COLLECTED'],
|
|
87
|
+
console.log
|
|
88
|
+
)({
|
|
89
|
+
Roster: ['ko'],
|
|
90
|
+
})
|
|
91
|
+
).toEqual(R.resLoop);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|