@plone/volto 18.0.0-alpha.14 → 18.0.0-alpha.16
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 +17 -0
- package/jest-setup-afterenv.js +2 -0
- package/package.json +32 -29
- package/src/components/index.js +9 -8
- 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/Edit.jsx +12 -12
- package/src/components/manage/Blocks/Image/ImageSidebar.jsx +3 -3
- package/src/components/manage/Blocks/Image/View.jsx +14 -14
- package/src/components/manage/Blocks/Image/View.test.jsx +0 -1
- package/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +6 -6
- package/src/components/manage/Blocks/Search/SelectStyling.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/CheckboxFacet.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/Facets.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/SelectStyling.jsx +4 -4
- package/src/components/manage/Blocks/Table/Edit.jsx +7 -6
- package/src/components/manage/Contents/Contents.jsx +9 -9
- 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 +10 -10
- 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 +8 -8
- 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/Display/Display.jsx +2 -2
- 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/ObjectBrowserBody.jsx +10 -10
- 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/ArrayWidget.jsx +21 -21
- package/src/components/manage/Widgets/FileWidget.jsx +3 -3
- 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/RecurrenceWidget/RecurrenceWidget.jsx +2 -2
- package/src/components/manage/Widgets/ReferenceWidget.jsx +2 -2
- 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/SelectAutoComplete.jsx +6 -6
- package/src/components/manage/Widgets/SelectStyling.jsx +4 -4
- package/src/components/manage/Widgets/SelectUtils.js +2 -2
- package/src/components/manage/Widgets/UrlWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +4 -4
- package/src/components/manage/Workflow/Workflow.jsx +2 -2
- 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/components/theme/Widgets/BooleanWidget.jsx +2 -2
- package/src/config/Loadables.jsx +10 -10
- package/src/config/Views.jsx +2 -2
- package/src/config/Widgets.jsx +7 -6
- package/src/helpers/AsyncConnect/AsyncConnect.test.js +0 -2
- package/src/helpers/Blocks/Blocks.js +20 -20
- package/src/helpers/Html/Html.jsx +2 -2
- package/src/helpers/Utils/Date.js +6 -6
- package/src/helpers/Utils/UseDetectClickOutside.stories.jsx +8 -8
- package/src/helpers/Utils/Utils.js +2 -2
- package/src/start-client.jsx +3 -3
- package/src/store.js +1 -1
- 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,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);
|
|
@@ -24,8 +24,8 @@ const BooleanWidget = ({ value, children, className, intl }) => {
|
|
|
24
24
|
: intl.formatMessage(messages.no),
|
|
25
25
|
)
|
|
26
26
|
: value
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
? intl.formatMessage(messages.yes)
|
|
28
|
+
: intl.formatMessage(messages.no)}
|
|
29
29
|
</span>
|
|
30
30
|
) : (
|
|
31
31
|
''
|
package/src/config/Loadables.jsx
CHANGED
|
@@ -39,22 +39,22 @@ export const loadables = {
|
|
|
39
39
|
// draftjs libs
|
|
40
40
|
immutableLib: loadable.lib(() => import('immutable')),
|
|
41
41
|
draftJs: loadable.lib(() => import('draft-js')),
|
|
42
|
-
draftJsLibIsSoftNewlineEvent: loadable.lib(
|
|
43
|
-
import('draft-js/lib/isSoftNewlineEvent'),
|
|
42
|
+
draftJsLibIsSoftNewlineEvent: loadable.lib(
|
|
43
|
+
() => import('draft-js/lib/isSoftNewlineEvent'),
|
|
44
44
|
),
|
|
45
45
|
draftJsFilters: loadable.lib(() => import('draftjs-filters')),
|
|
46
|
-
draftJsInlineToolbarPlugin: loadable.lib(
|
|
47
|
-
import('draft-js-inline-toolbar-plugin'),
|
|
46
|
+
draftJsInlineToolbarPlugin: loadable.lib(
|
|
47
|
+
() => import('draft-js-inline-toolbar-plugin'),
|
|
48
48
|
),
|
|
49
49
|
draftJsImportHtml: loadable.lib(() => import('draft-js-import-html')),
|
|
50
|
-
draftJsBlockBreakoutPlugin: loadable.lib(
|
|
51
|
-
import('draft-js-block-breakout-plugin'),
|
|
50
|
+
draftJsBlockBreakoutPlugin: loadable.lib(
|
|
51
|
+
() => import('draft-js-block-breakout-plugin'),
|
|
52
52
|
),
|
|
53
|
-
draftJsCreateInlineStyleButton: loadable.lib(
|
|
54
|
-
import('draft-js-buttons/lib/utils/createInlineStyleButton'),
|
|
53
|
+
draftJsCreateInlineStyleButton: loadable.lib(
|
|
54
|
+
() => import('draft-js-buttons/lib/utils/createInlineStyleButton'),
|
|
55
55
|
),
|
|
56
|
-
draftJsCreateBlockStyleButton: loadable.lib(
|
|
57
|
-
import('draft-js-buttons/lib/utils/createBlockStyleButton'),
|
|
56
|
+
draftJsCreateBlockStyleButton: loadable.lib(
|
|
57
|
+
() => import('draft-js-buttons/lib/utils/createBlockStyleButton'),
|
|
58
58
|
),
|
|
59
59
|
draftJsPluginsUtils: loadable.lib(() => import('draft-js-plugins-utils')),
|
|
60
60
|
};
|
package/src/config/Views.jsx
CHANGED
|
@@ -18,8 +18,8 @@ import Unauthorized from '@plone/volto/components/theme/Unauthorized/Unauthorize
|
|
|
18
18
|
import Forbidden from '@plone/volto/components/theme/Forbidden/Forbidden';
|
|
19
19
|
import ServerError from '@plone/volto/components/theme/Error/ServerError';
|
|
20
20
|
|
|
21
|
-
const EventView = loadable(
|
|
22
|
-
import('@plone/volto/components/theme/View/EventView'),
|
|
21
|
+
const EventView = loadable(
|
|
22
|
+
() => import('@plone/volto/components/theme/View/EventView'),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
defineMessages({
|
package/src/config/Widgets.jsx
CHANGED
|
@@ -55,13 +55,14 @@ import TitleViewWidget from '@plone/volto/components/theme/Widgets/TitleWidget';
|
|
|
55
55
|
import TokenViewWidget from '@plone/volto/components/theme/Widgets/TokenWidget';
|
|
56
56
|
import UrlViewWidget from '@plone/volto/components/theme/Widgets/UrlWidget';
|
|
57
57
|
|
|
58
|
-
export const DatetimeWidget = loadable(
|
|
59
|
-
import('@plone/volto/components/manage/Widgets/DatetimeWidget'),
|
|
58
|
+
export const DatetimeWidget = loadable(
|
|
59
|
+
() => import('@plone/volto/components/manage/Widgets/DatetimeWidget'),
|
|
60
60
|
);
|
|
61
|
-
export const RecurrenceWidget = loadable(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
export const RecurrenceWidget = loadable(
|
|
62
|
+
() =>
|
|
63
|
+
import(
|
|
64
|
+
'@plone/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget'
|
|
65
|
+
),
|
|
65
66
|
);
|
|
66
67
|
|
|
67
68
|
// Widgets mapping
|
|
@@ -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: {
|
|
@@ -483,26 +483,26 @@ export function applySchemaDefaults({ data = {}, schema, intl }) {
|
|
|
483
483
|
[currentField]: schema.properties[currentField].default,
|
|
484
484
|
}
|
|
485
485
|
: intl &&
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
486
|
+
schema.properties[currentField].schema &&
|
|
487
|
+
!(schema.properties[currentField].widget === 'object_list') // TODO: this should be renamed as itemSchema
|
|
488
|
+
? {
|
|
489
|
+
...accumulator,
|
|
490
|
+
[currentField]: {
|
|
491
|
+
...applySchemaDefaults({
|
|
492
|
+
data: { ...data[currentField], ...accumulator[currentField] },
|
|
493
|
+
schema:
|
|
494
|
+
typeof schema.properties[currentField].schema === 'function'
|
|
495
|
+
? schema.properties[currentField].schema({
|
|
496
|
+
data: accumulator[currentField],
|
|
497
|
+
formData: accumulator[currentField],
|
|
498
|
+
intl,
|
|
499
|
+
})
|
|
500
|
+
: schema.properties[currentField].schema,
|
|
501
|
+
intl,
|
|
502
|
+
}),
|
|
503
|
+
},
|
|
504
|
+
}
|
|
505
|
+
: accumulator;
|
|
506
506
|
}, {}),
|
|
507
507
|
data,
|
|
508
508
|
);
|
|
@@ -143,8 +143,8 @@ class Html extends Component {
|
|
|
143
143
|
rel: !criticalCss
|
|
144
144
|
? elem.props.rel
|
|
145
145
|
: elem.props.as === 'style'
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
? 'prefetch'
|
|
147
|
+
: elem.props.rel,
|
|
148
148
|
}),
|
|
149
149
|
)}
|
|
150
150
|
{/* Styles in development are loaded with Webpack's style-loader, in production,
|
|
@@ -42,10 +42,10 @@ export function formatDate({
|
|
|
42
42
|
format = format
|
|
43
43
|
? format
|
|
44
44
|
: long && !includeTime
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
? long_date_format
|
|
46
|
+
: includeTime
|
|
47
|
+
? short_date_and_time_format
|
|
48
|
+
: short_date_format;
|
|
49
49
|
|
|
50
50
|
const formatter = new Intl.DateTimeFormat(locale, format);
|
|
51
51
|
return formatToParts
|
|
@@ -94,6 +94,6 @@ export function formatRelativeDate({
|
|
|
94
94
|
return isNaN(v)
|
|
95
95
|
? ''
|
|
96
96
|
: formatToParts
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
? formatter.formatToParts(v, tag)
|
|
98
|
+
: formatter.format(v, tag).replace('\u202F', ' '); // use "now" ?
|
|
99
99
|
}
|
|
@@ -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
|
}
|
|
@@ -136,8 +136,8 @@ export const getColor = (name) => {
|
|
|
136
136
|
const namedColor = namedColors[name]
|
|
137
137
|
? namedColors[name]
|
|
138
138
|
: safeColors.length > 0
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
? safeColors.pop()
|
|
140
|
+
: `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
141
141
|
if (!namedColors[name]) {
|
|
142
142
|
namedColors[name] = namedColor;
|
|
143
143
|
}
|