@eeacms/volto-clms-theme 1.0.63 → 1.0.67

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 (204) hide show
  1. package/CHANGELOG.md +148 -3
  2. package/jest-addon.config.js +5 -0
  3. package/package.json +20 -17
  4. package/src/actions/datasets_by_uid/datasets_by_uid.test.js +14 -0
  5. package/src/actions/downloadtool/downloadtool.test.js +54 -0
  6. package/src/actions/downloadtool/get_downloadtool.js +22 -1
  7. package/src/actions/extra_breadcrumbs/extra_breadcrumb.test.js +16 -0
  8. package/src/actions/format_conversion_table/format_conversion_table.test.js +16 -0
  9. package/src/actions/geonetwork/import_geonetwork.test.js +15 -0
  10. package/src/actions/index.js +2 -0
  11. package/src/actions/meeting/meeting.test.js +41 -0
  12. package/src/actions/newsletter/get_newsletter_subscribers.test.js +14 -0
  13. package/src/actions/projections/get_projections.test.js +13 -0
  14. package/src/actions/registry/registry.test.js +15 -0
  15. package/src/actions/subscription/post_subscription.js +0 -3
  16. package/src/actions/subscription/post_subscription.test.js +64 -0
  17. package/src/actions/tokens/tokens.test.js +39 -0
  18. package/src/actions/userschema/userschema.test.js +14 -0
  19. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +123 -0
  20. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.jsx +8 -11
  21. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.test.jsx +42 -0
  22. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +27 -0
  23. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockView.test.jsx.snap +56 -0
  24. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.jsx +8 -8
  25. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +159 -0
  26. package/src/components/Blocks/CclCardBlock/CclCardBlockView.test.jsx +61 -0
  27. package/src/components/Blocks/CclCardBlock/__snapshots__/CclCardBlockEdit.test.jsx.snap +45 -0
  28. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit.jsx +8 -12
  29. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +3 -3
  30. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +42 -0
  31. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +42 -0
  32. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockEdit.test.jsx.snap +12 -0
  33. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +3 -0
  34. package/src/components/Blocks/CclHomeBgImageBlock/CclHomeImageEditor.jsx +43 -41
  35. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.test.jsx +54 -0
  36. package/src/components/Blocks/CclHomeProductsBlock/__snapshots__/CclHomeProductsBlockView.test.jsx.snap +57 -0
  37. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockEdit.jsx +9 -10
  38. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.jsx +28 -9
  39. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.test.jsx +113 -0
  40. package/src/components/Blocks/CclHomeSearchBlock/__snapshots__/CclHomeSearchBlockView.test.jsx.snap +310 -0
  41. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUserBlockView.test.jsx +61 -0
  42. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockEdit.jsx +180 -146
  43. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockView.jsx +8 -1
  44. package/src/components/Blocks/CclHomeUsersBlock/HomeUsersSchema.js +0 -1
  45. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingEdit.jsx +4 -6
  46. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +26 -23
  47. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselEdit.jsx +4 -10
  48. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselView.jsx +2 -6
  49. package/src/components/Blocks/CclUseCaseList/CclUseCaseListEdit.jsx +16 -13
  50. package/src/components/Blocks/CclUseCaseList/CclUseCaseListView.jsx +17 -19
  51. package/src/components/Blocks/CclUseCaseList/utils.js +1 -1
  52. package/src/components/Blocks/CustomTemplates/VoltoArcgisBlock/CclMapMenu.jsx +2 -2
  53. package/src/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema.js +2 -2
  54. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +0 -3
  55. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +247 -0
  56. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionFacet.jsx +82 -0
  57. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +37 -31
  58. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/WithType.jsx +8 -0
  59. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +3 -3
  60. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclCarouselView.jsx +17 -48
  61. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +11 -55
  62. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +17 -17
  63. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +24 -15
  64. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +18 -48
  65. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget.jsx +11 -8
  66. package/src/components/Blocks/customBlocks.js +57 -155
  67. package/src/components/Blocks/{CclCardContainerBlock/utils.js → utils.js} +0 -0
  68. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +27 -0
  69. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +14 -21
  70. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +194 -0
  71. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +34 -0
  72. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +155 -101
  73. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.test.jsx +63 -0
  74. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +24 -0
  75. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.jsx +1 -13
  76. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.test.jsx +136 -0
  77. package/src/components/CLMSDatasetDetailView/index.js +0 -1
  78. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +202 -144
  79. package/src/components/CLMSDownloadCartView/CLMSCartContent.test.jsx +5 -0
  80. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +39 -45
  81. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.test.jsx +5 -0
  82. package/src/components/CLMSDownloadCartView/cartUtils.js +9 -7
  83. package/src/components/CLMSDownloadCartView/cartUtils.test.js +5 -0
  84. package/src/components/CLMSDownloadCartView/conversion.js +1 -2
  85. package/src/components/CLMSDownloadCartView/conversion.test.js +5 -0
  86. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFile.test.jsx +5 -0
  87. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +10 -1
  88. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.jsx +196 -0
  89. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.test.jsx +5 -0
  90. package/src/components/CLMSDownloadsView/CLMSDownloadsView.jsx +141 -0
  91. package/src/components/CLMSDownloadsView/CLMSDownloadsView.test.jsx +5 -0
  92. package/src/components/CLMSDownloadsView/FileCard.jsx +231 -0
  93. package/src/components/CLMSDownloadsView/FileCard.test.jsx +5 -0
  94. package/src/components/CLMSDownloadsView/filecard.less +21 -0
  95. package/src/components/CLMSMapViewerView/CLMSMapViewerView.jsx +3 -3
  96. package/src/components/CLMSMapViewerView/CLMSMapViewerView.test.jsx +5 -0
  97. package/src/components/CLMSMeetingView/CLMSMeetingEmailView.test.jsx +5 -0
  98. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.jsx +6 -5
  99. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.test.jsx +5 -0
  100. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberVew.test.jsx +5 -0
  101. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberView.test.jsx +5 -0
  102. package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.test.jsx +5 -0
  103. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +49 -36
  104. package/src/components/CLMSNewsItemView/CLMSNewsItemView.test.jsx +44 -0
  105. package/src/components/CLMSProfileView/CLMSApiTokensView.test.jsx +5 -0
  106. package/src/components/CLMSProfileView/CLMSNewsletterSubscriberView.test.jsx +5 -0
  107. package/src/components/CLMSProfileView/CLMSProfileView.jsx +6 -3
  108. package/src/components/CLMSProfileView/CLMSProfileView.test.jsx +5 -0
  109. package/src/components/CLMSProfileView/CLMSUserProfileView.test.jsx +5 -0
  110. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.jsx +18 -12
  111. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.test.jsx +5 -0
  112. package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +33 -33
  113. package/src/components/CLMSSubscriptionView/SubscriptionView.test.jsx +5 -0
  114. package/src/components/CLMSSubscriptionView/subscription_utils.test.js +5 -0
  115. package/src/components/CclButton/CclButton.jsx +4 -3
  116. package/src/components/CclButton/CclButton.test.js +76 -0
  117. package/src/components/CclCard/CclCard.jsx +5 -34
  118. package/src/components/CclCard/CclCard.test.jsx +133 -0
  119. package/src/components/CclCitation/CclCitation.test.jsx +11 -0
  120. package/src/components/CclCitation/__snapshots__/CclCitation.test.jsx.snap +14 -0
  121. package/src/components/CclDownloadTable/CclDownloadTable.jsx +145 -40
  122. package/src/components/CclDownloadTable/CclDownloadTable.test.jsx +5 -0
  123. package/src/components/CclDownloadTable/download-table.less +14 -1
  124. package/src/components/CclDownloadTable/modkData.test.js +5 -0
  125. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +60 -0
  126. package/src/components/CclFiltersModal/CclFiltersModal.test.jsx +5 -0
  127. package/src/components/CclFooterColumn/CclFooterColumn.test.jsx +5 -0
  128. package/src/components/CclInfoDescription/CclInfoContainer.test.js +16 -0
  129. package/src/components/CclInfoDescription/CclInfoDescription.test.js +18 -0
  130. package/src/components/CclLanguageSelector/CclLanguageSelector.jsx +80 -109
  131. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +117 -0
  132. package/src/components/CclLanguageSelector/__snapshots__/CclLanguageSelector.test.jsx.snap +43 -0
  133. package/src/components/CclLoginModal/CclLoginModal.jsx +3 -1
  134. package/src/components/CclLoginModal/CclLoginModal.test.jsx +5 -0
  135. package/src/components/CclModal/CclModal.test.js +71 -0
  136. package/src/components/CclTab/CclTab.jsx +8 -3
  137. package/src/components/CclTab/CclTab.test.jsx +55 -0
  138. package/src/components/CclTab/CclTabs.jsx +10 -11
  139. package/src/components/CclTab/CclTabs.test.jsx +5 -0
  140. package/src/components/CclTopMainMenu/CclFooterMenu.jsx +4 -4
  141. package/src/components/CclTopMainMenu/CclFooterMenu.test.jsx +5 -0
  142. package/src/components/CclTopMainMenu/CclTopMainMenu.jsx +6 -6
  143. package/src/components/CclTopMainMenu/CclTopMainMenu.test.jsx +5 -0
  144. package/src/components/CclTopMainMenu/multilingualPath.js +1 -3
  145. package/src/components/CclTopMainMenu/multilingualPath.test.js +5 -0
  146. package/src/components/CclUtils/StringToHTML.test.jsx +5 -0
  147. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.jsx +2 -2
  148. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.test.jsx +30 -0
  149. package/src/components/Widgets/BoundingWidget.test.jsx +5 -0
  150. package/src/components/Widgets/ContactWidget.test.jsx +5 -0
  151. package/src/components/Widgets/DistributionInfoWidget.test.jsx +5 -0
  152. package/src/components/Widgets/DownloadableFilesWidget.test.jsx +5 -0
  153. package/src/components/Widgets/GeonetworkIdentifiersWidget.test.jsx +5 -0
  154. package/src/components/Widgets/MapLayersWidget.jsx +8 -1
  155. package/src/components/Widgets/MapLayersWidget.test.jsx +5 -0
  156. package/src/components/Widgets/TextLinkWidget.test.jsx +5 -0
  157. package/src/customizations/volto/components/manage/Toolbar/Toolbar.test.jsx +5 -0
  158. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +5 -0
  159. package/src/customizations/volto/components/theme/Footer/Footer.jsx +58 -34
  160. package/src/customizations/volto/components/theme/Footer/Footer.test.jsx +5 -0
  161. package/src/customizations/volto/components/theme/Header/Header.jsx +57 -71
  162. package/src/customizations/volto/components/theme/Header/Header.test.jsx +5 -0
  163. package/src/customizations/volto/components/theme/Logo/Logo.test.jsx +5 -0
  164. package/src/customizations/volto/components/theme/Logout/Logout.jsx +74 -0
  165. package/src/customizations/volto/components/theme/Logout/Logout.test.jsx +5 -0
  166. package/src/customizations/volto/components/theme/Navigation/ContextNavigation.test.jsx +5 -0
  167. package/src/customizations/volto/components/theme/Navigation/Navigation.test.jsx +5 -0
  168. package/src/customizations/volto/components/theme/SearchWidget/SerachWidget.test.jsx +5 -0
  169. package/src/index.js +9 -5
  170. package/src/reducers/datasets_by_uid/datasets_by_uid.test.js +53 -0
  171. package/src/reducers/downloadtool/downloadtool_reducer.js +34 -66
  172. package/src/reducers/downloadtool/downloadtool_reducer.test.js +340 -0
  173. package/src/reducers/downloadtool/nutsnames_reducer.js +45 -0
  174. package/src/reducers/downloadtool/nutsnames_reducer.test.js +61 -0
  175. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.js +21 -1
  176. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.test.js +51 -0
  177. package/src/reducers/geonetwork/import_geonetwork_reducer.test.js +60 -0
  178. package/src/reducers/index.js +4 -4
  179. package/src/reducers/meeting/meeting_register_reducer.test.js +82 -0
  180. package/src/reducers/meeting/meeting_subscribers_reducer.js +4 -2
  181. package/src/reducers/meeting/meeting_subscribers_reducer.test.js +149 -0
  182. package/src/reducers/newsletter/get_newsletter_reducer.test.js +75 -0
  183. package/src/reducers/registry/registry.test.js +74 -0
  184. package/src/reducers/subscription/subscription_reducer.test.js +71 -0
  185. package/src/reducers/tokens/tokens.test.js +221 -0
  186. package/src/reducers/userschema/userschema.js +1 -1
  187. package/src/reducers/userschema/userschema.test.js +63 -0
  188. package/theme/clms/css/carousel.css +1 -1
  189. package/theme/clms/css/header.css +4 -0
  190. package/theme/clms/css/home.css +4 -4
  191. package/theme/clms/css/styles.less +17 -4
  192. package/src/components/Blocks/CclHomeUsersBlock/utils.js +0 -27
  193. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuEdit.jsx +0 -124
  194. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuView.jsx +0 -48
  195. package/src/components/Blocks/CclProductLeftMenu/LeftMenuSchema.js +0 -78
  196. package/src/components/Blocks/CclProductLeftMenu/utils.js +0 -25
  197. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionCheckboxFacet.jsx +0 -56
  198. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionLabelFacet.jsx +0 -58
  199. package/src/components/CLMSDatasetDetailView/MetadataContent.jsx +0 -255
  200. package/src/components/CLMSDownloadCartView/CLMSTasksInProgress.jsx +0 -238
  201. package/src/components/CLMSEventView/CLMSEventView.jsx +0 -53
  202. package/src/components/CclTable/CclTable.jsx +0 -95
  203. package/src/components/CclTable/table.less +0 -42
  204. package/src/i18n.js +0 -183
