@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.
Files changed (87) hide show
  1. package/es/actions/ui/next-slide.d.ts +4 -2
  2. package/es/actions/ui/next-slide.js +7 -4
  3. package/es/actions/ui/quit-popin.d.ts +8 -0
  4. package/es/actions/ui/quit-popin.js +8 -0
  5. package/es/actions/ui/slides.d.ts +2 -3
  6. package/es/common/index.d.ts +2 -0
  7. package/es/common/index.js +9 -0
  8. package/es/reducers/index.d.ts +7 -1
  9. package/es/reducers/ui/answers.d.ts +2 -2
  10. package/es/reducers/ui/current-slide-ref.d.ts +3 -2
  11. package/es/reducers/ui/current-slide-ref.js +3 -0
  12. package/es/reducers/ui/index.d.ts +11 -1
  13. package/es/reducers/ui/index.js +5 -1
  14. package/es/reducers/ui/positions.d.ts +5 -0
  15. package/es/reducers/ui/positions.js +25 -0
  16. package/es/reducers/ui/quit-popin.d.ts +4 -0
  17. package/es/reducers/ui/quit-popin.js +16 -0
  18. package/es/reducers/ui/slide.d.ts +2 -2
  19. package/es/views/slides/index.d.ts +19 -2
  20. package/es/views/slides/index.js +45 -25
  21. package/lib/actions/ui/next-slide.d.ts +4 -2
  22. package/lib/actions/ui/next-slide.js +7 -4
  23. package/lib/actions/ui/quit-popin.d.ts +8 -0
  24. package/lib/actions/ui/quit-popin.js +8 -0
  25. package/lib/actions/ui/slides.d.ts +2 -3
  26. package/lib/common/index.d.ts +2 -0
  27. package/lib/common/index.js +9 -0
  28. package/lib/reducers/index.d.ts +7 -1
  29. package/lib/reducers/ui/answers.d.ts +2 -2
  30. package/lib/reducers/ui/current-slide-ref.d.ts +3 -2
  31. package/lib/reducers/ui/current-slide-ref.js +3 -0
  32. package/lib/reducers/ui/index.d.ts +11 -1
  33. package/lib/reducers/ui/index.js +5 -1
  34. package/lib/reducers/ui/positions.d.ts +5 -0
  35. package/lib/reducers/ui/positions.js +26 -0
  36. package/lib/reducers/ui/quit-popin.d.ts +4 -0
  37. package/lib/reducers/ui/quit-popin.js +17 -0
  38. package/lib/reducers/ui/slide.d.ts +2 -2
  39. package/lib/views/slides/index.d.ts +19 -2
  40. package/lib/views/slides/index.js +47 -26
  41. package/package.json +10 -11
  42. package/src/actions/api/test/fetch-correction.test.ts +3 -1
  43. package/src/actions/api/test/fetch-rank.test.ts +3 -1
  44. package/src/actions/api/test/fetch-skills.test.ts +3 -1
  45. package/src/actions/api/test/fetch-slide.test.ts +3 -1
  46. package/src/actions/api/test/post-answer.test.ts +6 -2
  47. package/src/actions/api/test/post-progression.test.ts +3 -1
  48. package/src/actions/data/test/token.test.ts +3 -1
  49. package/src/actions/ui/next-slide.ts +15 -9
  50. package/src/actions/ui/quit-popin.ts +10 -0
  51. package/src/actions/ui/slides.ts +2 -4
  52. package/src/actions/ui/test/answers.test.ts +3 -1
  53. package/src/actions/ui/test/next-slide.test.ts +9 -3
  54. package/src/actions/ui/test/quit-popin.test.ts +38 -0
  55. package/src/actions/ui/test/slides.test.ts +3 -1
  56. package/src/common/index.ts +12 -0
  57. package/src/common/test/get-progression-slide-ref.test.ts +35 -0
  58. package/src/reducers/ui/answers.ts +2 -2
  59. package/src/reducers/ui/current-slide-ref.ts +5 -2
  60. package/src/reducers/ui/index.ts +7 -1
  61. package/src/reducers/ui/positions.ts +32 -0
  62. package/src/reducers/ui/quit-popin.ts +22 -0
  63. package/src/reducers/ui/slide.ts +7 -2
  64. package/src/reducers/ui/test/answers.test.ts +3 -1
  65. package/src/reducers/ui/test/current-slide-ref.test.ts +2 -2
  66. package/src/reducers/ui/test/positions.test.ts +68 -0
  67. package/src/reducers/ui/test/quit-popin.test.ts +24 -0
  68. package/src/reducers/ui/test/slide.test.ts +3 -1
  69. package/src/types/common.ts +0 -1
  70. package/src/views/skills/test/skills.test.ts +6 -2
  71. package/src/views/slides/index.ts +70 -32
  72. package/src/views/slides/test/header.on-click.test.ts +42 -0
  73. package/src/views/slides/test/index.test.ts +90 -42
  74. package/src/views/slides/test/on-quit-popin.on-click.test.ts +64 -0
  75. package/src/views/slides/test/slide.free-text.on-change.test.ts +3 -2
  76. package/src/views/slides/test/slide.next-slide.on-click.test.ts +10 -2
  77. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +3 -2
  78. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +3 -2
  79. package/src/views/slides/test/slide.qcm.on-click.test.ts +3 -2
  80. package/src/views/slides/test/slide.slider.on-change.test.ts +3 -2
  81. package/src/views/slides/test/slide.slider.on-slider-change.test.ts +17 -4
  82. package/src/views/slides/test/slide.template.on-change.test.ts +11 -11
  83. package/es/actions/ui/is-fetching.d.ts +0 -10
  84. package/es/actions/ui/is-fetching.js +0 -4
  85. package/lib/actions/ui/is-fetching.d.ts +0 -10
  86. package/lib/actions/ui/is-fetching.js +0 -4
  87. 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(1);
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 SlideProps = props.stack.slides['0'].answerUI?.model as QuestionRange;
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', SlideProps)!;
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 SlideProps = props.stack.slides['0'].answerUI?.model as Template;
84
- const onChangeText = get(['1', 'onChange'], SlideProps.answers);
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'], SlideProps.answers);
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 SlideProps = props.stack.slides['0'].answerUI?.model as Template;
116
- const textAnswerProps = SlideProps.answers[1] as TextTemplate;
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'], SlideProps.answers);
118
+ const onChangeText = get(['1', 'onChange'], slideProps.answers);
119
119
  onChangeText('');
120
120
 
121
121
  const newProps = mapStateToSlidesProps(getState(), dispatch, identity);
122
- const SlidePropsAfterOnChange = newProps.stack.slides['0'].answerUI?.model as Template;
123
- const textAnswerPropsAfterOnChange = SlidePropsAfterOnChange.answers[1] as TextTemplate;
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,4 +0,0 @@
1
- export const START_FETCHING = '@@ui/START_FETCHING';
2
- export const STOP_FETCHING = '@@ui/STOP_FETCHING';
3
- export const startFetching = () => ({ type: START_FETCHING });
4
- export const stopFetching = () => ({ type: STOP_FETCHING });
@@ -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,4 +0,0 @@
1
- export var START_FETCHING = '@@ui/START_FETCHING';
2
- export var STOP_FETCHING = '@@ui/STOP_FETCHING';
3
- export var startFetching = function () { return ({ type: START_FETCHING }); };
4
- export var stopFetching = function () { return ({ type: STOP_FETCHING }); };
@@ -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});