@eeacms/volto-eea-website-theme 3.19.1 → 4.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.
- package/.eslintrc.js +7 -6
- package/CHANGELOG.md +19 -26
- package/DEVELOP.md +19 -17
- package/README.md +19 -7
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +8 -4
- package/package.json +1 -1
- package/src/actions/navigation.js +1 -1
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +4 -2
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.test.jsx +25 -19
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +2 -1
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.test.jsx +6 -4
- package/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +2 -2
- package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.jsx +4 -2
- package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.test.jsx +1 -1
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup.jsx +12 -44
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/RenderBlocks.jsx +5 -4
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/editor-flex.less +45 -4
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +2 -1
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.test.jsx +12 -4
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +1 -1
- package/src/components/manage/Blocks/Title/Edit.jsx +3 -3
- package/src/components/manage/Blocks/Title/View.jsx +2 -1
- package/src/components/manage/Blocks/Title/variations/WebReport.jsx +2 -2
- package/src/components/manage/Blocks/Title/variations/WebReport.test.jsx +6 -4
- package/src/components/manage/Blocks/Title/variations/WebReportPage.jsx +2 -2
- package/src/components/manage/Blocks/Title/variations/WebReportPage.test.jsx +6 -4
- package/src/components/theme/Banner/View.jsx +1 -1
- package/src/components/theme/BaseTag.jsx +2 -1
- package/src/components/theme/BaseTag.test.jsx +7 -2
- package/src/components/theme/DraftBackground/DraftBackground.jsx +2 -1
- package/src/components/theme/Homepage/HomePageInverseView.jsx +3 -3
- package/src/components/theme/Homepage/HomePageInverseView.test.jsx +1 -1
- package/src/components/theme/Homepage/HomePageView.jsx +3 -3
- package/src/components/theme/Homepage/HomePageView.test.jsx +1 -1
- package/src/components/theme/Logo.jsx +3 -3
- package/src/components/theme/NotFound/GoneView.jsx +3 -2
- package/src/components/theme/NotFound/GoneView.test.jsx +5 -4
- package/src/components/theme/NotFound/NotFound.jsx +1 -1
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -2
- package/src/components/theme/PrintLoader/PrintLoader.test.jsx +1 -1
- package/src/components/theme/SubsiteClass.jsx +6 -4
- package/src/components/theme/SubsiteClass.test.jsx +3 -2
- package/src/components/theme/WebReport/WebReportSectionView.jsx +2 -2
- package/src/components/theme/WebReport/WebReportSectionView.test.jsx +10 -5
- package/src/components/theme/Widgets/ADUserGroupSelectWidget.jsx +2 -2
- package/src/components/theme/Widgets/ContributorsViewWidget.jsx +1 -1
- package/src/components/theme/Widgets/CreatableSelectWidget.jsx +7 -4
- package/src/components/theme/Widgets/CreatorsViewWidget.jsx +1 -1
- package/src/components/theme/Widgets/DateWidget.jsx +1 -1
- package/src/components/theme/Widgets/DateWidget.test.js +1 -1
- package/src/components/theme/Widgets/DatetimeWidget.jsx +1 -1
- package/src/components/theme/Widgets/DatetimeWidget.test.js +1 -1
- package/src/components/theme/Widgets/ImageViewWidget.jsx +1 -0
- package/src/components/theme/Widgets/NavigationBehaviorWidget.jsx +7 -3
- package/src/components/theme/Widgets/NavigationBehaviorWidget.test.jsx +51 -46
- package/src/components/theme/Widgets/UserSelectWidget.jsx +13 -10
- package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
- package/src/customizations/@plone/volto-slate/blocks/Text/TextBlockView.jsx +2 -2
- package/src/customizations/@plone/volto-slate/editor/SlateEditor.jsx +23 -10
- package/src/customizations/@plone/volto-slate/editor/render.jsx +7 -3
- package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +2 -2
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +30 -27
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +244 -246
- package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +23 -25
- package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +6 -4
- package/src/customizations/volto/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +4 -2
- package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +2 -2
- package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.jsx +1 -1
- package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +108 -42
- package/src/customizations/volto/components/manage/Diff/DiffField.jsx +4 -3
- package/src/customizations/volto/components/manage/Display/Display.jsx +8 -7
- package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserBody.jsx +42 -21
- package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- package/src/customizations/volto/components/manage/Sidebar/SidebarPopup.jsx +46 -24
- package/src/customizations/volto/components/manage/Sidebar/objectBrowserSelection.js +58 -0
- package/src/customizations/volto/components/manage/Toolbar/More.jsx +8 -10
- package/src/customizations/volto/components/manage/Widgets/NumberWidget.jsx +1 -1
- package/src/customizations/volto/components/manage/Widgets/NumberWidget.test.jsx +6 -1
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +66 -12
- package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +10 -9
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +3 -2
- package/src/customizations/volto/components/theme/Comments/Comments.jsx +9 -8
- package/src/customizations/volto/components/theme/Comments/Comments.test.jsx +29 -7
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.jsx +1 -1
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.test.js +5 -0
- package/src/customizations/volto/components/theme/ContentMetadataTags/ContentMetadataTags.jsx +5 -7
- package/src/customizations/volto/components/theme/EventDetails/EventDetails.jsx +2 -2
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -1
- package/src/customizations/volto/components/theme/Header/Header.jsx +10 -8
- package/src/customizations/volto/components/theme/Header/Header.test.jsx +1 -1
- package/src/customizations/volto/components/theme/Header/LanguageSwitcher.jsx +3 -3
- package/src/customizations/volto/components/theme/Image/Image.jsx +4 -3
- package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +1 -1
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +4 -3
- package/src/customizations/volto/components/theme/View/EventView.jsx +3 -2
- package/src/customizations/volto/helpers/Html/Html.jsx +16 -6
- package/src/customizations/volto/helpers/Html/Readme.md +7 -1
- package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
- package/src/customizations/volto/server.jsx +10 -10
- package/src/helpers/schema-utils.js +1 -1
- package/src/helpers/schema-utils.test.js +1 -1
- package/src/hocs/withErrorBoundary.jsx +1 -1
- package/src/hocs/withErrorBoundary.test.jsx +4 -11
- package/src/hocs/withRootNavigation.jsx +3 -2
- package/src/hocs/withRootNavigation.test.jsx +18 -14
- package/src/index.js +3 -3
- package/src/slate.js +1 -1
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.jsx +0 -76
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.test.js +0 -50
- package/src/customizations/volto/components/manage/Sidebar/SidebarPopup copy.jsx +0 -82
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import EditBlockWrapper from '@eeacms/volto-group-block/components/manage/Blocks/Group/EditBlockWrapper';
|
|
2
|
+
import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
|
|
3
|
+
import cx from 'classnames';
|
|
5
4
|
|
|
6
|
-
import helpSVG from '@plone/volto/icons/help.svg';
|
|
7
5
|
import RenderBlocks from './RenderBlocks';
|
|
8
6
|
import './editor-flex.less';
|
|
9
7
|
|
|
@@ -17,8 +15,6 @@ const FlexGroup = (props) => {
|
|
|
17
15
|
selected,
|
|
18
16
|
selectedBlock,
|
|
19
17
|
onSelectBlock,
|
|
20
|
-
setSelectedBlock,
|
|
21
|
-
multiSelected,
|
|
22
18
|
manage,
|
|
23
19
|
childBlocksForm,
|
|
24
20
|
formDescription,
|
|
@@ -26,7 +22,7 @@ const FlexGroup = (props) => {
|
|
|
26
22
|
} = props;
|
|
27
23
|
const metadata = props.metadata || props.properties;
|
|
28
24
|
const blockState = {};
|
|
29
|
-
const { no_of_columns =
|
|
25
|
+
const { no_of_columns = 1 } = data;
|
|
30
26
|
const flexClassNames = `ui unstackable items row flex-items-wrapper items-${no_of_columns}-columns`;
|
|
31
27
|
|
|
32
28
|
React.useEffect(() => {
|
|
@@ -43,12 +39,19 @@ const FlexGroup = (props) => {
|
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
return (
|
|
46
|
-
<div
|
|
42
|
+
<div
|
|
43
|
+
className={cx('flex-blocks-form', {
|
|
44
|
+
'disable-inner-buttons': data.disableInnerButtons,
|
|
45
|
+
})}
|
|
46
|
+
data-block={block}
|
|
47
|
+
>
|
|
47
48
|
{isEditMode ? (
|
|
48
49
|
<BlocksForm
|
|
49
50
|
metadata={metadata}
|
|
50
51
|
properties={childBlocksForm}
|
|
51
52
|
manage={manage}
|
|
53
|
+
isMainForm={false}
|
|
54
|
+
stopPropagation={selectedBlock}
|
|
52
55
|
selectedBlock={selected ? selectedBlock : null}
|
|
53
56
|
allowedBlocks={data.allowedBlocks}
|
|
54
57
|
title={data.placeholder}
|
|
@@ -80,42 +83,7 @@ const FlexGroup = (props) => {
|
|
|
80
83
|
}
|
|
81
84
|
}}
|
|
82
85
|
pathname={pathname}
|
|
83
|
-
|
|
84
|
-
{({ draginfo }, editBlock, blockProps) => (
|
|
85
|
-
<div className="flex-item">
|
|
86
|
-
<div className="item-wrapper">
|
|
87
|
-
<EditBlockWrapper
|
|
88
|
-
draginfo={draginfo}
|
|
89
|
-
blockProps={blockProps}
|
|
90
|
-
disabled={data.disableInnerButtons}
|
|
91
|
-
extraControls={
|
|
92
|
-
<>
|
|
93
|
-
{instructions && (
|
|
94
|
-
<>
|
|
95
|
-
<Button
|
|
96
|
-
icon
|
|
97
|
-
basic
|
|
98
|
-
title="Section help"
|
|
99
|
-
onClick={() => {
|
|
100
|
-
setSelectedBlock();
|
|
101
|
-
const tab = manage ? 0 : 1;
|
|
102
|
-
props.setSidebarTab(tab);
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
<Icon name={helpSVG} className="" size="19px" />
|
|
106
|
-
</Button>
|
|
107
|
-
</>
|
|
108
|
-
)}
|
|
109
|
-
</>
|
|
110
|
-
}
|
|
111
|
-
multiSelected={multiSelected.includes(blockProps.block)}
|
|
112
|
-
>
|
|
113
|
-
{editBlock}
|
|
114
|
-
</EditBlockWrapper>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
)}
|
|
118
|
-
</BlocksForm>
|
|
86
|
+
/>
|
|
119
87
|
) : (
|
|
120
88
|
<div className={flexClassNames}>
|
|
121
89
|
<RenderBlocks metadata={metadata} content={data?.data || {}} />
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getBaseUrl
|
|
2
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
3
|
+
import { applyBlockDefaults } from '@plone/volto/helpers/Blocks/Blocks';
|
|
3
4
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
4
|
-
import
|
|
5
|
+
import map from 'lodash/map';
|
|
5
6
|
import {
|
|
6
7
|
getBlocksFieldname,
|
|
7
8
|
getBlocksLayoutFieldname,
|
|
8
9
|
hasBlocksData,
|
|
9
|
-
} from '@plone/volto/helpers';
|
|
10
|
+
} from '@plone/volto/helpers/Blocks/Blocks';
|
|
10
11
|
import StyleWrapper from '@plone/volto/components/manage/Blocks/Block/StyleWrapper';
|
|
11
12
|
import config from '@plone/volto/registry';
|
|
12
|
-
import
|
|
13
|
+
import ViewDefaultBlock from '@plone/volto/components/manage/Blocks/Block/DefaultView';
|
|
13
14
|
|
|
14
15
|
const messages = defineMessages({
|
|
15
16
|
unknownBlock: {
|
|
@@ -3,12 +3,53 @@
|
|
|
3
3
|
@type: 'extra';
|
|
4
4
|
@element: 'custom';
|
|
5
5
|
|
|
6
|
-
@baseWidth: 100%;
|
|
7
|
-
|
|
8
6
|
// on edit ensure add button is next to the block input area
|
|
9
7
|
.flex-blocks-form {
|
|
10
|
-
|
|
8
|
+
[data-rbd-draggable-context-id] {
|
|
11
9
|
position: relative;
|
|
12
|
-
width: 100
|
|
10
|
+
min-width: var(--flex-item-width, 100%);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.disable-inner-buttons {
|
|
14
|
+
.drag.handle.wrapper,
|
|
15
|
+
.delete-button,
|
|
16
|
+
.block-add-button {
|
|
17
|
+
display: none !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Mirror column width rules from item.overrides for edit mode
|
|
23
|
+
// (.flex-item wrapper was removed; DnD wrappers are now the flex children)
|
|
24
|
+
// items-1-columns: override inherited 25% from .group.flex .items-1-columns in item.overrides
|
|
25
|
+
.flex-blocks-form
|
|
26
|
+
.flex-items-wrapper.items-1-columns
|
|
27
|
+
[data-rbd-draggable-context-id] {
|
|
28
|
+
--flex-item-width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media only screen and (min-width: @tabletBreakpoint) {
|
|
32
|
+
.flex-blocks-form
|
|
33
|
+
.flex-items-wrapper.items-2-columns
|
|
34
|
+
[data-rbd-draggable-context-id] {
|
|
35
|
+
--flex-item-width: calc(100% / 2 - 1%);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.flex-blocks-form
|
|
39
|
+
.flex-items-wrapper.items-3-columns
|
|
40
|
+
[data-rbd-draggable-context-id] {
|
|
41
|
+
--flex-item-width: calc(100% / 3 - 1%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.flex-blocks-form
|
|
45
|
+
.flex-items-wrapper.items-4-columns
|
|
46
|
+
[data-rbd-draggable-context-id] {
|
|
47
|
+
--flex-item-width: calc(100% / 4 - 1%);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.flex-blocks-form
|
|
51
|
+
.flex-items-wrapper.items-5-columns
|
|
52
|
+
[data-rbd-draggable-context-id] {
|
|
53
|
+
--flex-item-width: calc(100% / 5 - 1%);
|
|
13
54
|
}
|
|
14
55
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EditSchema } from './schema';
|
|
3
|
-
import
|
|
3
|
+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
4
|
+
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
4
5
|
import LayoutSettingsView from './LayoutSettingsView';
|
|
5
6
|
|
|
6
7
|
const LayoutSettingsEdit = (props) => {
|
|
@@ -11,8 +11,9 @@ jest.mock('./schema', () => ({
|
|
|
11
11
|
EditSchema: jest.fn(),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
jest.mock('@plone/volto/components', () => ({
|
|
15
|
-
|
|
14
|
+
jest.mock('@plone/volto/components/manage/Form/BlockDataForm', () => ({
|
|
15
|
+
__esModule: true,
|
|
16
|
+
default: jest.fn(({ title, schema, formData, onChangeField }) => (
|
|
16
17
|
<div data-testid="block-data-form">
|
|
17
18
|
<div data-testid="form-title">{title}</div>
|
|
18
19
|
<div data-testid="form-schema">{JSON.stringify(schema)}</div>
|
|
@@ -25,7 +26,11 @@ jest.mock('@plone/volto/components', () => ({
|
|
|
25
26
|
</button>
|
|
26
27
|
</div>
|
|
27
28
|
)),
|
|
28
|
-
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
jest.mock('@plone/volto/components/manage/Sidebar/SidebarPortal', () => ({
|
|
32
|
+
__esModule: true,
|
|
33
|
+
default: jest.fn(({ selected, children }) => (
|
|
29
34
|
<div data-testid="sidebar-portal" data-selected={selected}>
|
|
30
35
|
{children}
|
|
31
36
|
</div>
|
|
@@ -43,7 +48,10 @@ jest.mock('./LayoutSettingsView', () => ({
|
|
|
43
48
|
|
|
44
49
|
const mockLayoutSettingsView = require('./LayoutSettingsView').default;
|
|
45
50
|
|
|
46
|
-
const
|
|
51
|
+
const BlockDataForm =
|
|
52
|
+
require('@plone/volto/components/manage/Form/BlockDataForm').default;
|
|
53
|
+
const SidebarPortal =
|
|
54
|
+
require('@plone/volto/components/manage/Sidebar/SidebarPortal').default;
|
|
47
55
|
|
|
48
56
|
describe('LayoutSettingsEdit', () => {
|
|
49
57
|
const mockSchema = {
|
|
@@ -9,8 +9,8 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import { Editor, createEditor, Transforms, Node, Range } from 'slate';
|
|
10
10
|
import { ReactEditor, Editable, Slate, withReact } from 'slate-react';
|
|
11
11
|
import config from '@plone/volto/registry';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
13
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
14
14
|
import View from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title/View';
|
|
15
15
|
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
16
16
|
import schema from './schema';
|
|
@@ -171,7 +171,7 @@ export const TitleBlockEdit = (props) => {
|
|
|
171
171
|
banner={{
|
|
172
172
|
title: {
|
|
173
173
|
view: (
|
|
174
|
-
<Slate editor={editor} onChange={handleChange}
|
|
174
|
+
<Slate editor={editor} onChange={handleChange} initialValue={val}>
|
|
175
175
|
<Editable
|
|
176
176
|
readOnly={!editable}
|
|
177
177
|
onKeyDown={handleKeyDown}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { withBlockExtensions
|
|
9
|
+
import { withBlockExtensions } from '@plone/volto/helpers/Extensions';
|
|
10
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
10
11
|
import DefaultTemplate from './variations/Default';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -7,12 +7,12 @@ import React from 'react';
|
|
|
7
7
|
import { Portal } from 'react-portal';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
11
11
|
import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/View';
|
|
12
12
|
import Banner from '@eeacms/volto-eea-design-system/ui/Banner/Banner';
|
|
13
13
|
import clsx from 'clsx';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
16
16
|
|
|
17
17
|
function IsomorphicPortal({ children }) {
|
|
18
18
|
const [isClient, setIsClient] = React.useState();
|
|
@@ -8,14 +8,16 @@ jest.mock('react-portal', () => ({
|
|
|
8
8
|
Portal: ({ children }) => <div data-testid="portal">{children}</div>,
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
12
|
-
|
|
11
|
+
jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
|
|
12
|
+
__esModule: true,
|
|
13
|
+
default: ({ className }) => (
|
|
13
14
|
<div data-testid="body-class" className={className} />
|
|
14
15
|
),
|
|
15
16
|
}));
|
|
16
17
|
|
|
17
|
-
jest.mock('@plone/volto/components', () => ({
|
|
18
|
-
|
|
18
|
+
jest.mock('@plone/volto/components/manage/MaybeWrap/MaybeWrap', () => ({
|
|
19
|
+
__esModule: true,
|
|
20
|
+
default: ({ condition, as: As, children }) =>
|
|
19
21
|
condition ? <As>{children}</As> : children,
|
|
20
22
|
}));
|
|
21
23
|
|
|
@@ -7,11 +7,11 @@ import React from 'react';
|
|
|
7
7
|
import { Portal } from 'react-portal';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
11
11
|
import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/View';
|
|
12
12
|
import clsx from 'clsx';
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
15
15
|
|
|
16
16
|
function IsomorphicPortal({ children }) {
|
|
17
17
|
const [isClient, setIsClient] = React.useState();
|
|
@@ -14,8 +14,9 @@ jest.mock('react-portal', () => ({
|
|
|
14
14
|
),
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
|
-
jest.mock('@plone/volto/components', () => ({
|
|
18
|
-
|
|
17
|
+
jest.mock('@plone/volto/components/manage/MaybeWrap/MaybeWrap', () => ({
|
|
18
|
+
__esModule: true,
|
|
19
|
+
default: ({ children, condition, as: Component }) =>
|
|
19
20
|
condition ? <Component>{children}</Component> : <div>{children}</div>,
|
|
20
21
|
}));
|
|
21
22
|
|
|
@@ -51,8 +52,9 @@ jest.mock(
|
|
|
51
52
|
|
|
52
53
|
jest.mock('clsx', () => jest.fn((classes) => classes));
|
|
53
54
|
|
|
54
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
55
|
-
|
|
55
|
+
jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
|
|
56
|
+
__esModule: true,
|
|
57
|
+
default: ({ className }) => (
|
|
56
58
|
<div data-testid="body-class" data-classname={className} />
|
|
57
59
|
),
|
|
58
60
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
3
3
|
import { compose } from 'redux';
|
|
4
4
|
import { connect, useDispatch } from 'react-redux';
|
|
5
5
|
import { withRouter } from 'react-router';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useSelector } from 'react-redux';
|
|
2
|
-
import
|
|
2
|
+
import Helmet from '@plone/volto/helpers//Helmet/Helmet';
|
|
3
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
3
4
|
|
|
4
5
|
export default function BaseTag(props) {
|
|
5
6
|
const contentId = useSelector((store) => store?.content?.data?.['@id']);
|
|
@@ -6,7 +6,8 @@ import BaseTag from './BaseTag';
|
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore();
|
|
8
8
|
|
|
9
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
9
|
+
jest.mock('@plone/volto/helpers/Url/Url', () => ({
|
|
10
|
+
__esModule: true,
|
|
10
11
|
flattenToAppURL: jest.fn((url) => {
|
|
11
12
|
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
12
13
|
const urlObj = new URL(url);
|
|
@@ -14,7 +15,11 @@ jest.mock('@plone/volto/helpers', () => ({
|
|
|
14
15
|
}
|
|
15
16
|
return url;
|
|
16
17
|
}),
|
|
17
|
-
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
jest.mock('@plone/volto/helpers//Helmet/Helmet', () => ({
|
|
21
|
+
__esModule: true,
|
|
22
|
+
default: ({ base }) => (
|
|
18
23
|
<div
|
|
19
24
|
data-testid="helmet-base"
|
|
20
25
|
data-target={base?.target}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
2
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
2
3
|
import { connect } from 'react-redux';
|
|
3
4
|
import { withRouter } from 'react-router-dom';
|
|
4
5
|
import { compose } from 'redux';
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import
|
|
8
|
+
import DefaultView from '@plone/volto/components/theme/View/DefaultView';
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
11
11
|
|
|
12
|
-
import { hasBlocksData } from '@plone/volto/helpers';
|
|
12
|
+
import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Component to display the default view.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import HomePageInverseView from './HomePageInverseView';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
|
|
6
6
|
describe('HomePageInverseView Component', () => {
|
|
7
7
|
it('renders without crashing', () => {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import
|
|
8
|
+
import DefaultView from '@plone/volto/components/theme/View/DefaultView';
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
11
11
|
|
|
12
|
-
import { hasBlocksData } from '@plone/volto/helpers';
|
|
12
|
+
import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Component to display the default view.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import HomePageView from './HomePageView';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
|
|
6
6
|
describe('HomePageView Component', () => {
|
|
7
7
|
it('renders without crashing', () => {
|
|
@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux';
|
|
|
3
3
|
import { defineMessages, useIntl } from 'react-intl';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import Logo from '@eeacms/volto-eea-design-system/ui/Logo/Logo';
|
|
7
7
|
import LogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea-logo.svg';
|
|
8
8
|
|
|
9
9
|
const messages = defineMessages({
|
|
@@ -55,8 +55,8 @@ const EEALogo = ({
|
|
|
55
55
|
const url = config.settings.eea?.logoTargetUrl
|
|
56
56
|
? config.settings.eea.logoTargetUrl
|
|
57
57
|
: config.settings.isMultilingual
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
? `/${lang}`
|
|
59
|
+
: '/';
|
|
60
60
|
|
|
61
61
|
// Only pass inverted=true if we have an invertedSrc, otherwise the design system
|
|
62
62
|
// Logo will try to use undefined invertedSrc instead of falling back to src
|
|
@@ -2,13 +2,14 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { compose } from 'redux';
|
|
3
3
|
import { injectIntl } from 'react-intl';
|
|
4
4
|
import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
|
|
5
|
-
import
|
|
5
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
6
|
+
import { toBackendLang } from '@plone/volto/helpers/Utils/Utils';
|
|
6
7
|
import { FormattedMessage } from 'react-intl';
|
|
7
8
|
import { Link, useLocation } from 'react-router-dom';
|
|
8
9
|
import { Container, Accordion } from 'semantic-ui-react';
|
|
9
10
|
import { withServerErrorCode } from '@plone/volto/helpers/Utils/Utils';
|
|
10
11
|
import { useDispatch, useSelector } from 'react-redux';
|
|
11
|
-
import { getNavigation } from '@plone/volto/actions';
|
|
12
|
+
import { getNavigation } from '@plone/volto/actions/navigation/navigation';
|
|
12
13
|
import config from '@plone/volto/registry';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -14,19 +14,20 @@ jest.mock('@eeacms/volto-eea-website-theme/hocs', () => ({
|
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
16
|
jest.mock('@plone/volto/helpers/Utils/Utils', () => ({
|
|
17
|
+
toBackendLang: jest.fn((lang) => lang),
|
|
17
18
|
withServerErrorCode: () => (Component) => Component,
|
|
18
19
|
}));
|
|
19
20
|
|
|
20
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
21
|
-
|
|
21
|
+
jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
|
|
22
|
+
__esModule: true,
|
|
23
|
+
default: ({ className, children }) => (
|
|
22
24
|
<div data-testid="body-class" data-classname={className}>
|
|
23
25
|
{children}
|
|
24
26
|
</div>
|
|
25
27
|
),
|
|
26
|
-
toBackendLang: jest.fn((lang) => lang),
|
|
27
28
|
}));
|
|
28
29
|
|
|
29
|
-
jest.mock('@plone/volto/actions', () => ({
|
|
30
|
+
jest.mock('@plone/volto/actions/navigation/navigation', () => ({
|
|
30
31
|
getNavigation: jest.fn(() => ({ type: 'GET_NAVIGATION' })),
|
|
31
32
|
}));
|
|
32
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compose } from 'redux';
|
|
2
2
|
import { injectIntl } from 'react-intl';
|
|
3
3
|
import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
|
|
4
|
-
import
|
|
4
|
+
import NotFound from '@plone/volto/components/theme/NotFound/NotFound';
|
|
5
5
|
|
|
6
6
|
export default compose(injectIntl, withRootNavigation)(NotFound);
|
|
@@ -8,8 +8,9 @@ import NotFound from './NotFound';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
jest.mock('@plone/volto/components', () => ({
|
|
12
|
-
|
|
11
|
+
jest.mock('@plone/volto/components/theme/NotFound/NotFound', () => ({
|
|
12
|
+
__esModule: true,
|
|
13
|
+
default: () => <div data-testid="volto-notfound">Not Found Page</div>,
|
|
13
14
|
}));
|
|
14
15
|
|
|
15
16
|
jest.mock('@eeacms/volto-eea-website-theme/hocs', () => ({
|
|
@@ -3,13 +3,15 @@ import cx from 'classnames';
|
|
|
3
3
|
import { useSelector } from 'react-redux';
|
|
4
4
|
import { useLocation } from 'react-router-dom';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
7
7
|
import { isSubsiteRoot } from 'volto-subsites/utils';
|
|
8
8
|
|
|
9
|
+
const EMPTY_SUBSITE = {};
|
|
10
|
+
|
|
9
11
|
const SubsiteClass = () => {
|
|
10
|
-
const subsite =
|
|
11
|
-
(state) => state.content?.data?.['@components']?.subsite ||
|
|
12
|
-
|
|
12
|
+
const subsite =
|
|
13
|
+
useSelector((state) => state.content?.data?.['@components']?.subsite) ||
|
|
14
|
+
EMPTY_SUBSITE;
|
|
13
15
|
const location = useLocation();
|
|
14
16
|
|
|
15
17
|
return (
|
|
@@ -13,8 +13,9 @@ jest.mock('volto-subsites/utils', () => ({
|
|
|
13
13
|
isSubsiteRoot: (...args) => mockIsSubsiteRoot(...args),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
17
|
-
|
|
16
|
+
jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
default: ({ className }) => (
|
|
18
19
|
<div data-testid="body-class" data-classname={className} />
|
|
19
20
|
),
|
|
20
21
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useHistory } from 'react-router-dom';
|
|
4
|
-
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
5
|
-
import
|
|
4
|
+
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
5
|
+
import DefaultView from '@plone/volto/components/theme/View/DefaultView';
|
|
6
6
|
import { Redirect } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
const WebReportSectionView = (props) => {
|
|
@@ -8,13 +8,14 @@ import WebReportSectionView from './WebReportSectionView';
|
|
|
8
8
|
import '@testing-library/jest-dom';
|
|
9
9
|
|
|
10
10
|
// Mock external dependencies
|
|
11
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
11
|
+
jest.mock('@plone/volto/helpers/Url/Url', () => ({
|
|
12
12
|
isInternalURL: jest.fn(),
|
|
13
13
|
flattenToAppURL: jest.fn(),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
jest.mock('@plone/volto/components/', () => ({
|
|
17
|
-
|
|
16
|
+
jest.mock('@plone/volto/components/theme/View/DefaultView', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
default: jest.fn(({ children }) => (
|
|
18
19
|
<div data-testid="default-view">{children}</div>
|
|
19
20
|
)),
|
|
20
21
|
}));
|
|
@@ -24,8 +25,12 @@ jest.mock('react-router-dom', () => ({
|
|
|
24
25
|
Redirect: jest.fn(({ to }) => <div data-testid="redirect" data-to={to} />),
|
|
25
26
|
}));
|
|
26
27
|
|
|
27
|
-
const {
|
|
28
|
-
|
|
28
|
+
const {
|
|
29
|
+
isInternalURL,
|
|
30
|
+
flattenToAppURL,
|
|
31
|
+
} = require('@plone/volto/helpers/Url/Url');
|
|
32
|
+
const DefaultView =
|
|
33
|
+
require('@plone/volto/components/theme/View/DefaultView').default;
|
|
29
34
|
const { Redirect } = require('react-router-dom');
|
|
30
35
|
|
|
31
36
|
describe('WebReportSectionView', () => {
|
|
@@ -10,7 +10,7 @@ import { compose } from 'redux';
|
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
11
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
12
12
|
import { Popup } from 'semantic-ui-react';
|
|
13
|
-
import
|
|
13
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
14
14
|
import { getSharing } from '@plone/volto/actions/sharing/sharing';
|
|
15
15
|
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
MenuList,
|
|
28
28
|
} from '@plone/volto/components/manage/Widgets/SelectStyling';
|
|
29
29
|
|
|
30
|
-
import
|
|
30
|
+
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
31
31
|
|
|
32
32
|
const messages = defineMessages({
|
|
33
33
|
select: {
|