@@ -6,6 +6,9 @@
6
6
  import { GET_EXTRA_BREADCRUMB_ITEMS } from '../../actions/extra_breadcrumbs/extra_breadcrumb';
7
7
 
8
8
  const initialState = {
9
+ loading: false,
10
+ loaded: false,
11
+ error: null,
9
12
  items: [],
10
13
  };
11
14
 
@@ -14,9 +17,26 @@ export const extraBreadcrumbItemsReducer = (
14
17
  action = {},
15
18
  ) => {
16
19
  switch (action?.type) {
17
- case GET_EXTRA_BREADCRUMB_ITEMS:
20
+ case `${GET_EXTRA_BREADCRUMB_ITEMS}_PENDING`:
18
21
  return {
19
22
  ...state,
23
+ loading: true,
24
+ loaded: false,
25
+ items: action.items,
26
+ };
27
+ case `${GET_EXTRA_BREADCRUMB_ITEMS}_SUCCESS`:
28
+ return {
29
+ ...state,
30
+ loading: false,
31
+ loaded: true,
32
+ items: action.items,
33
+ };
34
+ case `${GET_EXTRA_BREADCRUMB_ITEMS}_FAIL`:
35
+ return {
36
+ ...state,
37
+ loading: false,
38
+ loaded: true,
39
+ error: true,
20
40
  items: action.items,
21
41
  };
22
42
  default:
@@ -0,0 +1,51 @@
1
+ import { extraBreadcrumbItemsReducer } from './extra_breadcrumb_reducer';
2
+ import { GET_EXTRA_BREADCRUMB_ITEMS } from '../../actions/extra_breadcrumbs/extra_breadcrumb';
3
+
4
+ //jest test for extraBreadcrumbItemsReducer
5
+ describe('extraBreadcrumbItemsReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(extraBreadcrumbItemsReducer(undefined)).toEqual({
8
+ error: null,
9
+ items: [],
10
+ loaded: false,
11
+ loading: false,
12
+ });
13
+ });
14
+ //jest test for extraBreadcrumbItemsReducer -success
15
+ it('should handle GET_EXTRA_BREADCRUMB_ITEMS_SUCCESS', () => {
16
+ const action = {
17
+ type: `${GET_EXTRA_BREADCRUMB_ITEMS}_SUCCESS`,
18
+ items: ['breadcrumb-item-1'],
19
+ };
20
+ expect(extraBreadcrumbItemsReducer({}, action)).toEqual({
21
+ loading: false,
22
+ loaded: true,
23
+ items: action.items,
24
+ });
25
+ });
26
+ //jest test for extraBreadcrumbItemsReducer -fail
27
+ it('should handle GET_EXTRA_BREADCRUMB_ITEMS_FAIL', () => {
28
+ const action = {
29
+ type: `${GET_EXTRA_BREADCRUMB_ITEMS}_FAIL`,
30
+ items: ['breadcrumb-item-1'],
31
+ };
32
+ expect(extraBreadcrumbItemsReducer({}, action)).toEqual({
33
+ items: action.items,
34
+ loading: false,
35
+ loaded: true,
36
+ error: true,
37
+ });
38
+ });
39
+ //jest test for extraBreadcrumbItemsReducer -pending
40
+ it('should handle GET_EXTRA_BREADCRUMB_ITEMS_PENDING', () => {
41
+ const action = {
42
+ type: `${GET_EXTRA_BREADCRUMB_ITEMS}_PENDING`,
43
+ items: ['breadcrumb-item-1'],
44
+ };
45
+ expect(extraBreadcrumbItemsReducer({}, action)).toEqual({
46
+ loading: true,
47
+ loaded: false,
48
+ items: action.items,
49
+ });
50
+ });
51
+ });
@@ -0,0 +1,60 @@
1
+ import { importGeonetworkReducer } from './import_geonetwork_reducer';
2
+ import { POST_IMPORT_GEONETWORK } from '../../actions';
3
+
4
+ //jest test for importGeonetworkReducer
5
+ describe('importGeonetworkReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(importGeonetworkReducer(undefined)).toEqual({
8
+ error: null,
9
+ loaded: false,
10
+ loading: false,
11
+ imported_data: {},
12
+ });
13
+ });
14
+ //jest test for importGeonetworkReducer -success
15
+ it('should handle POST_IMPORT_GEONETWORK_SUCCESS', () => {
16
+ const action = {
17
+ type: `${POST_IMPORT_GEONETWORK}_SUCCESS`,
18
+ result: '{"imported_data": {"id": "1"}}',
19
+ };
20
+ expect(importGeonetworkReducer({}, action)).toEqual({
21
+ error: null,
22
+ loaded: true,
23
+ loading: false,
24
+ imported_data: JSON.parse(action.result),
25
+ });
26
+ });
27
+ //jest test for importGeonetworkReducer -fail
28
+ it('should handle POST_IMPORT_GEONETWORK_FAIL', () => {
29
+ expect(
30
+ importGeonetworkReducer(
31
+ {},
32
+ {
33
+ type: `${POST_IMPORT_GEONETWORK}_FAIL`,
34
+ error: 'error',
35
+ },
36
+ ),
37
+ ).toEqual({
38
+ error: 'error',
39
+ loaded: false,
40
+ loading: false,
41
+ imported_data: {},
42
+ });
43
+ });
44
+ //jest test for importGeonetworkReducer -pending
45
+ it('should handle POST_IMPORT_GEONETWORK_PENDING', () => {
46
+ expect(
47
+ importGeonetworkReducer(
48
+ {},
49
+ {
50
+ type: `${POST_IMPORT_GEONETWORK}_PENDING`,
51
+ },
52
+ ),
53
+ ).toEqual({
54
+ error: null,
55
+ loaded: false,
56
+ loading: true,
57
+ imported_data: {},
58
+ });
59
+ });
60
+ });
@@ -9,13 +9,12 @@ import { extraBreadcrumbItemsReducer } from './extra_breadcrumbs/extra_breadcrum
9
9
  import { importGeonetworkReducer } from './geonetwork/import_geonetwork_reducer';
