@eeacms/volto-cca-policy 0.3.129 → 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 (182) hide show
  1. package/.eslintrc.js +7 -7
  2. package/CHANGELOG.md +19 -13
  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/CountryMapProfile/styles.less +1 -1
  42. package/src/components/manage/Blocks/CountryProfileDetail/{CountryTabPane.js → CountryTabPane.jsx} +11 -4
  43. package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.test.jsx +1 -1
  44. package/src/components/manage/Blocks/CountryProfileDetail/{View.js → View.jsx} +20 -15
  45. package/src/components/manage/Blocks/CountryProfileDetail/View.test.jsx +134 -20
  46. package/src/components/manage/Blocks/CountryProfileDetail/index.js +0 -1
  47. package/src/components/manage/Blocks/DataConnectedEmbedBlock/index.js +0 -2
  48. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsView.jsx +1 -1
  49. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentEdit.jsx +3 -3
  50. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +2 -2
  51. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.test.jsx +1 -1
  52. package/src/components/manage/Blocks/FlourishEmbedBlock/FlourishEmbedBlockEdit.jsx +1 -1
  53. package/src/components/manage/Blocks/Listing/DropdownListingView.jsx +1 -1
  54. package/src/components/manage/Blocks/Listing/EventAccordionListingView.jsx +1 -1
  55. package/src/components/manage/Blocks/Listing/EventAccordionListingView.test.jsx +5 -3
  56. package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +2 -1
  57. package/src/components/manage/Blocks/Listing/EventCardsListingView.test.jsx +10 -4
  58. package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +2 -2
  59. package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +3 -1
  60. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.jsx +1 -1
  61. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.test.jsx +5 -3
  62. package/src/components/manage/Blocks/Listing/SimpleItemListingView.jsx +2 -2
  63. package/src/components/manage/Blocks/Listing/SimpleItemListingView.test.jsx +6 -4
  64. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +0 -1
  65. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +1 -1
  66. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +1 -1
  67. package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +2 -2
  68. package/src/components/manage/Blocks/RASTBlock/RASTEdit.jsx +1 -1
  69. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +1 -1
  70. package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +1 -1
  71. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +1 -1
  72. package/src/components/manage/Blocks/ReadMore/ReadMoreEdit.jsx +1 -1
  73. package/src/components/manage/Blocks/ReadMore/ReadMoreView.jsx +1 -1
  74. package/src/components/manage/Blocks/ReadMore/ReadMoreView.test.jsx +1 -1
  75. package/src/components/manage/Blocks/RedirectBlock/{RedirectBlock.test.js → RedirectBlock.test.jsx} +1 -1
  76. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockEdit.jsx +2 -1
  77. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockView.jsx +2 -2
  78. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentEdit.jsx +1 -1
  79. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +1 -1
  80. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.test.jsx +1 -1
  81. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentEdit.jsx +1 -1
  82. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +1 -1
  83. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +1 -1
  84. package/src/components/manage/Blocks/TabsBlock/Spotlight.jsx +2 -2
  85. package/src/components/manage/Blocks/TabsBlock/Spotlight.test.jsx +7 -1
  86. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectEdit.jsx +1 -1
  87. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +1 -1
  88. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.test.jsx +1 -1
  89. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.jsx +5 -2
  90. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.test.jsx +3 -6
  91. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.jsx +1 -1
  92. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.test.jsx +1 -1
  93. package/src/components/theme/ASTNavigation/ASTAccordion.test.jsx +1 -1
  94. package/src/components/theme/ASTNavigation/ASTLogoMap.jsx +1 -1
  95. package/src/components/theme/ASTNavigation/ASTLogoMap.test.jsx +1 -1
  96. package/src/components/theme/ASTNavigation/ASTNavigation.jsx +9 -5
  97. package/src/components/theme/ASTNavigation/ASTNavigation.test.jsx +323 -0
  98. package/src/components/theme/ASTNavigation/{utils.js → LinkWrap.jsx} +4 -9
  99. package/src/components/theme/ASTNavigation/UASTLogoMap.jsx +1 -1
  100. package/src/components/theme/ASTNavigation/UASTLogoMap.test.jsx +1 -1
  101. package/src/components/theme/Header/Header.jsx +5 -5
  102. package/src/components/theme/Header/LanguageSwitch.jsx +5 -5
  103. package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.jsx +1 -1
  104. package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +1 -1
  105. package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +1 -1
  106. package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
  107. package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -3
  108. package/src/components/theme/Views/ArchivedVersionListing.jsx +1 -1
  109. package/src/components/theme/Views/ArchivedVersionListing.test.jsx +2 -2
  110. package/src/components/theme/Views/ArchivedVersionNotice.jsx +1 -1
  111. package/src/components/theme/Views/ArchivedVersionNotice.test.jsx +1 -1
  112. package/src/components/theme/Views/BrokenLinks.jsx +1 -1
  113. package/src/components/theme/Views/BrokenLinks.test.jsx +1 -1
  114. package/src/components/theme/Views/CaseStudyView.test.jsx +1 -1
  115. package/src/components/theme/Views/DatabaseItemView.test.jsx +1 -1
  116. package/src/components/theme/Views/NewsItemView.jsx +1 -1
  117. package/src/components/theme/Views/ProjectView.test.jsx +1 -1
  118. package/src/components/theme/Views/VersionsGroup.jsx +1 -1
  119. package/src/components/theme/Views/VersionsGroup.test.jsx +1 -1
  120. package/src/components/theme/Widgets/GeocharsWidget.jsx +1 -1
  121. package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -1
  122. package/src/components/theme/Widgets/GeolocationWidget.test.jsx +1 -1
  123. package/src/components/theme/Widgets/ImageWidget.jsx +7 -8
  124. package/src/components/theme/Widgets/ImageWidget.test.jsx +1 -1
  125. package/src/components/theme/Widgets/PromotionalImageWidget.jsx +6 -4
  126. package/src/components/theme/Widgets/utils.js +1 -1
  127. package/src/constants.js +538 -2
  128. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
  129. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +52 -24
  130. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +1 -0
  131. package/src/customizations/@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground.jsx +2 -1
  132. package/src/customizations/@eeacms/volto-listing-block/blocks/Listing/item-templates/SimpleItemTemplates.jsx +2 -2
  133. package/src/customizations/@eeacms/volto-listing-block/components/UniversalCard/fragments/CardTitle.jsx +1 -1
  134. package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
  135. package/src/customizations/@plone/volto-slate/blocks/Text/{index.js → index.jsx} +2 -21
  136. package/src/customizations/@plone/volto-slate/editor/extensions/normalizeNode.js +1 -1
  137. package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
  138. package/src/customizations/@plone/volto-slate/utils/volto-blocks.js +2 -2
  139. package/src/customizations/@plone/volto-slate/widgets/HtmlSlateWidget.jsx +2 -2
  140. package/src/customizations/@plone-collective/volto-authomatic/components/Login/Login.jsx +7 -4
  141. package/src/customizations/@plone-collective/volto-rss-provider/components/RSSFeedView.jsx +5 -8
  142. package/src/customizations/@plone-collective/volto-rss-provider/express-middleware.js +2 -1
  143. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +3 -3
  144. package/src/customizations/volto/components/manage/Blocks/Grid/templates.js +1 -1
  145. package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +1 -1
  146. package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +12 -14
  147. package/src/customizations/volto/components/manage/Display/Display.jsx +10 -5
  148. package/src/customizations/volto/components/manage/Multilingual/TranslationObject.jsx +7 -6
  149. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +4 -1
  150. package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +12 -8
  151. package/src/customizations/volto/components/theme/App/App.jsx +16 -23
  152. package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +3 -2
  153. package/src/customizations/volto/components/theme/View/DefaultView.jsx +5 -4
  154. package/src/customizations/volto/components/theme/View/LinkView.jsx +2 -2
  155. package/src/customizations/volto/components/theme/View/View.jsx +10 -11
  156. package/src/customizations/volto/helpers/Url/Url-old.js +2 -1
  157. package/src/customizations/volto/middleware/api.js +6 -4
  158. package/src/customizations/volto/reducers/actions/actions.js +2 -5
  159. package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
  160. package/src/customizations/volto/reducers/navigation/navigation.js +3 -6
  161. package/src/customizations/volto/server.jsx +9 -8
  162. package/src/express-middleware.js +1 -1
  163. package/src/helpers/ContentMetadata.jsx +4 -4
  164. package/src/helpers/Utils.jsx +5 -5
  165. package/src/helpers/index.js +1 -8
  166. package/src/hocs/index.js +2 -0
  167. package/src/index.js +9 -7
  168. package/src/search/common.js +4 -41
  169. package/src/search/utils.test.js +1 -1
  170. package/src/search/vocabulary.js +2 -2
  171. package/src/store/reducers/physical-breadcrumbs.js +2 -2
  172. package/src/utils.js +1 -1
  173. package/src/helpers/Constants.jsx +0 -535
  174. package/theme/assets/images/administrative_support_service.png +0 -0
  175. /package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerEdit.js → CaseStudyExplorerEdit.jsx} +0 -0
  176. /package/src/components/manage/Blocks/CountryMapHeatIndex/{Edit.js → Edit.jsx} +0 -0
  177. /package/src/components/manage/Blocks/CountryMapProfile/{Edit.js → Edit.jsx} +0 -0
  178. /package/src/components/manage/Blocks/CountryProfileDetail/{Edit.js → Edit.jsx} +0 -0
  179. /package/src/components/manage/Blocks/ReadMore/{schema.js → schema.jsx} +0 -0
  180. /package/src/helpers/{clientOnly.js → clientOnly.jsx} +0 -0
  181. /package/src/{components/manage/Blocks/withResponsiveContainer.js → hocs/withResponsiveContainer.jsx} +0 -0
  182. /package/src/{components/manage/Blocks → hocs}/withVisibilitySensor.jsx +0 -0
