@plone/volto 18.0.0-alpha.14 → 18.0.0-alpha.15
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/CHANGELOG.md +6 -0
- package/jest-setup-afterenv.js +2 -0
- package/package.json +24 -20
- package/src/components/manage/Add/Add.jsx +9 -11
- package/src/components/manage/Add/Add.test.jsx +11 -13
- package/src/components/manage/Aliases/Aliases.jsx +6 -6
- package/src/components/manage/Aliases/Aliases.test.jsx +7 -7
- package/src/components/manage/BlockChooser/BlockChooser.test.jsx +0 -1
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +6 -6
- package/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx +0 -1
- package/src/components/manage/Blocks/Block/Settings.test.jsx +0 -1
- package/src/components/manage/Blocks/Container/NewBlockAddButton.jsx +20 -19
- package/src/components/manage/Blocks/Image/View.test.jsx +0 -1
- package/src/components/manage/Blocks/Table/Edit.jsx +7 -6
- package/src/components/manage/Contents/Contents.jsx +6 -6
- package/src/components/manage/Contents/Contents.test.jsx +7 -7
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +4 -4
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Aliases.jsx +6 -6
- package/src/components/manage/Controlpanels/Aliases.test.jsx +6 -7
- package/src/components/manage/Controlpanels/ContentType.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentType.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ContentTypeLayout.jsx +93 -85
- package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ContentTypeSchema.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentTypes.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentTypes.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Controlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Controlpanels.jsx +6 -6
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +10 -10
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +6 -6
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ModerateComments.jsx +6 -6
- package/src/components/manage/Controlpanels/ModerateComments.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +13 -7
- package/src/components/manage/Controlpanels/Rules/AddRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/EditRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/Rules.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/components/{VariableModal.test.jsx → VariableModal.test.jsx.removed} +6 -7
- package/src/components/manage/Controlpanels/UndoControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/UpgradeControlPanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +14 -8
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +7 -7
- package/src/components/manage/Delete/Delete.jsx +6 -6
- package/src/components/manage/Delete/Delete.test.jsx +10 -10
- package/src/components/manage/Diff/Diff.jsx +6 -6
- package/src/components/manage/Diff/Diff.test.jsx +2 -3
- package/src/components/manage/Edit/Edit.jsx +10 -11
- package/src/components/manage/Edit/Edit.test.jsx +14 -10
- package/src/components/manage/Form/BlockDataForm.test.jsx +0 -1
- package/src/components/manage/Form/Form.jsx +16 -8
- package/src/components/manage/Form/ModalForm.test.jsx +0 -1
- package/src/components/manage/History/History.jsx +6 -6
- package/src/components/manage/History/History.test.jsx +14 -13
- package/src/components/manage/LinksToItem/LinksToItem.jsx +78 -49
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +7 -7
- package/src/components/manage/Multilingual/ManageTranslations.jsx +13 -7
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +6 -7
- package/src/components/manage/Preferences/ChangePassword.jsx +6 -6
- package/src/components/manage/Preferences/ChangePassword.test.jsx +6 -7
- package/src/components/manage/Preferences/PersonalInformation.test.jsx +1 -3
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -3
- package/src/components/manage/Rules/Rules.jsx +6 -6
- package/src/components/manage/Rules/Rules.test.jsx +7 -7
- package/src/components/manage/Sharing/Sharing.jsx +6 -6
- package/src/components/manage/Sharing/Sharing.test.jsx +7 -7
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +1 -1
- package/src/components/manage/Sidebar/Sidebar.jsx +2 -0
- package/src/components/manage/Sidebar/SidebarPopup.jsx +28 -21
- package/src/components/manage/Sidebar/SidebarPortal.jsx +7 -6
- package/src/components/manage/Widgets/FileWidget.jsx +1 -1
- package/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/ObjectListWidget.test.js +0 -1
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +0 -1
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +5 -5
- package/src/components/manage/Widgets/UrlWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +4 -4
- package/src/components/theme/Comments/Comments.jsx +7 -8
- package/src/components/theme/Component/Component.test.jsx +0 -1
- package/src/components/theme/ContactForm/ContactForm.jsx +6 -6
- package/src/components/theme/ContactForm/ContactForm.test.jsx +12 -10
- package/src/components/theme/Footer/Footer.test.jsx +0 -1
- package/src/components/theme/Logout/Logout.test.jsx +8 -5
- package/src/components/theme/Search/Search.jsx +6 -6
- package/src/components/theme/Search/Search.test.jsx +13 -10
- package/src/components/theme/SlotRenderer/SlotRenderer.test.jsx +0 -1
- package/src/components/theme/View/View.jsx +6 -6
- package/src/components/theme/View/View.test.jsx +25 -18
- package/src/helpers/AsyncConnect/AsyncConnect.test.js +0 -2
- package/src/helpers/Utils/UseDetectClickOutside.stories.jsx +8 -8
- package/src/start-client.jsx +3 -3
- package/types/components/manage/Add/Add.d.ts +1 -4
- package/types/components/manage/Aliases/Aliases.d.ts +1 -4
- package/types/components/manage/Blocks/Block/Edit.d.ts +1 -3
- package/types/components/manage/Blocks/HeroImageLeft/Edit.d.ts +1 -4
- package/types/components/manage/Blocks/Image/Edit.d.ts +1 -4
- package/types/components/manage/Contents/Contents.d.ts +2 -7
- package/types/components/manage/Contents/ContentsUploadModal.d.ts +1 -4
- package/types/components/manage/Controlpanels/AddonsControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/Aliases.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentType.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypeLayout.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypeSchema.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypes.d.ts +1 -4
- package/types/components/manage/Controlpanels/DatabaseInformation.d.ts +1 -4
- package/types/components/manage/Controlpanels/Groups/GroupsControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/ModerateComments.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/AddRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/ConfigureRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/EditRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/Rules.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/components/VariableModal.d.ts +1 -4
- package/types/components/manage/Controlpanels/UndoControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/UpgradeControlPanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +1 -4
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +1 -4
- package/types/components/manage/Display/Display.d.ts +1 -4
- package/types/components/manage/Edit/Edit.d.ts +2 -7
- package/types/components/manage/Form/BlocksToolbar.d.ts +1 -3
- package/types/components/manage/History/History.d.ts +1 -4
- package/types/components/manage/Preferences/PersonalPreferences.d.ts +1 -4
- package/types/components/manage/Rules/Rules.d.ts +1 -4
- package/types/components/manage/Sidebar/ObjectBrowserBody.d.ts +1 -4
- package/types/components/manage/Toolbar/Toolbar.d.ts +1 -4
- package/types/components/manage/Widgets/ArrayWidget.d.ts +1 -3
- package/types/components/manage/Widgets/IdWidget.d.ts +1 -4
- package/types/components/manage/Widgets/QueryWidget.d.ts +1 -3
- package/types/components/manage/Widgets/ReferenceWidget.d.ts +1 -4
- package/types/components/manage/Widgets/SchemaWidget.d.ts +1 -4
- package/types/components/manage/Widgets/SelectAutoComplete.d.ts +1 -3
- package/types/components/manage/Widgets/TokenWidget.d.ts +1 -4
- package/types/components/manage/Widgets/WysiwygWidget.d.ts +1 -4
- package/types/components/theme/Search/Search.d.ts +2 -7
- package/types/components/theme/Sitemap/Sitemap.d.ts +2 -6
- package/types/components/theme/View/View.d.ts +1 -4
- package/types/config/Widgets.d.ts +1 -3
- package/src/components/manage/Multilingual/CreateTranslation.test.jsx +0 -46
- package/src/helpers/Utils/usePagination.test.js +0 -115
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Portal that wraps Sidebar components
|
|
@@ -16,8 +16,9 @@ const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
|
-
{
|
|
20
|
-
|
|
19
|
+
{isClient &&
|
|
20
|
+
selected &&
|
|
21
|
+
createPortal(
|
|
21
22
|
<div role="form" style={{ height: '100%' }}>
|
|
22
23
|
<div
|
|
23
24
|
style={{ height: '100%' }}
|
|
@@ -31,9 +32,9 @@ const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
|
|
|
31
32
|
>
|
|
32
33
|
{children}
|
|
33
34
|
</div>
|
|
34
|
-
</div
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
</div>,
|
|
36
|
+
document.getElementById(tab),
|
|
37
|
+
)}
|
|
37
38
|
</>
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -112,7 +112,7 @@ const FileWidget = (props) => {
|
|
|
112
112
|
if (imageMimetypes.includes(fields[1])) {
|
|
113
113
|
setFileType(true);
|
|
114
114
|
let imagePreview = document.getElementById(`field-${id}-image`);
|
|
115
|
-
imagePreview.src = reader.result;
|
|
115
|
+
if (imagePreview) imagePreview.src = reader.result;
|
|
116
116
|
} else {
|
|
117
117
|
setFileType(false);
|
|
118
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import ObjectBrowserWidget from './ObjectBrowserWidget';
|
|
@@ -14,7 +14,7 @@ test('renders a objectBrowser widget component', () => {
|
|
|
14
14
|
messages: {},
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
|
-
const
|
|
17
|
+
const { container } = render(
|
|
18
18
|
<Provider store={store}>
|
|
19
19
|
<MemoryRouter>
|
|
20
20
|
<ObjectBrowserWidget
|
|
@@ -26,6 +26,6 @@ test('renders a objectBrowser widget component', () => {
|
|
|
26
26
|
</MemoryRouter>
|
|
27
27
|
</Provider>,
|
|
28
28
|
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
29
|
+
|
|
30
|
+
expect(container).toMatchSnapshot();
|
|
31
31
|
});
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { Provider } from 'react-intl-redux';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
4
|
import configureStore from 'redux-mock-store';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
5
|
import ObjectListWidget from './ObjectListWidget';
|
|
7
6
|
|
|
8
7
|
jest.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
@@ -3,7 +3,6 @@ import renderer from 'react-test-renderer';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import { render, fireEvent } from '@testing-library/react';
|
|
6
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
7
6
|
import ObjectWidget from './ObjectWidget';
|
|
8
7
|
|
|
9
8
|
const mockStore = configureStore();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ test('renders a schema widget component', () => {
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const { container } = render(
|
|
25
25
|
<Provider store={store}>
|
|
26
26
|
<SchemaWidget
|
|
27
27
|
id="my-field"
|
|
@@ -31,6 +31,6 @@ test('renders a schema widget component', () => {
|
|
|
31
31
|
/>
|
|
32
32
|
</Provider>,
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
expect(
|
|
34
|
+
|
|
35
|
+
expect(container).toMatchSnapshot();
|
|
36
36
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
|
3
|
-
import
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
4
|
import SchemaWidgetFieldsetComponent from './SchemaWidgetFieldset';
|
|
5
5
|
|
|
6
6
|
jest.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
@@ -10,7 +10,7 @@ beforeAll(
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
test('renders a contents item component', () => {
|
|
13
|
-
const
|
|
13
|
+
const { container } = render(
|
|
14
14
|
<DragDropContext onDragEnd={(x) => x}>
|
|
15
15
|
<Droppable droppableId="tabs-schema-edit" direction="horizontal">
|
|
16
16
|
{(provided, snapshot) => (
|
|
@@ -28,7 +28,7 @@ test('renders a contents item component', () => {
|
|
|
28
28
|
onShowEditFieldset={(x) => x}
|
|
29
29
|
onShowDeleteFieldset={(x) => x}
|
|
30
30
|
onClick={(x) => x}
|
|
31
|
-
getItemStyle={(x) =>
|
|
31
|
+
getItemStyle={(x) => ({})}
|
|
32
32
|
isDraggable={false}
|
|
33
33
|
isDisabled={false}
|
|
34
34
|
/>
|
|
@@ -38,6 +38,6 @@ test('renders a contents item component', () => {
|
|
|
38
38
|
</Droppable>
|
|
39
39
|
</DragDropContext>,
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
expect(
|
|
41
|
+
|
|
42
|
+
expect(container).toMatchSnapshot();
|
|
43
43
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ test('renders an url widget component', () => {
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const { container } = render(
|
|
19
19
|
<Provider store={store}>
|
|
20
20
|
<UrlWidget
|
|
21
21
|
id="test-url"
|
|
@@ -27,6 +27,6 @@ test('renders an url widget component', () => {
|
|
|
27
27
|
/>
|
|
28
28
|
</Provider>,
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
expect(
|
|
30
|
+
|
|
31
|
+
expect(container).toMatchSnapshot();
|
|
32
32
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -55,7 +55,7 @@ test('renders a dictionary widget component', () => {
|
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
57
|
};
|
|
58
|
-
const
|
|
58
|
+
const { container } = render(
|
|
59
59
|
<Provider store={store}>
|
|
60
60
|
<VocabularyTermsWidget
|
|
61
61
|
id="test-dict"
|
|
@@ -68,6 +68,6 @@ test('renders a dictionary widget component', () => {
|
|
|
68
68
|
/>
|
|
69
69
|
</Provider>,
|
|
70
70
|
);
|
|
71
|
-
|
|
72
|
-
expect(
|
|
71
|
+
|
|
72
|
+
expect(container).toMatchSnapshot();
|
|
73
73
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState, useMemo, useCallback } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
-
import {
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
5
|
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
|
|
6
6
|
import { compose } from 'redux';
|
|
7
7
|
import { Button, Comment, Container, Icon } from 'semantic-ui-react';
|
|
@@ -356,19 +356,18 @@ const Comments = (props) => {
|
|
|
356
356
|
</Button>
|
|
357
357
|
)}
|
|
358
358
|
|
|
359
|
-
{replyTo &&
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
>
|
|
359
|
+
{replyTo &&
|
|
360
|
+
document &&
|
|
361
|
+
createPortal(
|
|
363
362
|
<Form
|
|
364
363
|
onSubmit={onSubmit}
|
|
365
364
|
onCancel={onEditCancel}
|
|
366
365
|
submitLabel={intl.formatMessage(messages.comment)}
|
|
367
366
|
resetAfterSubmit
|
|
368
367
|
schema={makeFormSchema(intl)}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
368
|
+
/>,
|
|
369
|
+
document.getElementById(`reply-place-${replyTo}`),
|
|
370
|
+
)}
|
|
372
371
|
</Container>
|
|
373
372
|
);
|
|
374
373
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
3
|
import { Container, Message, Icon } from 'semantic-ui-react';
|
|
4
4
|
import { defineMessages, useIntl } from 'react-intl';
|
|
5
5
|
import { Link, useHistory, useLocation } from 'react-router-dom';
|
|
@@ -149,8 +149,8 @@ const ContactFormComponent = () => {
|
|
|
149
149
|
required: ['from', 'message'],
|
|
150
150
|
}}
|
|
151
151
|
/>
|
|
152
|
-
{isClient &&
|
|
153
|
-
|
|
152
|
+
{isClient &&
|
|
153
|
+
createPortal(
|
|
154
154
|
<Toolbar
|
|
155
155
|
pathname={pathname}
|
|
156
156
|
hideDefaultViewButtons
|
|
@@ -164,9 +164,9 @@ const ContactFormComponent = () => {
|
|
|
164
164
|
/>
|
|
165
165
|
</Link>
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
/>,
|
|
168
|
+
document.getElementById('toolbar'),
|
|
169
|
+
)}
|
|
170
170
|
</Container>
|
|
171
171
|
</div>
|
|
172
172
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom';
|
|
6
6
|
import ContactForm from './ContactForm';
|
|
7
7
|
|
|
8
|
-
jest.mock('
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
jest.mock('../../manage/Toolbar/Toolbar', () =>
|
|
9
|
+
jest.fn(() => <div id="Portal" />),
|
|
10
|
+
);
|
|
11
11
|
|
|
12
12
|
const mockStore = configureStore();
|
|
13
13
|
describe('Contact form', () => {
|
|
@@ -25,15 +25,16 @@ describe('Contact form', () => {
|
|
|
25
25
|
userSession: {},
|
|
26
26
|
content: {},
|
|
27
27
|
});
|
|
28
|
-
const
|
|
28
|
+
const { container } = render(
|
|
29
29
|
<Provider store={store}>
|
|
30
30
|
<MemoryRouter>
|
|
31
31
|
<ContactForm />
|
|
32
|
+
<div id="toolbar"></div>
|
|
32
33
|
</MemoryRouter>
|
|
33
34
|
</Provider>,
|
|
34
35
|
);
|
|
35
|
-
|
|
36
|
-
expect(
|
|
36
|
+
|
|
37
|
+
expect(container).toMatchSnapshot();
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
it('renders a contact form with error message', () => {
|
|
@@ -52,14 +53,15 @@ describe('Contact form', () => {
|
|
|
52
53
|
userSession: {},
|
|
53
54
|
content: {},
|
|
54
55
|
});
|
|
55
|
-
const
|
|
56
|
+
const { container } = render(
|
|
56
57
|
<Provider store={store}>
|
|
57
58
|
<MemoryRouter>
|
|
58
59
|
<ContactForm />
|
|
60
|
+
<div id="toolbar"></div>
|
|
59
61
|
</MemoryRouter>
|
|
60
62
|
</Provider>,
|
|
61
63
|
);
|
|
62
|
-
|
|
63
|
-
expect(
|
|
64
|
+
|
|
65
|
+
expect(container).toMatchSnapshot();
|
|
64
66
|
});
|
|
65
67
|
});
|
|
@@ -3,7 +3,6 @@ import configureStore from 'redux-mock-store';
|
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import { MemoryRouter } from 'react-router-dom';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
7
6
|
import Footer from './Footer';
|
|
8
7
|
|
|
9
8
|
const mockStore = configureStore();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
5
|
import { IntlProvider } from 'react-intl';
|
|
6
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
6
7
|
|
|
7
8
|
import Logout from './Logout';
|
|
8
9
|
|
|
@@ -21,14 +22,16 @@ describe('Logout', () => {
|
|
|
21
22
|
messages: {},
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
|
-
const
|
|
25
|
+
const { container } = render(
|
|
25
26
|
<Provider store={store}>
|
|
26
27
|
<IntlProvider locale="en">
|
|
27
|
-
<
|
|
28
|
+
<MemoryRouter>
|
|
29
|
+
<Logout location={{ pathname: '' }} />
|
|
30
|
+
</MemoryRouter>
|
|
28
31
|
</IntlProvider>
|
|
29
32
|
</Provider>,
|
|
30
33
|
);
|
|
31
|
-
|
|
32
|
-
expect(
|
|
34
|
+
|
|
35
|
+
expect(container).toMatchSnapshot();
|
|
33
36
|
});
|
|
34
37
|
});
|
|
@@ -10,7 +10,7 @@ import { compose } from 'redux';
|
|
|
10
10
|
import { UniversalLink } from '@plone/volto/components';
|
|
11
11
|
import { asyncConnect } from '@plone/volto/helpers';
|
|
12
12
|
import { FormattedMessage } from 'react-intl';
|
|
13
|
-
import {
|
|
13
|
+
import { createPortal } from 'react-dom';
|
|
14
14
|
import { Container, Pagination, Button, Header } from 'semantic-ui-react';
|
|
15
15
|
import qs from 'query-string';
|
|
16
16
|
import classNames from 'classnames';
|
|
@@ -309,15 +309,15 @@ class Search extends Component {
|
|
|
309
309
|
</section>
|
|
310
310
|
</article>
|
|
311
311
|
</div>
|
|
312
|
-
{this.state.isClient &&
|
|
313
|
-
|
|
312
|
+
{this.state.isClient &&
|
|
313
|
+
createPortal(
|
|
314
314
|
<Toolbar
|
|
315
315
|
pathname={this.props.pathname}
|
|
316
316
|
hideDefaultViewButtons
|
|
317
317
|
inner={<span />}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
/>,
|
|
319
|
+
document.getElementById('toolbar'),
|
|
320
|
+
)}
|
|
321
321
|
</Container>
|
|
322
322
|
);
|
|
323
323
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom';
|
|
@@ -8,9 +8,10 @@ import { __test__ as Search } from './Search';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
jest.mock('
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
jest.mock('../../manage/Toolbar/Toolbar', () =>
|
|
12
|
+
jest.fn(() => <div id="Portal" />),
|
|
13
|
+
);
|
|
14
|
+
|
|
14
15
|
jest.mock('./SearchTags', () => jest.fn(() => <div id="search-tags" />));
|
|
15
16
|
|
|
16
17
|
describe('Search', () => {
|
|
@@ -27,15 +28,16 @@ describe('Search', () => {
|
|
|
27
28
|
const history = {
|
|
28
29
|
location: { pathname: '/blog', search: '?SearchableText=blog' },
|
|
29
30
|
};
|
|
30
|
-
const
|
|
31
|
+
const { container } = render(
|
|
31
32
|
<Provider store={store}>
|
|
32
33
|
<MemoryRouter>
|
|
33
34
|
<Search history={history} />
|
|
35
|
+
<div id="toolbar"></div>
|
|
34
36
|
</MemoryRouter>
|
|
35
37
|
</Provider>,
|
|
36
38
|
);
|
|
37
|
-
|
|
38
|
-
expect(
|
|
39
|
+
|
|
40
|
+
expect(container).toMatchSnapshot();
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
it('renders a search component', () => {
|
|
@@ -59,14 +61,15 @@ describe('Search', () => {
|
|
|
59
61
|
const history = {
|
|
60
62
|
location: { pathname: '/blog', search: '?SearchableText=blog' },
|
|
61
63
|
};
|
|
62
|
-
const
|
|
64
|
+
const { container } = render(
|
|
63
65
|
<Provider store={store}>
|
|
64
66
|
<MemoryRouter>
|
|
65
67
|
<Search history={history} />
|
|
68
|
+
<div id="toolbar"></div>
|
|
66
69
|
</MemoryRouter>
|
|
67
70
|
</Provider>,
|
|
68
71
|
);
|
|
69
|
-
|
|
70
|
-
expect(
|
|
72
|
+
|
|
73
|
+
expect(container).toMatchSnapshot();
|
|
71
74
|
});
|
|
72
75
|
});
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { connect } from 'react-redux';
|
|
9
9
|
import { compose } from 'redux';
|
|
10
10
|
import { Redirect } from 'react-router-dom';
|
|
11
|
-
import {
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
12
12
|
import { injectIntl } from 'react-intl';
|
|
13
13
|
import qs from 'query-string';
|
|
14
14
|
|
|
@@ -269,11 +269,11 @@ class View extends Component {
|
|
|
269
269
|
{this.props.content.allow_discussion && (
|
|
270
270
|
<Comments pathname={this.props.pathname} />
|
|
271
271
|
)}
|
|
272
|
-
{this.state.isClient &&
|
|
273
|
-
|
|
274
|
-
<Toolbar pathname={this.props.pathname} inner={<span />}
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
{this.state.isClient &&
|
|
273
|
+
createPortal(
|
|
274
|
+
<Toolbar pathname={this.props.pathname} inner={<span />} />,
|
|
275
|
+
document.getElementById('toolbar'),
|
|
276
|
+
)}
|
|
277
277
|
</div>
|
|
278
278
|
);
|
|
279
279
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -25,9 +25,10 @@ beforeAll(() => {
|
|
|
25
25
|
|
|
26
26
|
const mockStore = configureStore();
|
|
27
27
|
|
|
28
|
-
jest.mock('
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
jest.mock('../../manage/Toolbar/Toolbar', () =>
|
|
29
|
+
jest.fn(() => <div id="Portal" />),
|
|
30
|
+
);
|
|
31
|
+
|
|
31
32
|
jest.mock('../SocialSharing/SocialSharing', () =>
|
|
32
33
|
jest.fn(() => <div id="SocialSharing" />),
|
|
33
34
|
);
|
|
@@ -150,13 +151,14 @@ describe('View', () => {
|
|
|
150
151
|
messages: {},
|
|
151
152
|
},
|
|
152
153
|
});
|
|
153
|
-
const
|
|
154
|
+
const { container } = render(
|
|
154
155
|
<Provider store={store}>
|
|
155
156
|
<View location={{ pathname: '/test' }} />
|
|
157
|
+
<div id="toolbar"></div>
|
|
156
158
|
</Provider>,
|
|
157
159
|
);
|
|
158
|
-
|
|
159
|
-
expect(
|
|
160
|
+
|
|
161
|
+
expect(container).toMatchSnapshot();
|
|
160
162
|
});
|
|
161
163
|
|
|
162
164
|
it('renders a summary view', () => {
|
|
@@ -170,13 +172,14 @@ describe('View', () => {
|
|
|
170
172
|
messages: {},
|
|
171
173
|
},
|
|
172
174
|
});
|
|
173
|
-
const
|
|
175
|
+
const { container } = render(
|
|
174
176
|
<Provider store={store}>
|
|
175
177
|
<View location={{ pathname: '/test' }} />
|
|
178
|
+
<div id="toolbar"></div>
|
|
176
179
|
</Provider>,
|
|
177
180
|
);
|
|
178
|
-
|
|
179
|
-
expect(
|
|
181
|
+
|
|
182
|
+
expect(container).toMatchSnapshot();
|
|
180
183
|
});
|
|
181
184
|
|
|
182
185
|
it('renders a tabular view', () => {
|
|
@@ -190,13 +193,14 @@ describe('View', () => {
|
|
|
190
193
|
messages: {},
|
|
191
194
|
},
|
|
192
195
|
});
|
|
193
|
-
const
|
|
196
|
+
const { container } = render(
|
|
194
197
|
<Provider store={store}>
|
|
195
198
|
<View location={{ pathname: '/test' }} />
|
|
199
|
+
<div id="toolbar"></div>
|
|
196
200
|
</Provider>,
|
|
197
201
|
);
|
|
198
|
-
|
|
199
|
-
expect(
|
|
202
|
+
|
|
203
|
+
expect(container).toMatchSnapshot();
|
|
200
204
|
});
|
|
201
205
|
|
|
202
206
|
it('renders a document view', () => {
|
|
@@ -210,13 +214,14 @@ describe('View', () => {
|
|
|
210
214
|
messages: {},
|
|
211
215
|
},
|
|
212
216
|
});
|
|
213
|
-
const
|
|
217
|
+
const { container } = render(
|
|
214
218
|
<Provider store={store}>
|
|
215
219
|
<View location={{ pathname: '/test' }} />
|
|
220
|
+
<div id="toolbar"></div>
|
|
216
221
|
</Provider>,
|
|
217
222
|
);
|
|
218
|
-
|
|
219
|
-
expect(
|
|
223
|
+
|
|
224
|
+
expect(container).toMatchSnapshot();
|
|
220
225
|
});
|
|
221
226
|
|
|
222
227
|
it('renders a new view element if the @id changed', () => {
|
|
@@ -238,16 +243,18 @@ describe('View', () => {
|
|
|
238
243
|
messages: {},
|
|
239
244
|
},
|
|
240
245
|
});
|
|
241
|
-
const
|
|
246
|
+
const { rerender } = render(
|
|
242
247
|
<Provider store={store}>
|
|
243
248
|
<View location={{ pathname: '/a' }} />
|
|
249
|
+
<div id="toolbar"></div>
|
|
244
250
|
</Provider>,
|
|
245
251
|
);
|
|
246
252
|
expect(instanceCount).toBe(1);
|
|
247
253
|
store.getState().content.data['@id'] = '/b';
|
|
248
|
-
|
|
254
|
+
rerender(
|
|
249
255
|
<Provider store={store}>
|
|
250
256
|
<View location={{ pathname: '/b' }} />
|
|
257
|
+
<div id="toolbar"></div>
|
|
251
258
|
</Provider>,
|
|
252
259
|
);
|
|
253
260
|
expect(instanceCount).toBe(2);
|
|
@@ -12,8 +12,6 @@ import { AsyncConnectWithContext, AsyncConnect } from './AsyncConnect'; // , Asy
|
|
|
12
12
|
import { asyncConnect, loadOnServer } from './';
|
|
13
13
|
import { matchAllRoutes } from './utils';
|
|
14
14
|
|
|
15
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
16
|
-
|
|
17
15
|
describe('<ReduxAsyncConnect />', () => {
|
|
18
16
|
const initialEmptyState = {
|
|
19
17
|
router: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useDetectClickOutside } from './useDetectClickOutside';
|
|
3
|
-
import {
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
4
|
import { usePopper } from 'react-popper';
|
|
5
5
|
import { BlockChooser } from '@plone/volto/components';
|
|
6
6
|
|
|
@@ -44,10 +44,9 @@ function OpenedChooserWithPortal(props) {
|
|
|
44
44
|
triggerKeys: ['Escape'],
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
return (
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
</Portal>
|
|
47
|
+
return createPortal(
|
|
48
|
+
<div ref={blockChooserRef}>{`Hello ${props.id}`}</div>,
|
|
49
|
+
document.getElementById('body'),
|
|
51
50
|
);
|
|
52
51
|
}
|
|
53
52
|
|
|
@@ -124,7 +123,7 @@ function TestComponentWithPortalAndPopper(props) {
|
|
|
124
123
|
ref={setReferenceElement}
|
|
125
124
|
onClick={() => setOpenMenu(true)}
|
|
126
125
|
>{`Click me ${props.id}`}</button>
|
|
127
|
-
|
|
126
|
+
{createPortal(
|
|
128
127
|
<div
|
|
129
128
|
ref={setPopperElement}
|
|
130
129
|
style={styles.popper}
|
|
@@ -136,8 +135,9 @@ function TestComponentWithPortalAndPopper(props) {
|
|
|
136
135
|
setOpenMenu={setOpenMenu}
|
|
137
136
|
/>
|
|
138
137
|
)}
|
|
139
|
-
</div
|
|
140
|
-
|
|
138
|
+
</div>,
|
|
139
|
+
document.body,
|
|
140
|
+
)}
|
|
141
141
|
</div>
|
|
142
142
|
);
|
|
143
143
|
}
|