10
10
  import { meetingRegisterReducer } from './meeting/meeting_register_reducer';
11
11
  import { meetingSubscribersReducer } from './meeting/meeting_subscribers_reducer';
12
+ import { newsletterSubscribersReducer } from './newsletter/get_newsletter_reducer';
13
+ import { nutsnamesReducer } from './downloadtool/nutsnames_reducer';
12
14
  import { registryReducer } from './registry/registry';
13
- // import defaultReducers from '@plone/volto/reducers';
15
+ import { subscribeToReducer } from './subscription/subscription_reducer';
14
16
  import tokens from './tokens/tokens';
15
17
  import { userschemaReducer } from './userschema/userschema';
16
- // import { newsletterReducer } from './newsletter/newsletter_reducer';
17
- import { newsletterSubscribersReducer } from './newsletter/get_newsletter_reducer';
18
- import { subscribeToReducer } from './subscription/subscription_reducer';
19
18
 
20
19
  /**
21
20
  * Root reducer.
@@ -32,6 +31,7 @@ const reducers = {
32
31
  meeting_register: meetingRegisterReducer,
33
32
  subscribers: meetingSubscribersReducer,
34
33
  downloadtool: downloadtoolReducer,
34
+ nutsnames: nutsnamesReducer,
35
35
  registry: registryReducer,
36
36
  geonetwork_importation: importGeonetworkReducer,
37
37
  userschema: userschemaReducer,
@@ -0,0 +1,82 @@
1
+ import { POST_MEETING_REGISTER } from '../../actions';
2
+ import { meetingRegisterReducer } from './meeting_register_reducer';
3
+
4
+ //jest test to meetingRegisterReducer
5
+ describe('meetingRegisterReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(meetingRegisterReducer(undefined)).toEqual({
8
+ error: null,
9
+ loaded: false,
10
+ loading: false,
11
+ logged_user_registration: false,
12
+ registered_message: '',
13
+ });
14
+ });
15
+ //jest test to POST_MEETING_REGISTER_SUCCESS
16
+ /* it('should handle POST_MEETING_REGISTER_SUCCESS', () => {
17
+ const action = {
18
+ result: { email: true, subject: '', body: '' },
19
+ };
20
+ expect(
21
+ meetingRegisterReducer(
22
+ {
23
+ error: null,
24
+ loaded: false,
25
+ loading: false,
26
+ logged_user_registration: false,
27
+ registered_message: action.result.registered_message,
28
+ },
29
+ {
30
+ type: `${POST_MEETING_REGISTER}_SUCCESS`,
31
+ logged_user_registration: true,
32
+ registered_message: '',
33
+ },
34
+ ),
35
+ ).toEqual({
36
+ error: null,
37
+ loaded: true,
38
+ loading: false,
39
+ logged_user_registration: true,
40
+ registered_message: action.result.registered_message,
41
+ });
42
+ }); */
43
+ //jest test to meetingRegisterReducer -fail
44
+ it('should handle POST_MEETING_REGISTER_FAIL', () => {
45
+ const action = {
46
+ type: `${POST_MEETING_REGISTER}_FAIL`,
47
+ error: true,
48
+ loaded: false,
49
+ loading: false,
50
+ result: {
51
+ message: '',
52
+ },
53
+ };
54
+ expect(meetingRegisterReducer({}, action)).toEqual({
55
+ error: true,
56
+ loaded: false,
57
+ loading: false,
58
+ registered_message: action.result?.message || action.error?.message,
59
+ logged_user_registration: false,
60
+ });
61
+ });
62
+ //jest test to meetingRegisterReducer -pending
63
+ it('should handle POST_MEETING_REGISTER_PENDING', () => {
64
+ expect(
65
+ meetingRegisterReducer(
66
+ {},
67
+ {
68
+ type: `${POST_MEETING_REGISTER}_PENDING`,
69
+ error: null,
70
+ loaded: false,
71
+ loading: true,
72
+ logged_user_registration: false,
73
+ },
74
+ ),
75
+ ).toEqual({
76
+ error: null,
77
+ loaded: false,
78
+ loading: true,
79
+ logged_user_registration: false,
80
+ });
81
+ });
82
+ });
@@ -3,8 +3,10 @@
3
3
  * @module reducers/cartItemsReducer