@@ -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();
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SidebarPortal } from '@plone/volto/components';
2
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
3
3
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
4
4
  import ReadMoreView from './ReadMoreView';
5
5
  import schema from './schema';
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
2
  import { Button, Icon } from 'semantic-ui-react';
3
- import { BodyClass } from '@plone/volto/helpers';
3
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
4
4
  import cx from 'classnames';
5
5
 
6
6
  import './style.less';
@@ -1,4 +1,4 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import ReadMoreView from './ReadMoreView';
4
4
 
@@ -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 { RedirectBlockDetails } from './RedirectBlockView';
8
8
 
@@ -1,4 +1,5 @@
1
- import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
1
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
2
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
2
3
  import { RedirectBlockDetails } from './RedirectBlockView';
3
4
  import Schema from './schema';
4
5
 
@@ -1,7 +1,7 @@
1
- import { UniversalLink } from '@plone/volto/components';
1
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
2
2
  import React from 'react';
3
3
  import { useHistory } from 'react-router-dom';
4
- import { flattenToAppURL } from '@plone/volto/helpers';
4
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
5
 
6
6
  export function RedirectBlockDetails({ data, token }) {
7
7
  return token ? (
@@ -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 schema from './schema';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { List, ListItem, ListContent, ListIcon } from 'semantic-ui-react';
3
3
  import { Link } from 'react-router-dom';
4
- import { flattenToAppURL } from '@plone/volto/helpers';
4
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
5
 
6
6
  const RelevantAceContentView = (props) => {
7
7
  const { data, mode = 'view' } = props;
@@ -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 RelevantAceContentView from './RelevantAceContentView';
9
9
 
@@ -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 schema from './schema';
@@ -1,6 +1,6 @@
1
1
  import { List, Icon, ListItem, ListContent, ListIcon } from 'semantic-ui-react';
2
2
  import { Link } from 'react-router-dom';
3
- import { flattenToAppURL } from '@plone/volto/helpers';
3
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
4
4
  import { useIntl, FormattedMessage } from 'react-intl';
5
5
 
6
6
  export default function SearchAceContentView(props) {
@@ -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 SearchAceContentView from './SearchAceContentView';
9
9
 
@@ -3,14 +3,14 @@ import { compose } from 'redux';
3
3
  import { withRouter } from 'react-router';
4
4
  import cx from 'classnames';
5
5
  import { Menu, Tab, Container, Icon, Image } from 'semantic-ui-react';
6
- import { RenderBlocks } from '@plone/volto/components';
6
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
7
7
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
8
8
  import {
9
9
  SimpleMarkdown,
10
10
  getMenuPosition,
11
11
  } from '@eeacms/volto-tabs-block/utils';
12
12
 
13
- import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
13
+ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
14
14
 
15
15
  import '@eeacms/volto-tabs-block/less/menu.less';
16
16
  import './spotlight.less';
@@ -1,4 +1,4 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
2
2
 
3
3
  import { render } from '@testing-library/react';
4
4
  import React from 'react';
@@ -8,6 +8,12 @@ import { Provider } from 'react-intl-redux';
8
8
 
9
9
  import Spotlight from './Spotlight';
10
10
 
11
+ jest.mock('@eeacms/volto-tabs-block/hocs', () => ({
12
+ withScrollToTarget: (WrappedComponent) => (props) => (
13
+ <WrappedComponent {...props} scrollToTarget={jest.fn()} />
14
+ ),
15
+ }));
16
+
11
17
  const mockStore = configureStore();
12
18
 
13
19
  describe('Filter', () => {
@@ -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 schema from './schema';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { Dropdown } from 'semantic-ui-react';
4
4
  import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
6
6
 
7
7
  const messages = defineMessages({
8
8
  chooseARegion: {
@@ -1,4 +1,4 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import { MemoryRouter } from 'react-router-dom';
4
4
  import { Provider } from 'react-intl-redux';
@@ -4,8 +4,11 @@ import { Plug } from '@plone/volto/components/manage/Pluggable';
4
4
  import { Modal, Button, Form, Message } from 'semantic-ui-react';
5
5
  import superagent from 'superagent';
6
6
  import { toast } from 'react-toastify';
7
- import { Toast } from '@plone/volto/components';
8
- import { flattenToAppURL, expandToBackendURL } from '@plone/volto/helpers';
7
+ import Toast from '@plone/volto/components/manage/Toast/Toast';
8
+ import {
9
+ flattenToAppURL,
10
+ expandToBackendURL,
11
+ } from '@plone/volto/helpers/Url/Url';
9
12
  import { INDICATOR } from '@eeacms/volto-cca-policy/constants';
10
13
 
11
14
  function CreateArchivedCopyButton(props) {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-intl-redux';
6
6
  import { render, fireEvent } from '@testing-library/react';
7
7
  import CreateArchivedCopyButton from './CreateArchivedCopyButton';
@@ -29,11 +29,8 @@ jest.mock('react-toastify', () => ({
29
29
  toast: { success: jest.fn(), error: jest.fn() },
30
30
  }));
31
31
 
32
- jest.mock('@plone/volto/components', () => ({
33
- Toast: () => null,
34
- }));
35
-
36
- jest.mock('@plone/volto/helpers', () => ({
32
+ jest.mock('@plone/volto/components/manage/Toast/Toast', () => () => null);
33
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
37
34
  flattenToAppURL: (url) => url.replace('http://localhost:3000', ''),
38
35
  expandToBackendURL: (url) =>
39
36
  url.replace('http://localhost:3000', 'http://localhost:8080/Plone'),
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { useSelector } from 'react-redux';
5
5
  import { Link } from 'react-router-dom';
6
6
  import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
7
- import { flattenToAppURL } from '@plone/volto/helpers';
7
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
8
8
 
9
9
  const messages = defineMessages({
10
10
  confirmHeader: {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-intl-redux';
6
6
  import { render, screen } from '@testing-library/react';
7
7
  import WorkflowLinkIntegrityModal from './WorkflowLinkIntegrityModal';
@@ -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 ASTAccordion from './ASTAccordion';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkWrap } from './utils';
2
+ import { LinkWrap } from './LinkWrap';
3
3
 
4
4
  export default function ASTLogoMap(props) {
5
5
  const { pathname, items, href } = props;
@@ -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 ASTLogoMap from './ASTLogoMap';
8
8
 
@@ -1,14 +1,18 @@
1
1
  import React from 'react';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
- import { searchContent } from '@plone/volto/actions';
3
+ import { searchContent } from '@plone/volto/actions/search/search';
4
4
  import { useLocation } from 'react-router-dom';
5
5
  import ASTAccordion from './ASTAccordion';
6
- import {
7
- isAdaptationSupportToolURL,
8
- isUrbanAdaptationSupportToolURL,
9
- } from './utils';
10
6
  import './styles.less';
11
7
 
8
+ const isAdaptationSupportToolURL = (url) => {
9
+ return url.includes('/knowledge/tools/adaptation-support-tool');
10
+ };
11
+
12
+ const isUrbanAdaptationSupportToolURL = (url) => {
13
+ return url.includes('/knowledge/tools/urban-ast');
14
+ };
15
+
12
16
  const ASTNavigation = (props) => {
13
17
  const dispatch = useDispatch();
14
18
  const location = useLocation();
@@ -0,0 +1,323 @@
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render } from '@testing-library/react';
4
+ import { Provider } from 'react-redux';
5
+ import { MemoryRouter } from 'react-router-dom';
6
+ import configureStore from 'redux-mock-store';
7
+ import { IntlProvider } from 'react-intl';
8
+ import ASTNavigation from './ASTNavigation';
9
+ import * as searchActions from '@plone/volto/actions/search/search';
10
+
11
+ const mockStore = configureStore();
12
+
13
+ jest.mock('@plone/volto/actions/search/search', () => ({
14
+ searchContent: jest.fn(() => ({
15
+ type: 'SEARCH_CONTENT',
16
+ payload: {},
17
+ })),
18
+ }));
19
+
20
+ jest.mock('./ASTAccordion', () => {
21
+ return function MockASTAccordion() {
22
+ return <div data-testid="ast-accordion">ASTAccordion</div>;
23
+ };
24
+ });
25
+
26
+ describe('ASTNavigation', () => {
27
+ const defaultProps = {
28
+ astNavigation: {
29
+ root_path: 'knowledge/tools/adaptation-support-tool',
30
+ },
31
+ };
32
+
33
+ const mockLocation = {
34
+ pathname: '/en/knowledge/tools/adaptation-support-tool',
35
+ };
36
+
37
+ beforeEach(() => {
38
+ jest.clearAllMocks();
39
+ });
40
+
41
+ it('should render the navigation wrapper with ASTAccordion when items exist', () => {
42
+ const items = [
43
+ {
44
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
45
+ title: 'Step 1',
46
+ },
47
+ {
48
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-2',
49
+ title: 'Step 2',
50
+ },
51
+ ];
52
+
53
+ const store = mockStore({
54
+ intl: {
55
+ locale: 'en',
56
+ messages: {},
57
+ },
58
+ search: {
59
+ subrequests: {
60
+ ast: {
61
+ items: items,
62
+ },
63
+ },
64
+ },
65
+ });
66
+
67
+ const { container, getByTestId } = render(
68
+ <Provider store={store}>
69
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
70
+ <IntlProvider locale="en" messages={{}}>
71
+ <ASTNavigation {...defaultProps} />
72
+ </IntlProvider>
73
+ </MemoryRouter>
74
+ </Provider>,
75
+ );
76
+
77
+ const navigationDiv = container.querySelector('.ast-navigation');
78
+ expect(navigationDiv).toBeInTheDocument();
79
+ expect(getByTestId('ast-accordion')).toBeInTheDocument();
80
+ });
81
+
82
+ it('should not render anything when no items exist', () => {
83
+ const store = mockStore({
84
+ intl: {
85
+ locale: 'en',
86
+ messages: {},
87
+ },
88
+ search: {
89
+ subrequests: {
90
+ ast: {
91
+ items: [],
92
+ },
93
+ },
94
+ },
95
+ });
96
+
97
+ const { container } = render(
98
+ <Provider store={store}>
99
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
100
+ <IntlProvider locale="en" messages={{}}>
101
+ <ASTNavigation {...defaultProps} />
102
+ </IntlProvider>
103
+ </MemoryRouter>
104
+ </Provider>,
105
+ );
106
+
107
+ expect(container.querySelector('.ast-navigation')).not.toBeInTheDocument();
108
+ });
109
+
110
+ it('should not render anything when items are undefined', () => {
111
+ const store = mockStore({
112
+ intl: {
113
+ locale: 'en',
114
+ messages: {},
115
+ },
116
+ search: {
117
+ subrequests: null,
118
+ },
119
+ });
120
+
121
+ const { container } = render(
122
+ <Provider store={store}>
123
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
124
+ <IntlProvider locale="en" messages={{}}>
125
+ <ASTNavigation {...defaultProps} />
126
+ </IntlProvider>
127
+ </MemoryRouter>
128
+ </Provider>,
129
+ );
130
+
131
+ expect(container.querySelector('.ast-navigation')).not.toBeInTheDocument();
132
+ });
133
+
134
+ it('should dispatch searchContent for adaptation support tool', () => {
135
+ const items = [
136
+ {
137
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
138
+ title: 'Step 1',
139
+ },
140
+ ];
141
+
142
+ const store = mockStore({
143
+ intl: {
144
+ locale: 'en',
145
+ messages: {},
146
+ },
147
+ search: {
148
+ subrequests: {
149
+ ast: {
150
+ items: items,
151
+ },
152
+ },
153
+ },
154
+ });
155
+
156
+ store.dispatch = jest.fn();
157
+
158
+ render(
159
+ <Provider store={store}>
160
+ <MemoryRouter
161
+ initialEntries={['/en/knowledge/tools/adaptation-support-tool']}
162
+ >
163
+ <IntlProvider locale="en" messages={{}}>
164
+ <ASTNavigation
165
+ {...defaultProps}
166
+ astNavigation={{
167
+ root_path: 'knowledge/tools/adaptation-support-tool',
168
+ }}
169
+ />
170
+ </IntlProvider>
171
+ </MemoryRouter>
172
+ </Provider>,
173
+ );
174
+
175
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
176
+ '/en/knowledge/tools/adaptation-support-tool',
177
+ {
178
+ 'path.depth': 1,
179
+ portal_type: ['Folder'],
180
+ object_provides: 'eea.climateadapt.interfaces.ICover',
181
+ review_state: 'published',
182
+ b_size: 100,
183
+ },
184
+ 'ast',
185
+ );
186
+ });
187
+
188
+ it('should dispatch searchContent for urban adaptation support tool', () => {
189
+ const items = [
190
+ {
191
+ '@id': '/en/knowledge/tools/urban-ast/step-1',
192
+ title: 'Step 1',
193
+ },
194
+ ];
195
+
196
+ const store = mockStore({
197
+ intl: {
198
+ locale: 'en',
199
+ messages: {},
200
+ },
201
+ search: {
202
+ subrequests: {
203
+ ast: {
204
+ items: items,
205
+ },
206
+ },
207
+ },
208
+ });
209
+
210
+ store.dispatch = jest.fn();
211
+
212
+ render(
213
+ <Provider store={store}>
214
+ <MemoryRouter initialEntries={['/en/knowledge/tools/urban-ast']}>
215
+ <IntlProvider locale="en" messages={{}}>
216
+ <ASTNavigation
217
+ {...defaultProps}
218
+ astNavigation={{
219
+ root_path: 'knowledge/tools/urban-ast',
220
+ }}
221
+ />
222
+ </IntlProvider>
223
+ </MemoryRouter>
224
+ </Provider>,
225
+ );
226
+
227
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
228
+ '/en/knowledge/tools/urban-ast',
229
+ {
230
+ 'path.depth': 1,
231
+ portal_type: ['Folder'],
232
+ review_state: 'published',
233
+ b_size: 100,
234
+ },
235
+ 'ast',
236
+ );
237
+ });
238
+
239
+ it('should pass correct props to ASTAccordion', () => {
240
+ const items = [
241
+ {
242
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
243
+ title: 'Step 1',
244
+ },
245
+ ];
246
+
247
+ const store = mockStore({
248
+ intl: {
249
+ locale: 'en',
250
+ messages: {},
251
+ },
252
+ search: {
253
+ subrequests: {
254
+ ast: {
255
+ items: items,
256
+ },
257
+ },
258
+ },
259
+ });
260
+
261
+ const { getByTestId } = render(
262
+ <Provider store={store}>
263
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
264
+ <IntlProvider locale="en" messages={{}}>
265
+ <ASTNavigation {...defaultProps} />
266
+ </IntlProvider>
267
+ </MemoryRouter>
268
+ </Provider>,
269
+ );
270
+
271
+ expect(getByTestId('ast-accordion')).toBeInTheDocument();
272
+ });
273
+
274
+ it('should handle different language locales', () => {
275
+ const items = [
276
+ {
277
+ '@id': '/fr/knowledge/tools/adaptation-support-tool/step-1',
278
+ title: 'Étape 1',
279
+ },
280
+ ];
281
+
282
+ const store = mockStore({
283
+ intl: {
284
+ locale: 'fr',
285
+ messages: {},
286
+ },
287
+ search: {
288
+ subrequests: {
289
+ ast: {
290
+ items: items,
291
+ },
292
+ },
293
+ },
294
+ });
295
+
296
+ store.dispatch = jest.fn();
297
+
298
+ const { container } = render(
299
+ <Provider store={store}>
300
+ <MemoryRouter
301
+ initialEntries={['/fr/knowledge/tools/adaptation-support-tool']}
302
+ >
303
+ <IntlProvider locale="fr" messages={{}}>
304
+ <ASTNavigation
305
+ {...defaultProps}
306
+ astNavigation={{
307
+ root_path: 'knowledge/tools/adaptation-support-tool',
308
+ }}
309
+ />
310
+ </IntlProvider>
311
+ </MemoryRouter>
312
+ </Provider>,
313
+ );
314
+
315
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
316
+ '/fr/knowledge/tools/adaptation-support-tool',
317
+ expect.any(Object),
318
+ 'ast',
319
+ );
320
+
321
+ expect(container.querySelector('.ast-navigation')).toBeInTheDocument();
322
+ });
323
+ });
@@ -1,14 +1,7 @@
1
- import { UniversalLink } from '@plone/volto/components';
1
+ import React from 'react';
2
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
2
3
  import cx from 'classnames';
3
4
 
4
- export const isAdaptationSupportToolURL = (url) => {
5
- return url.indexOf('/knowledge/tools/adaptation-support-tool') > -1;
6
- };
7
-
8
- export const isUrbanAdaptationSupportToolURL = (url) => {
9
- return url.indexOf('/knowledge/tools/urban-ast') > -1;
10
- };
11
-
12
5
  export const LinkWrap = ({ item, pathname, children, className }) => {
13
6
  const substeps = item?.items || [];
14
7
  const activeSubstep = substeps.some((obj) => obj['@id'] === pathname);
@@ -29,3 +22,5 @@ export const LinkWrap = ({ item, pathname, children, className }) => {
29
22
  <g>{children}</g>
30
23
  );
31
24
  };
25
+
26
+ export default LinkWrap;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkWrap } from './utils';
2
+ import { LinkWrap } from './LinkWrap';
3
3
 
4
4
  export default function UASTLogoMap(props) {
5
5
  const { pathname, items, href } = props;
@@ -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 UASTLogoMap from './UASTLogoMap';
8
8