@eeacms/volto-cca-policy 0.3.131 → 1.0.0

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 (181) hide show
  1. package/.eslintrc.js +7 -7
  2. package/CHANGELOG.md +9 -14
  3. package/docker-compose.yml +16 -16
  4. package/jest-addon.config.js +25 -420
  5. package/package.json +1 -1
  6. package/src/components/MigrationButtons.jsx +5 -1
  7. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationEdit.jsx +2 -1
  8. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.jsx +10 -4
  9. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.test.jsx +87 -35
  10. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockEdit.jsx +1 -1
  11. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.test.jsx +1 -1
  12. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockEdit.jsx +1 -1
  13. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.jsx +1 -1
  14. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.test.jsx +1 -1
  15. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockEdit.jsx +1 -1
  16. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +0 -20
  17. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerEdit.test.jsx +1 -1
  18. package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerView.js → CaseStudyExplorerView.jsx} +1 -1
  19. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +2 -2
  20. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +1 -1
  21. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +1 -1
  22. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +2 -1
  23. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +1 -1
  24. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +0 -4
  25. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +0 -30
  26. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +1 -1
  27. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +3 -2
  28. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +1 -1
  29. package/src/components/manage/Blocks/ContentLinks/ContentLinksEdit.jsx +1 -1
  30. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.jsx +1 -1
  31. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.test.jsx +1 -1
  32. package/src/components/manage/Blocks/ContentLinks/DropdownListView.jsx +1 -1
  33. package/src/components/manage/Blocks/ContentLinks/DropdownListView.test.jsx +1 -1
  34. package/src/components/manage/Blocks/CountryMapHeatIndex/Filter.test.jsx +1 -1
  35. package/src/components/manage/Blocks/CountryMapHeatIndex/{View.js → View.jsx} +14 -10
  36. package/src/components/manage/Blocks/CountryMapHeatIndex/mapstyle.js +1 -3
  37. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +2 -1
  38. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +4 -3
  39. package/src/components/manage/Blocks/CountryMapProfile/Filter.test.jsx +1 -1
  40. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +5 -12
  41. package/src/components/manage/Blocks/CountryProfileDetail/{CountryTabPane.js → CountryTabPane.jsx} +11 -4
  42. package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.test.jsx +1 -1
  43. package/src/components/manage/Blocks/CountryProfileDetail/{View.js → View.jsx} +20 -15
  44. package/src/components/manage/Blocks/CountryProfileDetail/View.test.jsx +134 -20
  45. package/src/components/manage/Blocks/CountryProfileDetail/index.js +0 -1
  46. package/src/components/manage/Blocks/DataConnectedEmbedBlock/index.js +0 -2
  47. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsView.jsx +1 -1
  48. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentEdit.jsx +3 -3
  49. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +2 -2
  50. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.test.jsx +1 -1
  51. package/src/components/manage/Blocks/FlourishEmbedBlock/FlourishEmbedBlockEdit.jsx +1 -1
  52. package/src/components/manage/Blocks/Listing/DropdownListingView.jsx +1 -1
  53. package/src/components/manage/Blocks/Listing/EventAccordionListingView.jsx +1 -1
  54. package/src/components/manage/Blocks/Listing/EventAccordionListingView.test.jsx +5 -3
  55. package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +2 -1
  56. package/src/components/manage/Blocks/Listing/EventCardsListingView.test.jsx +10 -4
  57. package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +2 -2
  58. package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +3 -1
  59. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.jsx +1 -1
  60. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.test.jsx +5 -3
  61. package/src/components/manage/Blocks/Listing/SimpleItemListingView.jsx +2 -2
  62. package/src/components/manage/Blocks/Listing/SimpleItemListingView.test.jsx +6 -4
  63. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +0 -1
  64. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +1 -1
  65. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +1 -1
  66. package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +2 -2
  67. package/src/components/manage/Blocks/RASTBlock/RASTEdit.jsx +1 -1
  68. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +1 -1
  69. package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +1 -1
  70. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +1 -1
  71. package/src/components/manage/Blocks/ReadMore/ReadMoreEdit.jsx +1 -1
  72. package/src/components/manage/Blocks/ReadMore/ReadMoreView.jsx +1 -1
  73. package/src/components/manage/Blocks/ReadMore/ReadMoreView.test.jsx +1 -1
  74. package/src/components/manage/Blocks/RedirectBlock/{RedirectBlock.test.js → RedirectBlock.test.jsx} +1 -1
  75. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockEdit.jsx +2 -1
  76. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockView.jsx +2 -2
  77. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentEdit.jsx +1 -1
  78. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +1 -1
  79. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.test.jsx +1 -1
  80. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentEdit.jsx +1 -1
  81. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +1 -1
  82. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +1 -1
  83. package/src/components/manage/Blocks/TabsBlock/Spotlight.jsx +2 -2
  84. package/src/components/manage/Blocks/TabsBlock/Spotlight.test.jsx +7 -1
  85. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectEdit.jsx +1 -1
  86. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +1 -1
  87. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.test.jsx +1 -1
  88. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.jsx +5 -2
  89. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.test.jsx +3 -6
  90. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.jsx +1 -1
  91. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.test.jsx +1 -1
  92. package/src/components/theme/ASTNavigation/ASTAccordion.test.jsx +1 -1
  93. package/src/components/theme/ASTNavigation/ASTLogoMap.jsx +1 -1
  94. package/src/components/theme/ASTNavigation/ASTLogoMap.test.jsx +1 -1
  95. package/src/components/theme/ASTNavigation/ASTNavigation.jsx +9 -5
  96. package/src/components/theme/ASTNavigation/ASTNavigation.test.jsx +323 -0
  97. package/src/components/theme/ASTNavigation/{utils.js → LinkWrap.jsx} +4 -9
  98. package/src/components/theme/ASTNavigation/UASTLogoMap.jsx +1 -1
  99. package/src/components/theme/ASTNavigation/UASTLogoMap.test.jsx +1 -1
  100. package/src/components/theme/Header/Header.jsx +5 -5
  101. package/src/components/theme/Header/LanguageSwitch.jsx +5 -5
  102. package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.jsx +1 -1
  103. package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +1 -1
  104. package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +1 -1
  105. package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
  106. package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -3
  107. package/src/components/theme/Views/ArchivedVersionListing.jsx +1 -1
  108. package/src/components/theme/Views/ArchivedVersionListing.test.jsx +2 -2
  109. package/src/components/theme/Views/ArchivedVersionNotice.jsx +1 -1
  110. package/src/components/theme/Views/ArchivedVersionNotice.test.jsx +1 -1
  111. package/src/components/theme/Views/BrokenLinks.jsx +1 -1
  112. package/src/components/theme/Views/BrokenLinks.test.jsx +1 -1
  113. package/src/components/theme/Views/CaseStudyView.test.jsx +1 -1
  114. package/src/components/theme/Views/DatabaseItemView.test.jsx +1 -1
  115. package/src/components/theme/Views/NewsItemView.jsx +1 -1
  116. package/src/components/theme/Views/ProjectView.test.jsx +1 -1
  117. package/src/components/theme/Views/VersionsGroup.jsx +1 -1
  118. package/src/components/theme/Views/VersionsGroup.test.jsx +1 -1
  119. package/src/components/theme/Widgets/GeocharsWidget.jsx +1 -1
  120. package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -1
  121. package/src/components/theme/Widgets/GeolocationWidget.test.jsx +1 -1
  122. package/src/components/theme/Widgets/ImageWidget.jsx +7 -8
  123. package/src/components/theme/Widgets/ImageWidget.test.jsx +1 -1
  124. package/src/components/theme/Widgets/PromotionalImageWidget.jsx +6 -4
  125. package/src/components/theme/Widgets/utils.js +1 -1
  126. package/src/constants.js +538 -2
  127. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
  128. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +52 -24
  129. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +1 -0
  130. package/src/customizations/@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground.jsx +2 -1
  131. package/src/customizations/@eeacms/volto-listing-block/blocks/Listing/item-templates/SimpleItemTemplates.jsx +2 -2
  132. package/src/customizations/@eeacms/volto-listing-block/components/UniversalCard/fragments/CardTitle.jsx +1 -1
  133. package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
  134. package/src/customizations/@plone/volto-slate/blocks/Text/{index.js → index.jsx} +2 -21
  135. package/src/customizations/@plone/volto-slate/editor/extensions/normalizeNode.js +1 -1
  136. package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
  137. package/src/customizations/@plone/volto-slate/utils/volto-blocks.js +2 -2
  138. package/src/customizations/@plone/volto-slate/widgets/HtmlSlateWidget.jsx +2 -2
  139. package/src/customizations/@plone-collective/volto-authomatic/components/Login/Login.jsx +7 -4
  140. package/src/customizations/@plone-collective/volto-rss-provider/components/RSSFeedView.jsx +5 -8
  141. package/src/customizations/@plone-collective/volto-rss-provider/express-middleware.js +2 -1
  142. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +3 -3
  143. package/src/customizations/volto/components/manage/Blocks/Grid/templates.js +1 -1
  144. package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +1 -1
  145. package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +12 -14
  146. package/src/customizations/volto/components/manage/Display/Display.jsx +10 -5
  147. package/src/customizations/volto/components/manage/Multilingual/TranslationObject.jsx +7 -6
  148. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +4 -1
  149. package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +12 -8
  150. package/src/customizations/volto/components/theme/App/App.jsx +16 -23
  151. package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +3 -2
  152. package/src/customizations/volto/components/theme/View/DefaultView.jsx +5 -4
  153. package/src/customizations/volto/components/theme/View/LinkView.jsx +2 -2
  154. package/src/customizations/volto/components/theme/View/View.jsx +10 -11
  155. package/src/customizations/volto/helpers/Url/Url-old.js +2 -1
  156. package/src/customizations/volto/middleware/api.js +6 -4
  157. package/src/customizations/volto/reducers/actions/actions.js +2 -5
  158. package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
  159. package/src/customizations/volto/reducers/navigation/navigation.js +3 -6
  160. package/src/customizations/volto/server.jsx +9 -8
  161. package/src/express-middleware.js +1 -1
  162. package/src/helpers/ContentMetadata.jsx +4 -4
  163. package/src/helpers/Utils.jsx +5 -5
  164. package/src/helpers/index.js +1 -8
  165. package/src/hocs/index.js +2 -0
  166. package/src/index.js +9 -7
  167. package/src/search/common.js +4 -41
  168. package/src/search/utils.test.js +1 -1
  169. package/src/search/vocabulary.js +2 -2
  170. package/src/store/reducers/physical-breadcrumbs.js +2 -2
  171. package/src/utils.js +1 -1
  172. package/src/helpers/Constants.jsx +0 -535
  173. package/theme/assets/images/administrative_support_service.png +0 -0
  174. /package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerEdit.js → CaseStudyExplorerEdit.jsx} +0 -0
  175. /package/src/components/manage/Blocks/CountryMapHeatIndex/{Edit.js → Edit.jsx} +0 -0
  176. /package/src/components/manage/Blocks/CountryMapProfile/{Edit.js → Edit.jsx} +0 -0
  177. /package/src/components/manage/Blocks/CountryProfileDetail/{Edit.js → Edit.jsx} +0 -0
  178. /package/src/components/manage/Blocks/ReadMore/{schema.js → schema.jsx} +0 -0
  179. /package/src/helpers/{clientOnly.js → clientOnly.jsx} +0 -0
  180. /package/src/{components/manage/Blocks/withResponsiveContainer.js → hocs/withResponsiveContainer.jsx} +0 -0
  181. /package/src/{components/manage/Blocks → hocs}/withVisibilitySensor.jsx +0 -0