4
4
  */
5
5
 
6
- import { MEETING_SUBSCRIBERS } from '../../actions';
7
- import { MEETING_SUBSCRIBERS_MANIPULATION } from '../../actions';
6
+ import {
7
+ MEETING_SUBSCRIBERS,
8
+ MEETING_SUBSCRIBERS_MANIPULATION,
9
+ } from '../../actions';
8
10
 
9
11
  const initialState = {
10
12
  error: null,
@@ -0,0 +1,149 @@
1
+ import {
2
+ MEETING_SUBSCRIBERS,
3
+ MEETING_SUBSCRIBERS_MANIPULATION,
4
+ } from '../../actions';
5
+ import { meetingSubscribersReducer } from './meeting_subscribers_reducer';
6
+
7
+ //jest test to meetingSubscribersReducer
8
+ describe('meetingSubscribersReducer', () => {
9
+ it('should return the initial state', () => {
10
+ expect(meetingSubscribersReducer(undefined)).toEqual({
11
+ error: null,
12
+ loaded: false,
13
+ loading: false,
14
+ items: [],
15
+ message: '',
16
+ });
17
+ });
18
+ //jest test to meetingSubscribersReducer -success
19
+ it('should handle MEETING_SUBSCRIBERS_SUCCESS', () => {
20
+ expect(
21
+ meetingSubscribersReducer(
22
+ {},
23
+ {
24
+ type: `${MEETING_SUBSCRIBERS}_SUCCESS`,
25
+ result: {
26
+ items: [
27
+ {
28
+ id: '1',
29
+ name: 'test',
30
+ email: '',
31
+ },
32
+ ],
33
+ },
34
+ },
35
+ ),
36
+ ).toEqual({
37
+ error: null,
38
+ loaded: true,
39
+ loading: false,
40
+ items: [
41
+ {
42
+ id: '1',
43
+ name: 'test',
44
+ email: '',
45
+ },
46
+ ],
47
+ message: '',
48
+ });
49
+ });
50
+ //jest test to meetingSubscribersReducer -fail
51
+ it('should handle MEETING_SUBSCRIBERS_FAIL', () => {
52
+ const action = {
53
+ type: `${MEETING_SUBSCRIBERS}_FAIL`,
54
+ error: true,
55
+ loaded: false,
56
+ loading: false,
57
+ };
58
+ expect(meetingSubscribersReducer({}, action)).toEqual({
59
+ error: true,
60
+ loaded: false,
61
+ loading: false,
62
+ message: '',
63
+ });
64
+ });
65
+ //jest test to meetingSubscribersReducer -pending
66
+ it('should handle MEETING_SUBSCRIBERS_PENDING', () => {
67
+ expect(
68
+ meetingSubscribersReducer(
69
+ {},
70
+ {
71
+ type: `${MEETING_SUBSCRIBERS}_PENDING`,
72
+ },
73
+ ),
74
+ ).toEqual({
75
+ error: null,
76
+ loaded: false,
77
+ loading: true,
78
+ message: '',
79
+ });
80
+ });
81
+ //jest test to meetingSubscribersReducer -manipulation -success
82
+ it('should handle MEETING_SUBSCRIBERS_MANIPULATION_SUCCESS', () => {
83
+ expect(
84
+ meetingSubscribersReducer(
85
+ {},
86
+ {
87
+ type: `${MEETING_SUBSCRIBERS_MANIPULATION}_SUCCESS`,
88
+ result: {
89
+ message: 'success',
90
+ items: [],
91
+ },
92
+ },
93
+ ),
94
+ ).toEqual({
95
+ error: null,
96
+ loaded: true,
97
+ loading: false,
98
+ items: [],
99
+ message: 'success',
100
+ });
101
+ });
102
+ //jest test to meetingSubscribersReducer -manipulation -fail
103
+ it('should handle MEETING_SUBSCRIBERS_MANIPULATION_FAIL', () => {
104
+ const action = {
105
+ type: `${MEETING_SUBSCRIBERS_MANIPULATION}_FAIL`,
106
+ result: {
107
+ message: 'error',
108
+ },
109
+ error: true,
110
+ };
111
+ expect(meetingSubscribersReducer({}, action)).toEqual({
112
+ error: true,
113
+ loaded: false,
114
+ loading: false,
115
+ message: 'error' || '',
116
+ });
117
+ });
118
+ it('should handle MEETING_SUBSCRIBERS_MANIPULATION_FAIL without error message', () => {
119
+ const action = {
120
+ type: `${MEETING_SUBSCRIBERS_MANIPULATION}_FAIL`,
121
+ error: true,
122
+ result: {
123
+ message: '',
124
+ },
125
+ };
126
+ expect(meetingSubscribersReducer({}, action)).toEqual({
127
+ error: true,
128
+ loaded: false,
129
+ loading: false,
130
+ message: '',
131
+ });
132
+ });
133
+ //jest test to meetingSubscribersReducer -manipulation -pending
134
+ it('should handle MEETING_SUBSCRIBERS_MANIPULATION_PENDING', () => {
135
+ expect(
136
+ meetingSubscribersReducer(
137
+ {},
138
+ {
139
+ type: `${MEETING_SUBSCRIBERS_MANIPULATION}_PENDING`,
140
+ },
141
+ ),
142
+ ).toEqual({
143
+ error: null,
144
+ loaded: false,
145
+ loading: true,
146
+ });
147
+ });
148
+ });
149
+ // End of file
@@ -0,0 +1,75 @@
1
+ import { newsletterSubscribersReducer } from './get_newsletter_reducer';
2
+ import { GET_NEWSLETTER } from '../../actions';
3
+
4
+ //jest test for newsletterSubscribersReducer
5
+ describe('newsletterSubscribersReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(newsletterSubscribersReducer(undefined)).toEqual({
8
+ error: null,
9
+ loaded: false,
10
+ loading: false,
11
+ items: [],
12
+ });
13
+ });
14
+ //jest test for newsletterSubscribersReducer -pending
15
+ it('should handle GET_NEWSLETTER_PENDING', () => {
16
+ expect(
17
+ newsletterSubscribersReducer(
18
+ {},
19
+ {
20
+ type: `${GET_NEWSLETTER}_PENDING`,
21
+ },
22
+ ),
23
+ ).toEqual({
24
+ error: null,
25
+ loaded: false,
26
+ loading: true,
27
+ items: [],
28
+ });
29
+ });
30
+ //jest test for newsletterSubscribersReducer -fail
31
+ it('should handle GET_NEWSLETTER_FAIL', () => {
32
+ expect(
33
+ newsletterSubscribersReducer(
34
+ {},
35
+ {
36
+ type: `${GET_NEWSLETTER}_FAIL`,
37
+ },
38
+ ),
39
+ ).toEqual({
40
+ error: true,
41
+ loaded: false,
42
+ loading: false,
43
+ items: [],
44
+ });
45
+ });
46
+ //jest test for newsletterSubscribersReducer -success
47
+ it('should handle GET_NEWSLETTER_SUCCESS', () => {
48
+ expect(
49
+ newsletterSubscribersReducer(
50
+ {},
51
+ {
52
+ type: `${GET_NEWSLETTER}_SUCCESS`,
53
+ result: {
54
+ subscribers: [
55
+ {
56
+ id: 'newsletter-subscriber-1',
57
+ email: '',
58
+ },
59
+ ],
60
+ },
61
+ },
62
+ ),
63
+ ).toEqual({
64
+ error: null,
65
+ loaded: true,
66
+ loading: false,
67
+ items: [
68
+ {
69
+ id: 'newsletter-subscriber-1',
70
+ email: '',
71
+ },
72
+ ],
73
+ });
74
+ });
75
+ });
@@ -0,0 +1,74 @@
1
+ import { GET_REGISTRY } from '../../actions';
2
+ import { registryReducer } from './registry';
3
+
4
+ //jest test for registryReducer
5
+ describe('registryReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(registryReducer(undefined)).toEqual({
8
+ error: null,
9
+ loaded: false,
10
+ loading: false,
11
+ records: {},
12
+ });
13
+ });
14
+ //jest test for registryReducer -pending
15
+ it('should handle GET_REGISTRY_PENDING', () => {
16
+ expect(
17
+ registryReducer(
18
+ {},
19
+ {
20
+ type: `${GET_REGISTRY}_PENDING`,
21
+ },
22
+ ),
23
+ ).toEqual({
24
+ error: null,
25
+ loaded: false,
26
+ loading: true,
27
+ });
28
+ });
29
+ //jest test for registryReducer -fail
30
+ it('should handle GET_REGISTRY_FAIL', () => {
31
+ const action = {
32
+ type: `${GET_REGISTRY}_FAIL`,
33
+ error: 'error',
34
+ };
35
+ expect(registryReducer({}, action)).toEqual({
36
+ error: action.error,
37
+ loaded: false,
38
+ loading: false,
39
+ });
40
+ });
41
+ //jest test for registryReducer -success
42
+ it('should handle GET_REGISTRY_SUCCESS', () => {
43
+ const action = {
44
+ type: `${GET_REGISTRY}_SUCCESS`,
45
+ registry_key: 'registry_key',
46
+ result: {
47
+ records: {
48
+ 'registry-1': {
49
+ id: 'registry-1',
50
+ name: 'Registry 1',
51
+ description: 'Registry 1 description',
52
+ owner: 'registry-owner-1',
53
+ owner_email: '',
54
+ },
55
+ 'registry-2': {
56
+ id: 'registry-2',
57
+ name: 'Registry 2',
58
+ description: 'Registry 2 description',
59
+ owner: 'registry-owner-2',
60
+ owner_email: '',
61
+ },
62
+ },
63
+ },
64
+ };
65
+ expect(registryReducer({}, action)).toEqual({
66
+ error: null,
67
+ loaded: true,
68
+ loading: false,
69
+ records: {
70
+ [action.registry_key]: action.result,
71
+ },
72
+ });
73
+ });
74
+ });
@@ -0,0 +1,71 @@
1
+ import { POST_SUBSCRIBE_TO } from '../../actions';
2
+ import { subscribeToReducer } from './subscription_reducer';
3
+
4
+ //jest test for subscribeToReducer
5
+ describe('subscribeToReducer', () => {
6
+ it('should return the initial state', () => {
7
+ expect(subscribeToReducer(undefined)).toEqual({
8
+ error: null,
9
+ loaded: false,
10
+ loading: false,
11
+ });
12
+ });
13
+ //jest test for subscribeToReducer -success
14
+ it('should handle POST_SUBSCRIBE_TO_SUCCESS', () => {
15
+ expect(
16
+ subscribeToReducer(
17
+ {},
18
+ {
19
+ type: `${POST_SUBSCRIBE_TO}_SUCCESS`,
20
+ },
21
+ ),
22
+ ).toEqual({
23
+ error: null,
24
+ loaded: true,
25
+ loading: false,
26
+ });
27
+ });
28
+ //jest test for subscribeToReducer -fail
29
+ it('should handle POST_SUBSCRIBE_TO_FAIL', () => {
30
+ const action = {
31
+ type: `${POST_SUBSCRIBE_TO}_FAIL`,
32
+ error: {
33
+ response: {
34
+ body: { error: 'error' },
35
+ },
36
+ },
37
+ };
38
+ expect(subscribeToReducer({}, action)).toEqual({
39
+ error: true,
40
+ loaded: false,
41
+ loading: false,
42
+ error_message: action.error?.response?.body?.error || '',
43
+ });
44
+ });
45
+ it('should handle POST_SUBSCRIBE_TO_FAIL without error message', () => {
46
+ const action = {
47
+ type: `${POST_SUBSCRIBE_TO}_FAIL`,
48
+ };
49
+ expect(subscribeToReducer({}, action)).toEqual({
50
+ error: true,
51
+ loaded: false,
52
+ loading: false,
53
+ error_message: action.error?.response?.body?.error || '',
54
+ });
55
+ });
56
+ //jest test for subscribeToReducer -pending
57
+ it('should handle POST_SUBSCRIBE_TO_PENDING', () => {
58
+ expect(
59
+ subscribeToReducer(
60
+ {},
61
+ {
62
+ type: `${POST_SUBSCRIBE_TO}_PENDING`,
63
+ },
64
+ ),
65
+ ).toEqual({
66
+ error: null,
67
+ loaded: false,
68
+ loading: true,
69
+ });
70
+ });
71
+ });