@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
|
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
|
|
|
9
9
|
import { compose } from 'redux';
|
|
10
10
|
import { Link } from 'react-router-dom';
|
|
11
11
|
import { getParentUrl, Helmet, getBaseUrl } from '@plone/volto/helpers';
|
|
12
|
-
import {
|
|
12
|
+
import { createPortal } from 'react-dom';
|
|
13
13
|
import {
|
|
14
14
|
Button,
|
|
15
15
|
Checkbox,
|
|
@@ -367,8 +367,8 @@ class EditRule extends Component {
|
|
|
367
367
|
</Segment.Group>
|
|
368
368
|
</article>
|
|
369
369
|
</Container>
|
|
370
|
-
{this.state.isClient &&
|
|
371
|
-
|
|
370
|
+
{this.state.isClient &&
|
|
371
|
+
createPortal(
|
|
372
372
|
<Toolbar
|
|
373
373
|
pathname={this.props.pathname}
|
|
374
374
|
hideDefaultViewButtons
|
|
@@ -382,9 +382,9 @@ class EditRule extends Component {
|
|
|
382
382
|
/>
|
|
383
383
|
</Link>
|
|
384
384
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
/>,
|
|
386
|
+
document.getElementById('toolbar'),
|
|
387
|
+
)}
|
|
388
388
|
</div>
|
|
389
389
|
);
|
|
390
390
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import configureMockStore from 'redux-mock-store';
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
@@ -9,9 +9,7 @@ import EditRule from './EditRule';
|
|
|
9
9
|
const middlewares = [thunk];
|
|
10
10
|
const mockStore = configureMockStore(middlewares);
|
|
11
11
|
|
|
12
|
-
jest.mock('
|
|
13
|
-
Portal: jest.fn(() => <div id="Portal" />),
|
|
14
|
-
}));
|
|
12
|
+
jest.mock('../../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
15
13
|
|
|
16
14
|
describe('EditRule', () => {
|
|
17
15
|
it('renders rules edit interface', () => {
|
|
@@ -21,12 +19,13 @@ describe('EditRule', () => {
|
|
|
21
19
|
messages: {},
|
|
22
20
|
},
|
|
23
21
|
});
|
|
24
|
-
const
|
|
22
|
+
const { container } = render(
|
|
25
23
|
<Provider store={store}>
|
|
26
24
|
<EditRule location={{ pathname: '/controlpanel/rules/:id/edit' }} />
|
|
25
|
+
<div id="toolbar"></div>
|
|
27
26
|
</Provider>,
|
|
28
27
|
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
28
|
+
|
|
29
|
+
expect(container).toMatchSnapshot();
|
|
31
30
|
});
|
|
32
31
|
});
|
|
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
|
|
|
9
9
|
import { compose } from 'redux';
|
|
10
10
|
import { Link } from 'react-router-dom';
|
|
11
11
|
import { getBaseUrl, getParentUrl, Helmet } from '@plone/volto/helpers';
|
|
12
|
-
import {
|
|
12
|
+
import { createPortal } from 'react-dom';
|
|
13
13
|
import {
|
|
14
14
|
Button,
|
|
15
15
|
Checkbox,
|
|
@@ -420,8 +420,8 @@ class Rules extends Component {
|
|
|
420
420
|
</Segment.Group>
|
|
421
421
|
</article>
|
|
422
422
|
</Container>
|
|
423
|
-
{this.state.isClient &&
|
|
424
|
-
|
|
423
|
+
{this.state.isClient &&
|
|
424
|
+
createPortal(
|
|
425
425
|
<Toolbar
|
|
426
426
|
pathname={this.props.pathname}
|
|
427
427
|
hideDefaultViewButtons
|
|
@@ -435,9 +435,9 @@ class Rules extends Component {
|
|
|
435
435
|
/>
|
|
436
436
|
</Link>
|
|
437
437
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
/>,
|
|
439
|
+
document.getElementById('toolbar'),
|
|
440
|
+
)}
|
|
441
441
|
</div>
|
|
442
442
|
);
|
|
443
443
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import configureMockStore from 'redux-mock-store';
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
@@ -9,9 +9,7 @@ import Rules from './Rules';
|
|
|
9
9
|
const middlewares = [thunk];
|
|
10
10
|
const mockStore = configureMockStore(middlewares);
|
|
11
11
|
|
|
12
|
-
jest.mock('
|
|
13
|
-
Portal: jest.fn(() => <div id="Portal" />),
|
|
14
|
-
}));
|
|
12
|
+
jest.mock('../../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
15
13
|
|
|
16
14
|
describe('Rules', () => {
|
|
17
15
|
it('renders rules control panel control', () => {
|
|
@@ -64,12 +62,13 @@ describe('Rules', () => {
|
|
|
64
62
|
messages: {},
|
|
65
63
|
},
|
|
66
64
|
});
|
|
67
|
-
const
|
|
65
|
+
const { container } = render(
|
|
68
66
|
<Provider store={store}>
|
|
69
67
|
<Rules location={{ pathname: '/controlpanel/rules' }} />
|
|
68
|
+
<div id="toolbar"></div>
|
|
70
69
|
</Provider>,
|
|
71
70
|
);
|
|
72
|
-
|
|
73
|
-
expect(
|
|
71
|
+
|
|
72
|
+
expect(container).toMatchSnapshot();
|
|
74
73
|
});
|
|
75
74
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import configureMockStore from 'redux-mock-store';
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
@@ -9,9 +9,8 @@ import VariableModal from './VariableModal';
|
|
|
9
9
|
const middlewares = [thunk];
|
|
10
10
|
const mockStore = configureMockStore(middlewares);
|
|
11
11
|
|
|
12
|
-
jest.mock('
|
|
13
|
-
|
|
14
|
-
}));
|
|
12
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
13
|
+
|
|
15
14
|
|
|
16
15
|
describe('VariableModal', () => {
|
|
17
16
|
it('renders rules add interface', () => {
|
|
@@ -21,12 +20,12 @@ describe('VariableModal', () => {
|
|
|
21
20
|
messages: {},
|
|
22
21
|
},
|
|
23
22
|
});
|
|
24
|
-
const
|
|
23
|
+
const { container } = render(
|
|
25
24
|
<Provider store={store}>
|
|
26
25
|
<VariableModal location={{ pathname: '/controlpanel/rules' }} />
|
|
27
26
|
</Provider>,
|
|
28
27
|
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
28
|
+
|
|
29
|
+
expect(container).toMatchSnapshot();
|
|
31
30
|
});
|
|
32
31
|
});
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { connect } from 'react-redux';
|
|
8
8
|
import { compose } from 'redux';
|
|
9
9
|
import { Link } from 'react-router-dom';
|
|
10
|
-
import {
|
|
10
|
+
import { createPortal } from 'react-dom';
|
|
11
11
|
import { Container, Segment, Table, Menu, Input } from 'semantic-ui-react';
|
|
12
12
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
13
13
|
import { Icon, Toolbar, Form, Toast } from '@plone/volto/components';
|
|
@@ -702,8 +702,8 @@ class UndoControlpanel extends Component {
|
|
|
702
702
|
)}
|
|
703
703
|
</Segment.Group>
|
|
704
704
|
</Segment.Group>
|
|
705
|
-
{this.state.isClient &&
|
|
706
|
-
|
|
705
|
+
{this.state.isClient &&
|
|
706
|
+
createPortal(
|
|
707
707
|
<Toolbar
|
|
708
708
|
pathname={this.props.pathname}
|
|
709
709
|
hideDefaultViewButtons
|
|
@@ -720,9 +720,9 @@ class UndoControlpanel extends Component {
|
|
|
720
720
|
</Link>
|
|
721
721
|
</>
|
|
722
722
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
723
|
+
/>,
|
|
724
|
+
document.getElementById('toolbar'),
|
|
725
|
+
)}
|
|
726
726
|
</Container>
|
|
727
727
|
);
|
|
728
728
|
}
|
|
@@ -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
|
|
|
@@ -7,9 +7,8 @@ import UndoControlpanel from './UndoControlpanel';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
jest.mock('
|
|
11
|
-
|
|
12
|
-
}));
|
|
10
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
11
|
+
|
|
13
12
|
jest.mock('../Form/Form', () => jest.fn(() => <div id="form" />));
|
|
14
13
|
|
|
15
14
|
describe('UndoControlpanel', () => {
|
|
@@ -84,12 +83,13 @@ describe('UndoControlpanel', () => {
|
|
|
84
83
|
messages: {},
|
|
85
84
|
},
|
|
86
85
|
});
|
|
87
|
-
const
|
|
86
|
+
const { container } = render(
|
|
88
87
|
<Provider store={store}>
|
|
89
88
|
<UndoControlpanel location={{ pathname: '/blog' }} />
|
|
89
|
+
<div id="toolbar"></div>
|
|
90
90
|
</Provider>,
|
|
91
91
|
);
|
|
92
|
-
|
|
93
|
-
expect(
|
|
92
|
+
|
|
93
|
+
expect(container).toMatchSnapshot();
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { connect } from 'react-redux';
|
|
8
8
|
import { compose } from 'redux';
|
|
9
9
|
import { Link } from 'react-router-dom';
|
|
10
|
-
import {
|
|
10
|
+
import { createPortal } from 'react-dom';
|
|
11
11
|
import {
|
|
12
12
|
Button,
|
|
13
13
|
Container,
|
|
@@ -311,8 +311,8 @@ class UpgradeControlPanel extends Component {
|
|
|
311
311
|
) : null}
|
|
312
312
|
</Segment>
|
|
313
313
|
</Segment.Group>
|
|
314
|
-
{this.state.isClient &&
|
|
315
|
-
|
|
314
|
+
{this.state.isClient &&
|
|
315
|
+
createPortal(
|
|
316
316
|
<Toolbar
|
|
317
317
|
pathname={this.props.pathname}
|
|
318
318
|
hideDefaultViewButtons
|
|
@@ -329,9 +329,9 @@ class UpgradeControlPanel extends Component {
|
|
|
329
329
|
</Link>
|
|
330
330
|
</>
|
|
331
331
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
332
|
+
/>,
|
|
333
|
+
document.getElementById('toolbar'),
|
|
334
|
+
)}
|
|
335
335
|
</Container>
|
|
336
336
|
) : null;
|
|
337
337
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* User Control Panel [user group membership management]
|
|
3
3
|
* TODO Enrich with features of user control panel. Then replace user control panel.
|
|
4
4
|
*/
|
|
5
|
-
import React, { useEffect } from 'react';
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
6
|
import { find } from 'lodash';
|
|
7
|
-
import {
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
8
8
|
import { useHistory } from 'react-router';
|
|
9
9
|
import { Link, useLocation } from 'react-router-dom';
|
|
10
10
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
@@ -45,6 +45,12 @@ const UserGroupMembershipPanel = () => {
|
|
|
45
45
|
id: 'plone_setup',
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
const [isClient, setIsClient] = useState(false);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setIsClient(true);
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
48
54
|
useEffect(() => {
|
|
49
55
|
dispatch(listActions('/'));
|
|
50
56
|
}, [dispatch]);
|
|
@@ -57,7 +63,7 @@ const UserGroupMembershipPanel = () => {
|
|
|
57
63
|
dispatch(getSystemInformation());
|
|
58
64
|
}, [dispatch]);
|
|
59
65
|
|
|
60
|
-
if (
|
|
66
|
+
if (isClient && !ploneSetupAction) {
|
|
61
67
|
return <Unauthorized />;
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -108,8 +114,8 @@ const UserGroupMembershipPanel = () => {
|
|
|
108
114
|
</Segment.Group>
|
|
109
115
|
</div>
|
|
110
116
|
|
|
111
|
-
{
|
|
112
|
-
|
|
117
|
+
{isClient &&
|
|
118
|
+
createPortal(
|
|
113
119
|
<Toolbar
|
|
114
120
|
pathname={pathname}
|
|
115
121
|
hideDefaultViewButtons
|
|
@@ -139,9 +145,9 @@ const UserGroupMembershipPanel = () => {
|
|
|
139
145
|
</Link>
|
|
140
146
|
</>
|
|
141
147
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
/>,
|
|
149
|
+
document.getElementById('toolbar'),
|
|
150
|
+
)}
|
|
145
151
|
</>
|
|
146
152
|
);
|
|
147
153
|
};
|
|
@@ -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';
|
|
@@ -7,9 +7,8 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
7
7
|
import UserGroupMembershipControlPanel from './UserGroupMembershipControlPanel';
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
|
-
jest.mock('
|
|
11
|
-
|
|
12
|
-
}));
|
|
10
|
+
jest.mock('../../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
11
|
+
|
|
13
12
|
describe('UserGroupMembershipControlPanel', () => {
|
|
14
13
|
it('renders a user group membership control component', () => {
|
|
15
14
|
const store = mockStore({
|
|
@@ -49,14 +48,15 @@ describe('UserGroupMembershipControlPanel', () => {
|
|
|
49
48
|
messages: {},
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
|
-
const
|
|
51
|
+
const { container } = render(
|
|
53
52
|
<Provider store={store}>
|
|
54
53
|
<MemoryRouter>
|
|
55
54
|
<UserGroupMembershipControlPanel />
|
|
55
|
+
<div id="toolbar"></div>
|
|
56
56
|
</MemoryRouter>
|
|
57
57
|
</Provider>,
|
|
58
58
|
);
|
|
59
|
-
|
|
60
|
-
expect(
|
|
59
|
+
|
|
60
|
+
expect(container).toMatchSnapshot();
|
|
61
61
|
});
|
|
62
62
|
});
|
|
@@ -32,7 +32,7 @@ import { find, map, pull, difference } from 'lodash';
|
|
|
32
32
|
import PropTypes from 'prop-types';
|
|
33
33
|
import React, { Component } from 'react';
|
|
34
34
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
35
|
-
import {
|
|
35
|
+
import { createPortal } from 'react-dom';
|
|
36
36
|
import { connect } from 'react-redux';
|
|
37
37
|
import { toast } from 'react-toastify';
|
|
38
38
|
import { bindActionCreators, compose } from 'redux';
|
|
@@ -338,8 +338,8 @@ class UsersControlpanel extends Component {
|
|
|
338
338
|
entry.id === name && !entry.roles.includes(value)
|
|
339
339
|
? [...entry.roles, value]
|
|
340
340
|
: entry.id !== name
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
? entry.roles
|
|
342
|
+
: pull(entry.roles, value),
|
|
343
343
|
})),
|
|
344
344
|
});
|
|
345
345
|
}
|
|
@@ -619,8 +619,8 @@ class UsersControlpanel extends Component {
|
|
|
619
619
|
</div>
|
|
620
620
|
</Form>
|
|
621
621
|
</Segment.Group>
|
|
622
|
-
{this.state.isClient &&
|
|
623
|
-
|
|
622
|
+
{this.state.isClient &&
|
|
623
|
+
createPortal(
|
|
624
624
|
<Toolbar
|
|
625
625
|
pathname={this.props.pathname}
|
|
626
626
|
hideDefaultViewButtons
|
|
@@ -672,9 +672,9 @@ class UsersControlpanel extends Component {
|
|
|
672
672
|
</Button>
|
|
673
673
|
</>
|
|
674
674
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
/>,
|
|
676
|
+
document.getElementById('toolbar'),
|
|
677
|
+
)}
|
|
678
678
|
</Container>
|
|
679
679
|
);
|
|
680
680
|
}
|
|
@@ -1,14 +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
|
|
|
6
6
|
import UsersControlpanel from './UsersControlpanel';
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
|
-
jest.mock('
|
|
10
|
-
|
|
11
|
-
}));
|
|
9
|
+
jest.mock('../../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
10
|
+
|
|
12
11
|
describe('UsersControlpanel', () => {
|
|
13
12
|
it('renders a user control component', () => {
|
|
14
13
|
const store = mockStore({
|
|
@@ -29,12 +28,13 @@ describe('UsersControlpanel', () => {
|
|
|
29
28
|
messages: {},
|
|
30
29
|
},
|
|
31
30
|
});
|
|
32
|
-
const
|
|
31
|
+
const { container } = render(
|
|
33
32
|
<Provider store={store}>
|
|
34
33
|
<UsersControlpanel location={{ pathname: '/blog' }} />
|
|
34
|
+
<div id="toolbar"></div>
|
|
35
35
|
</Provider>,
|
|
36
36
|
);
|
|
37
|
-
|
|
38
|
-
expect(
|
|
37
|
+
|
|
38
|
+
expect(container).toMatchSnapshot();
|
|
39
39
|
});
|
|
40
40
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
|
|
3
3
|
import { useHistory, useLocation } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
5
|
import { Button, Container, List, Segment } from 'semantic-ui-react';
|
|
6
6
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
|
7
7
|
import qs from 'query-string';
|
|
@@ -110,15 +110,15 @@ const Delete = () => {
|
|
|
110
110
|
</Segment>
|
|
111
111
|
</Segment.Group>
|
|
112
112
|
</Container>
|
|
113
|
-
{isClient &&
|
|
114
|
-
|
|
113
|
+
{isClient &&
|
|
114
|
+
createPortal(
|
|
115
115
|
<Toolbar
|
|
116
116
|
pathname={pathname}
|
|
117
117
|
hideDefaultViewButtons
|
|
118
118
|
inner={<span />}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
/>,
|
|
120
|
+
document.getElementById('toolbar'),
|
|
121
|
+
)}
|
|
122
122
|
</div>
|
|
123
123
|
);
|
|
124
124
|
}
|
|
@@ -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,7 @@ import Delete from './Delete';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
jest.mock('
|
|
12
|
-
Portal: jest.fn(() => <div id="Portal" />),
|
|
13
|
-
}));
|
|
11
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
14
12
|
|
|
15
13
|
describe('Delete', () => {
|
|
16
14
|
it('renders an empty delete component', () => {
|
|
@@ -27,15 +25,16 @@ describe('Delete', () => {
|
|
|
27
25
|
messages: {},
|
|
28
26
|
},
|
|
29
27
|
});
|
|
30
|
-
const
|
|
28
|
+
const { container } = render(
|
|
31
29
|
<Provider store={store}>
|
|
32
30
|
<MemoryRouter>
|
|
33
31
|
<Delete location={{ pathname: '/blog', search: {} }} />
|
|
32
|
+
<div id="toolbar"></div>
|
|
34
33
|
</MemoryRouter>
|
|
35
34
|
</Provider>,
|
|
36
35
|
);
|
|
37
|
-
|
|
38
|
-
expect(
|
|
36
|
+
|
|
37
|
+
expect(container).toMatchSnapshot();
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
it('renders a delete component', () => {
|
|
@@ -54,14 +53,15 @@ describe('Delete', () => {
|
|
|
54
53
|
messages: {},
|
|
55
54
|
},
|
|
56
55
|
});
|
|
57
|
-
const
|
|
56
|
+
const { container } = render(
|
|
58
57
|
<Provider store={store}>
|
|
59
58
|
<MemoryRouter>
|
|
60
59
|
<Delete location={{ pathname: '/blog', search: {} }} />
|
|
60
|
+
<div id="toolbar"></div>
|
|
61
61
|
</MemoryRouter>
|
|
62
62
|
</Provider>,
|
|
63
63
|
);
|
|
64
|
-
|
|
65
|
-
expect(
|
|
64
|
+
|
|
65
|
+
expect(container).toMatchSnapshot();
|
|
66
66
|
});
|
|
67
67
|
});
|
|
@@ -11,7 +11,7 @@ import { compose } from 'redux';
|
|
|
11
11
|
import { filter, isEqual, map } from 'lodash';
|
|
12
12
|
import { Container, Button, Dropdown, Grid, Table } from 'semantic-ui-react';
|
|
13
13
|
import { Link, withRouter } from 'react-router-dom';
|
|
14
|
-
import {
|
|
14
|
+
import { createPortal } from 'react-dom';
|
|
15
15
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
16
16
|
import qs from 'query-string';
|
|
17
17
|
|
|
@@ -333,8 +333,8 @@ class Diff extends Component {
|
|
|
333
333
|
view={this.props.view}
|
|
334
334
|
/>
|
|
335
335
|
)}
|
|
336
|
-
{this.state.isClient &&
|
|
337
|
-
|
|
336
|
+
{this.state.isClient &&
|
|
337
|
+
createPortal(
|
|
338
338
|
<Toolbar
|
|
339
339
|
pathname={this.props.pathname}
|
|
340
340
|
hideDefaultViewButtons
|
|
@@ -351,9 +351,9 @@ class Diff extends Component {
|
|
|
351
351
|
/>
|
|
352
352
|
</Link>
|
|
353
353
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
/>,
|
|
355
|
+
document.getElementById('toolbar'),
|
|
356
|
+
)}
|
|
357
357
|
</Container>
|
|
358
358
|
);
|
|
359
359
|
}
|
|
@@ -8,9 +8,7 @@ import Diff from './Diff';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
jest.mock('
|
|
12
|
-
Portal: jest.fn(() => <div id="Portal" />),
|
|
13
|
-
}));
|
|
11
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
14
12
|
|
|
15
13
|
jest.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
16
14
|
beforeAll(
|
|
@@ -75,6 +73,7 @@ describe('Diff', () => {
|
|
|
75
73
|
<Provider store={store}>
|
|
76
74
|
<MemoryRouter initialEntries={['/blog?one=0&two=1']}>
|
|
77
75
|
<Diff />
|
|
76
|
+
<div id="toolbar"></div>
|
|
78
77
|
</MemoryRouter>
|
|
79
78
|
</Provider>,
|
|
80
79
|
);
|
|
@@ -11,7 +11,7 @@ import { compose } from 'redux';
|
|
|
11
11
|
import { asyncConnect, hasApiExpander } from '@plone/volto/helpers';
|
|
12
12
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
13
13
|
import { Button, Grid, Menu } from 'semantic-ui-react';
|
|
14
|
-
import {
|
|
14
|
+
import { createPortal } from 'react-dom';
|
|
15
15
|
import qs from 'query-string';
|
|
16
16
|
import { find } from 'lodash';
|
|
17
17
|
import { toast } from 'react-toastify';
|
|
@@ -375,11 +375,10 @@ class Edit extends Component {
|
|
|
375
375
|
</>
|
|
376
376
|
)}
|
|
377
377
|
|
|
378
|
-
{editPermission &&
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
)}
|
|
378
|
+
{editPermission &&
|
|
379
|
+
this.state.visual &&
|
|
380
|
+
this.state.isClient &&
|
|
381
|
+
createPortal(<Sidebar />, document.getElementById('sidebar'))}
|
|
383
382
|
</>
|
|
384
383
|
)}
|
|
385
384
|
{!editPermission && (
|
|
@@ -397,8 +396,8 @@ class Edit extends Component {
|
|
|
397
396
|
)}
|
|
398
397
|
</>
|
|
399
398
|
)}
|
|
400
|
-
{this.state.isClient &&
|
|
401
|
-
|
|
399
|
+
{this.state.isClient &&
|
|
400
|
+
createPortal(
|
|
402
401
|
<Toolbar
|
|
403
402
|
pathname={this.props.pathname}
|
|
404
403
|
hideDefaultViewButtons
|
|
@@ -446,9 +445,9 @@ class Edit extends Component {
|
|
|
446
445
|
)}
|
|
447
446
|
</>
|
|
448
447
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
/>,
|
|
449
|
+
document.getElementById('toolbar'),
|
|
450
|
+
)}
|
|
452
451
|
</div>
|
|
453
452
|
);
|
|
454
453
|
}
|