@@ -15,9 +15,11 @@ import { makeStyles } from './mapstyle';
15
15
  import { Interactions } from './Interactions';
16
16
  import { useCountriesMetadata } from './hooks';
17
17
  import Filter from './Filter';
18
- import withResponsiveContainer from '../withResponsiveContainer';
19
- import withVisibilitySensor from '../withVisibilitySensor';
20
- import { addAppURL } from '@plone/volto/helpers';
18
+ import {
19
+ withResponsiveContainer,
20
+ withVisibilitySensor,
21
+ } from '@eeacms/volto-cca-policy/hocs';
22
+ import { addAppURL } from '@plone/volto/helpers/Url/Url';
21
23
 
22
24
  import './styles.less';
23
25
 
@@ -92,15 +94,6 @@ const View = (props) => {
92
94
  }, [geofeatures, countries_metadata, thematicMapMode, euCountryNames, ol]);
93
95
 
94
96
  const baseUrl = props.path || props.location?.pathname || '';
95
-
96
- // const onFeatureClick = React.useCallback(
97
- // (feature) => {
98
- // const country = feature.get('na');
99
- // // history.push(`${baseUrl}/${country.toLowerCase()}`);
100
- // },
101
- // [baseUrl, history],
102
- // );
103
- // console.log('thematicMapMode', thematicMapMode);
104
97
  return (
105
98
  <div className="ol-country-map">
106
99
  <Grid columns="12">
@@ -24,7 +24,7 @@ export default function CountryTabPane(props) {
24
24
  if (element.type === 'accordeon') {
25
25
  return element.value.map((accordion, index) => {
26
26
  return (
27
- <Accordion className="secondary">
27
+ <Accordion className="secondary" key={`${indexKey}_${index}`}>
28
28
  <Accordion.Title
29
29
  role="button"
30
30
  tabIndex={0}
@@ -49,7 +49,10 @@ export default function CountryTabPane(props) {
49
49
  }
50
50
  if (element.type === 'table') {
51
51
  return (
52
- <div dangerouslySetInnerHTML={{ __html: element.value }}></div>
52
+ <div
53
+ key={indexKey}
54
+ dangerouslySetInnerHTML={{ __html: element.value }}
55
+ ></div>
53
56
  );
54
57
  }
55
58
 
@@ -58,8 +61,12 @@ export default function CountryTabPane(props) {
58
61
  for (let i = 0; i < element.value.length; i++) {
59
62
  _html_value += element.value[i];
60
63
  }
61
- // return <table>{_html_value}</table>;
62
- return <div dangerouslySetInnerHTML={{ __html: _html_value }}></div>;
64
+ return (
65
+ <div
66
+ key={indexKey}
67
+ dangerouslySetInnerHTML={{ __html: _html_value }}
68
+ ></div>
69
+ );
63
70
  }
64
71
  return null;
65
72
  })}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CountryTabPane from './CountryTabPane';
8
8
 
@@ -6,14 +6,14 @@ import { FormattedMessage } from 'react-intl';
6
6
  import './styles.less';
7
7
 
8
8
  export default function View(props) {
9
- // const dataJson = JSON.parse(
10
- // props?.properties['@components']?.countryprofile?.html,
11
- // );
12
- const dataJson = props?.properties['@components']?.countryprofile?.html || {};
9
+ const dataJson =
10
+ props?.properties?.['@components']?.countryprofile?.html || {};
11
+
13
12
  const [activePanes, setActivePanes] = React.useState({});
14
13
  const isNonEN = props?.properties?.language !== 'en';
15
14
 
16
15
  const panes = [];
16
+
17
17
  if (dataJson?.menu) {
18
18
  dataJson.menu.forEach((element, index) => {
19
19
  panes.push({
@@ -22,10 +22,10 @@ export default function View(props) {
22
22
  <TabPane>
23
23
  <CountryTabPane
24
24
  _index={index}
25
- contents={dataJson.content[index]}
25
+ contents={dataJson.content?.[index]}
26
26
  activePanes={activePanes}
27
27
  setActivePanes={setActivePanes}
28
- ></CountryTabPane>
28
+ />
29
29
  </TabPane>
30
30
  ),
31
31
  });
@@ -42,35 +42,39 @@ export default function View(props) {
42
42
  />
43
43
  </Message>
44
44
  )}
45
+
45
46
  {dataJson.message_top ? (
46
47
  <div className="eea callout">{dataJson.message_top}</div>
47
48
  ) : null}
49
+
48
50
  {dataJson.top_accordeon ? (
49
51
  <div className="top-accordion">
50
52
  {dataJson.top_accordeon.map((accordion, index) => (
51
- <Accordion className="secondary">
53
+ <Accordion className="secondary" key={accordion.title}>
52
54
  <Accordion.Title
53
55
  role="button"
54
56
  tabIndex={0}
55
- active={activePanes['_' + index] || false}
56
- onClick={(e) => {
57
- const temp = JSON.parse(JSON.stringify(activePanes));
58
- let val = temp['_' + index] || false;
59
- temp['_' + index] = !val;
60
- setActivePanes(temp);
57
+ active={activePanes[`_${index}`] || false}
58
+ onClick={() => {
59
+ setActivePanes({
60
+ ...activePanes,
61
+ [`_${index}`]: !(activePanes[`_${index}`] || false),
62
+ });
61
63
  }}
62
64
  >
63
65
  <span className="item-title">{accordion.title}</span>
64
66
  <Icon className="ri-arrow-down-s-line" />
65
67
  </Accordion.Title>
68
+
66
69
  <Accordion.Content
67
- active={activePanes['_' + index] || false}
70
+ active={activePanes[`_${index}`] || false}
68
71
  dangerouslySetInnerHTML={{ __html: accordion.value }}
69
- ></Accordion.Content>
72
+ />
70
73
  </Accordion>
71
74
  ))}
72
75
  </div>
73
76
  ) : null}
77
+
74
78
  <Tab
75
79
  className="secondary menu"
76
80
  panes={panes}
@@ -85,6 +89,7 @@ export default function View(props) {
85
89
  tabIndex: 0,
86
90
  }}
87
91
  />
92
+
88
93
  {dataJson.updated ? (
89
94
  <p>Reported updated until: {dataJson.updated}</p>
90
95
  ) : null}
@@ -1,39 +1,153 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
4
+ import { render, screen, fireEvent } from '@testing-library/react';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import View from './View';
8
8
 
9
+ jest.mock('./CountryTabPane', () => (props) => (
10
+ <div data-testid={`country-tab-pane-${props._index}`}>
11
+ CountryTabPane {props.contents}
12
+ </div>
13
+ ));
14
+
9
15
  const mockStore = configureStore();
10
16
 
17
+ const renderView = (properties) => {
18
+ const store = mockStore({
19
+ userSession: { token: '1234' },
20
+ intl: {
21
+ locale: 'en',
22
+ messages: {},
23
+ },
24
+ });
25
+
26
+ return render(
27
+ <Provider store={store}>
28
+ <MemoryRouter>
29
+ <View properties={properties} />
30
+ </MemoryRouter>
31
+ </Provider>,
32
+ );
33
+ };
34
+
11
35
  describe('View', () => {
12
- it('should render the component', () => {
13
- const properties = {
36
+ it('renders the component', () => {
37
+ const { container } = renderView({
38
+ language: 'en',
39
+ '@components': {
40
+ countryprofile: {
41
+ html: {
42
+ menu: [],
43
+ content: [],
44
+ },
45
+ },
46
+ },
47
+ });
48
+
49
+ expect(container).toBeTruthy();
50
+ });
51
+
52
+ it('renders non-English warning message', () => {
53
+ renderView({
54
+ language: 'ro',
14
55
  '@components': {
15
56
  countryprofile: {
16
- html: '{"menu":[],"content":[],"html":"","updated":"","message_top":"", "top_accordeon":""}',
57
+ html: {
58
+ menu: [],
59
+ content: [],
60
+ },
17
61
  },
18
62
  },
19
- };
20
- const data = { properties: properties };
21
-
22
- const store = mockStore({
23
- userSession: { token: '1234' },
24
- intl: {
25
- locale: 'en',
26
- messages: {},
63
+ });
64
+
65
+ expect(
66
+ screen.getByText(
67
+ 'Officially reported governmental information is only available in English',
68
+ ),
69
+ ).toBeInTheDocument();
70
+ });
71
+
72
+ it('renders top message', () => {
73
+ renderView({
74
+ language: 'en',
75
+ '@components': {
76
+ countryprofile: {
77
+ html: {
78
+ menu: [],
79
+ content: [],
80
+ message_top: 'This is the top message',
81
+ },
82
+ },
27
83
  },
28
84
  });
29
85
 
30
- const { container } = render(
31
- <Provider store={store}>
32
- <MemoryRouter>
33
- <View {...data} />
34
- </MemoryRouter>
35
- </Provider>,
86
+ expect(screen.getByText('This is the top message')).toBeInTheDocument();
87
+ });
88
+
89
+ it('renders updated date', () => {
90
+ renderView({
91
+ language: 'en',
92
+ '@components': {
93
+ countryprofile: {
94
+ html: {
95
+ menu: [],
96
+ content: [],
97
+ updated: '2024-01-01',
98
+ },
99
+ },
100
+ },
101
+ });
102
+
103
+ expect(
104
+ screen.getByText('Reported updated until: 2024-01-01'),
105
+ ).toBeInTheDocument();
106
+ });
107
+
108
+ it('renders and opens top accordion', () => {
109
+ renderView({
110
+ language: 'en',
111
+ '@components': {
112
+ countryprofile: {
113
+ html: {
114
+ menu: [],
115
+ content: [],
116
+ top_accordeon: [
117
+ {
118
+ title: 'Accordion title',
119
+ value: '<p>Accordion content</p>',
120
+ },
121
+ ],
122
+ },
123
+ },
124
+ },
125
+ });
126
+
127
+ expect(screen.getByText('Accordion title')).toBeInTheDocument();
128
+
129
+ fireEvent.click(screen.getByRole('button'));
130
+
131
+ expect(screen.getByText('Accordion content')).toBeInTheDocument();
132
+ });
133
+
134
+ it('renders tabs and CountryTabPane', () => {
135
+ renderView({
136
+ language: 'en',
137
+ '@components': {
138
+ countryprofile: {
139
+ html: {
140
+ menu: ['Tab one', 'Tab two'],
141
+ content: ['Content one', 'Content two'],
142
+ },
143
+ },
144
+ },
145
+ });
146
+
147
+ expect(screen.getByText('Tab one')).toBeInTheDocument();
148
+ expect(screen.getByText('Tab two')).toBeInTheDocument();
149
+ expect(screen.getByTestId('country-tab-pane-0')).toHaveTextContent(
150
+ 'Content one',
36
151
  );
37
- expect(container).toBeTruthy();
38
152
  });
39
153
  });
@@ -1,7 +1,6 @@
1
1
  import worldSVG from '@plone/volto/icons/world.svg';
2
2
  import Edit from './Edit';
3
3
  import View from './View';
4
- // import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
5
4
 
6
5
  export default function installCountryProfileDetailBlock(config) {
7
6
  config.blocks.blocksConfig.countryProfileDetail = {
@@ -1,12 +1,10 @@
1
1
  import { composeSchema } from '@eeacms/volto-cca-policy/schema-utils';
2
- // import { addLanguageParamField } from './schema';
3
2
  import DataConnectedEmbedBlockView from './DataConnectedEmbedBlockView';
4
3
 
5
4
  export default function applyConfig(config) {
6
5
  const { data_connected_embed } = config.blocks.blocksConfig;
7
6
 
8
7
  data_connected_embed.schemaEnhancer = composeSchema(
9
- // addLanguageParamField,
10
8
  data_connected_embed.schemaEnhancer,
11
9
  );
12
10
  data_connected_embed.view = DataConnectedEmbedBlockView;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import superagent from 'superagent';
3
3
  import { Dropdown, Grid } from 'semantic-ui-react';
4
- import { searchContent } from '@plone/volto/actions';
4
+ import { searchContent } from '@plone/volto/actions/search/search';
5
5
  import ECDEIndicator from './ECDEIndicator';
6
6
  import { useDispatch, useSelector } from 'react-redux';
7
7
  import { FormattedMessage } from 'react-intl';
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useSelector, useDispatch } from 'react-redux';
3
- import { getVocabulary } from '@plone/volto/actions';
4
- import { SidebarPortal } from '@plone/volto/components';
3
+ import { getVocabulary } from '@plone/volto/actions/vocabularies/vocabularies';
4
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
5
5
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
6
- import { BIOREGIONS, OTHER_REGIONS } from '@eeacms/volto-cca-policy/helpers';
6
+ import { BIOREGIONS, OTHER_REGIONS } from '@eeacms/volto-cca-policy/constants';
7
7
  import FilterSchema from './schema';
8
8
  import FilterAceContentView from './FilterAceContentView';
9
9
 
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import loadable from '@loadable/component';
3
3
  import ListingBody from '@plone/volto/components/manage/Blocks/Listing/ListingBody';
4
4
  import { useSelector, useDispatch } from 'react-redux';
5
- import { getVocabulary } from '@plone/volto/actions';
6
- import { OTHER_REGIONS } from '@eeacms/volto-cca-policy/helpers';
5
+ import { getVocabulary } from '@plone/volto/actions/vocabularies/vocabularies';
6
+ import { OTHER_REGIONS } from '@eeacms/volto-cca-policy/constants';
7
7
  import { Link } from 'react-router-dom';
8
8
  import {
9
9
  Option,
@@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import renderer from 'react-test-renderer';
5
5
 
6
- import '@testing-library/jest-dom/extend-expect';
6
+ import '@testing-library/jest-dom';
7
7
  import { Provider } from 'react-intl-redux';
8
8
  import FilterAceContentView from './FilterAceContentView';
9
9
 
@@ -1,4 +1,4 @@
1
- import { SidebarPortal } from '@plone/volto/components';
1
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
2
2
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
3
3
  import FlourishEmbedBlockView from './FlourishEmbedBlockView';
4
4
  import schema from './schema';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Link } from 'react-router-dom';
4
4
  import { Dropdown } from 'semantic-ui-react';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
6
6
  import { useIntl, defineMessages } from 'react-intl';
7
7
 
8
8
  import './styles.less';
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { useSelector } from 'react-redux';
5
5
  import { Icon, Accordion, Button } from 'semantic-ui-react';
6
- import { ConditionalLink } from '@plone/volto/components';
6
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
7
7
  import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
8
8
 
9
9
  import './styles.less';
@@ -7,9 +7,11 @@ import EventAccordionListingView from './EventAccordionListingView';
7
7
 
8
8
  const mockStore = configureStore();
9
9
 
10
- jest.mock('@plone/volto/components', () => ({
11
- ConditionalLink: ({ children }) => <div>{children}</div>,
12
- }));
10
+ jest.mock(
11
+ '@plone/volto/components/manage/ConditionalLink/ConditionalLink',
12
+ () =>
13
+ ({ children }) => <div>{children}</div>,
14
+ );
13
15
 
14
16
  jest.mock('@plone/volto/components/theme/View/EventDatesInfo', () => ({
15
17
  When: () => <div>Event Date Info</div>,
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { useSelector } from 'react-redux';
5
5
  import { Card, Grid, Icon, Label, Image } from 'semantic-ui-react';
6
- import { ConditionalLink, UniversalLink } from '@plone/volto/components';
6
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
7
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
7
8
  import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
8
9
  import { capitalizeFirstLetter } from '@eeacms/volto-cca-policy/helpers';
9
10
  import config from '@plone/volto/registry';
@@ -8,10 +8,16 @@ import EventCardsListingView from './EventCardsListingView';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
- jest.mock('@plone/volto/components', () => ({
12
- ConditionalLink: ({ children }) => <div>{children}</div>,
13
- UniversalLink: ({ children }) => <button>{children}</button>,
14
- }));
11
+ jest.mock(
12
+ '@plone/volto/components/manage/ConditionalLink/ConditionalLink',
13
+ () =>
14
+ ({ children }) => <div>{children}</div>,
15
+ );
16
+ jest.mock(
17
+ '@plone/volto/components/manage/UniversalLink/UniversalLink',
18
+ () =>
19
+ ({ children }) => <button>{children}</button>,
20
+ );
15
21
 
16
22
  jest.mock('@plone/volto/components/theme/View/EventDatesInfo', () => ({
17
23
  When: () => <span>EventDatesInfo</span>,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ConditionalLink } from '@plone/volto/components';
4
- import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
3
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
4
+ import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
5
5
 
6
6
  import './styles.less';
7
7
 
@@ -7,6 +7,8 @@ import {
7
7
  Card,
8
8
  } from 'semantic-ui-react';
9
9
 
10
+ import Image from '@plone/volto/components/theme/Image/Image';
11
+
10
12
  import './styles.less';
11
13
 
12
14
  const OrganisationCardsListingView = ({ items }) => {
@@ -18,7 +20,7 @@ const OrganisationCardsListingView = ({ items }) => {
18
20
  <CardHeader>
19
21
  <div className="image">
20
22
  <div className="img-container">
21
- <img
23
+ <Image
22
24
  src={item['@id'] + '/@@images/logo/preview'}
23
25
  alt={item.title}
24
26
  className="ui image"
@@ -6,7 +6,7 @@ import {
6
6
  CardHeader,
7
7
  CardContent,
8
8
  } from 'semantic-ui-react';
9
- import { ConditionalLink } from '@plone/volto/components';
9
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
10
10
 
11
11
  import './styles.less';
12
12
 
@@ -8,9 +8,11 @@ import SimpleCardsListingView from './SimpleCardsListingView';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
- jest.mock('@plone/volto/components', () => ({
12
- ConditionalLink: ({ children }) => <div>{children}</div>,
13
- }));
11
+ jest.mock(
12
+ '@plone/volto/components/manage/ConditionalLink/ConditionalLink',
13
+ () =>
14
+ ({ children }) => <div>{children}</div>,
15
+ );
14
16
 
15
17
  describe('SimpleCardsListingView', () => {
16
18
  it('renders card titles and placeholders when no image', () => {
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
- import { ConditionalLink } from '@plone/volto/components';
3
- import { getBaseUrl } from '@plone/volto/helpers';
2
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
3
+ import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
4
4
 
5
5
  const SimpleItemListingView = ({ items, isEditMode }) => {
6
6
  return (
@@ -8,11 +8,13 @@ import SimpleItemListingView from './SimpleItemListingView';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
- jest.mock('@plone/volto/components', () => ({
12
- ConditionalLink: ({ children }) => <div>{children}</div>,
13
- }));
11
+ jest.mock(
12
+ '@plone/volto/components/manage/ConditionalLink/ConditionalLink',
13
+ () =>
14
+ ({ children }) => <div>{children}</div>,
15
+ );
14
16
 
15
- jest.mock('@plone/volto/helpers', () => ({
17
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
16
18
  getBaseUrl: (id) => id,
17
19
  }));
18
20
 
@@ -51,5 +51,4 @@ export function ContextNavigationComponent(props) {
51
51
  );
52
52
  }
53
53
 
54
- // withContentNavigation
55
54
  export default compose()(ContextNavigationComponent);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Accordion } from 'semantic-ui-react';
3
3
  import { useHistory } from 'react-router-dom';
4
- import { Icon } from '@plone/volto/components';
4
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
5
5
 
6
6
  import RASTAccordionContent from './RASTAccordionContent';
7
7
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import RASTAccordion from './RASTAccordion';
8
8
 
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { List } from 'semantic-ui-react';
3
3
  import { Link } from 'react-router-dom';
4
4
  import { compose } from 'redux';
5
- import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
5
+ import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
6
6
  import { useDispatch, useSelector } from 'react-redux';
7
- import { getContent } from '@plone/volto/actions';
7
+ import { getContent } from '@plone/volto/actions/content/content';
8
8
 
9
9
  import cx from 'classnames';
10
10
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { SidebarPortal } from '@plone/volto/components';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
4
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
5
 
6
6
  import RASTView from './RASTView';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { UniversalLink } from '@plone/volto/components';
2
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
3
3
  import cx from 'classnames';
4
4
  import './styles.less';
5
5
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import RASTMap from './RASTMap';
8
8
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import './styles.less';
3
3
  import ContextNavigation from './ContextNavigation';
4
4
  import { useDispatch, useSelector } from 'react-redux';
5
- import { getContent } from '@plone/volto/actions';
5
+ import { getContent } from '@plone/volto/actions/content/content';
6
6
 
7
7
  function useChildren(location) {
8
8
  const dispatch = useDispatch();