@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
|
@@ -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';
|
|
@@ -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
|
}
|
|
@@ -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 jwt from 'jsonwebtoken';
|
|
@@ -8,9 +8,9 @@ import { __test__ as Edit } from './Edit';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
jest.mock('
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
12
|
+
jest.mock('../Sidebar/Sidebar', () => jest.fn(() => <div id="Sidebar" />));
|
|
13
|
+
|
|
14
14
|
jest.mock('../Form/Form', () => jest.fn(() => <div className="Form" />));
|
|
15
15
|
|
|
16
16
|
describe('Edit', () => {
|
|
@@ -50,13 +50,15 @@ describe('Edit', () => {
|
|
|
50
50
|
messages: {},
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
|
-
const
|
|
53
|
+
const { container } = render(
|
|
54
54
|
<Provider store={store}>
|
|
55
|
+
<div id="toolbar"></div>
|
|
55
56
|
<Edit location={{ pathname: '/blog', search: {} }} />
|
|
57
|
+
<div id="sidebar"></div>
|
|
56
58
|
</Provider>,
|
|
57
59
|
);
|
|
58
|
-
|
|
59
|
-
expect(
|
|
60
|
+
|
|
61
|
+
expect(container).toMatchSnapshot();
|
|
60
62
|
});
|
|
61
63
|
|
|
62
64
|
it('renders an edit component', () => {
|
|
@@ -97,12 +99,14 @@ describe('Edit', () => {
|
|
|
97
99
|
messages: {},
|
|
98
100
|
},
|
|
99
101
|
});
|
|
100
|
-
const
|
|
102
|
+
const { container } = render(
|
|
101
103
|
<Provider store={store}>
|
|
104
|
+
<div id="toolbar"></div>
|
|
102
105
|
<Edit location={{ pathname: '/blog', search: {} }} />
|
|
106
|
+
<div id="sidebar"></div>
|
|
103
107
|
</Provider>,
|
|
104
108
|
);
|
|
105
|
-
|
|
106
|
-
expect(
|
|
109
|
+
|
|
110
|
+
expect(container).toMatchSnapshot();
|
|
107
111
|
});
|
|
108
112
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import BlockDataForm from './BlockDataForm';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
5
4
|
import configureStore from 'redux-mock-store';
|
|
6
5
|
import config from '@plone/volto/registry';
|
|
7
6
|
import { Provider } from 'react-intl-redux';
|
|
@@ -31,7 +31,7 @@ import isBoolean from 'lodash/isBoolean';
|
|
|
31
31
|
import PropTypes from 'prop-types';
|
|
32
32
|
import React, { Component } from 'react';
|
|
33
33
|
import { injectIntl } from 'react-intl';
|
|
34
|
-
import {
|
|
34
|
+
import { createPortal } from 'react-dom';
|
|
35
35
|
import { connect } from 'react-redux';
|
|
36
36
|
import {
|
|
37
37
|
Accordion,
|
|
@@ -238,6 +238,7 @@ class Form extends Component {
|
|
|
238
238
|
isClient: false,
|
|
239
239
|
// Ensure focus remain in field after change
|
|
240
240
|
inFocus: {},
|
|
241
|
+
sidebarMetadataIsAvailable: false,
|
|
241
242
|
};
|
|
242
243
|
this.onChangeField = this.onChangeField.bind(this);
|
|
243
244
|
this.onSelectBlock = this.onSelectBlock.bind(this);
|
|
@@ -313,6 +314,13 @@ class Form extends Component {
|
|
|
313
314
|
// Reset focus field
|
|
314
315
|
this.props.resetMetadataFocus();
|
|
315
316
|
}
|
|
317
|
+
|
|
318
|
+
if (
|
|
319
|
+
!this.state.sidebarMetadataIsAvailable &&
|
|
320
|
+
document.getElementById('sidebar-metadata')
|
|
321
|
+
) {
|
|
322
|
+
this.setState(() => ({ sidebarMetadataIsAvailable: true }));
|
|
323
|
+
}
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
/**
|
|
@@ -712,10 +720,10 @@ class Form extends Component {
|
|
|
712
720
|
editable={this.props.editable}
|
|
713
721
|
isMainForm={this.props.editable}
|
|
714
722
|
/>
|
|
715
|
-
{this.state.isClient &&
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
723
|
+
{this.state.isClient &&
|
|
724
|
+
this.state.sidebarMetadataIsAvailable &&
|
|
725
|
+
this.props.editable &&
|
|
726
|
+
createPortal(
|
|
719
727
|
<UiForm
|
|
720
728
|
method="post"
|
|
721
729
|
onSubmit={this.onSubmit}
|
|
@@ -772,9 +780,9 @@ class Form extends Component {
|
|
|
772
780
|
</div>
|
|
773
781
|
</Accordion>
|
|
774
782
|
))}
|
|
775
|
-
</UiForm
|
|
776
|
-
|
|
777
|
-
|
|
783
|
+
</UiForm>,
|
|
784
|
+
document.getElementById('sidebar-metadata'),
|
|
785
|
+
)}
|
|
778
786
|
|
|
779
787
|
<SlotRenderer
|
|
780
788
|
name="belowContent"
|
|
@@ -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 } from '@testing-library/react';
|
|
6
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
7
6
|
|
|
8
7
|
import ModalForm from './ModalForm';
|
|
9
8
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Table,
|
|
18
18
|
} from 'semantic-ui-react';
|
|
19
19
|
import { concat, map, reverse, find } from 'lodash';
|
|
20
|
-
import {
|
|
20
|
+
import { createPortal } from 'react-dom';
|
|
21
21
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
22
22
|
import { asyncConnect } from '@plone/volto/helpers';
|
|
23
23
|
|
|
@@ -314,8 +314,8 @@ class History extends Component {
|
|
|
314
314
|
</Table.Body>
|
|
315
315
|
</Table>
|
|
316
316
|
</Segment.Group>
|
|
317
|
-
{this.state.isClient &&
|
|
318
|
-
|
|
317
|
+
{this.state.isClient &&
|
|
318
|
+
createPortal(
|
|
319
319
|
<Toolbar
|
|
320
320
|
pathname={this.props.pathname}
|
|
321
321
|
hideDefaultViewButtons
|
|
@@ -332,9 +332,9 @@ class History extends Component {
|
|
|
332
332
|
/>
|
|
333
333
|
</Link>
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
335
|
+
/>,
|
|
336
|
+
document.getElementById('toolbar'),
|
|
337
|
+
)}
|
|
338
338
|
</Container>
|
|
339
339
|
);
|
|
340
340
|
}
|
|
@@ -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 { StaticRouter } from 'react-router-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
@@ -9,9 +9,7 @@ import FakeTimers from '@sinonjs/fake-timers';
|
|
|
9
9
|
import History from './History';
|
|
10
10
|
|
|
11
11
|
const mockStore = configureStore();
|
|
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
|
const FIXED_SYSTEM_TIME = '2017-04-23T15:38:00.000Z';
|
|
17
15
|
|
|
@@ -87,13 +85,14 @@ describe('History', () => {
|
|
|
87
85
|
messages: {},
|
|
88
86
|
},
|
|
89
87
|
});
|
|
90
|
-
const
|
|
88
|
+
const { container } = render(
|
|
91
89
|
<Provider store={store}>
|
|
92
90
|
<History location={{ pathname: '/blog' }} />
|
|
91
|
+
<div id="toolbar"></div>
|
|
93
92
|
</Provider>,
|
|
94
93
|
);
|
|
95
|
-
|
|
96
|
-
expect(
|
|
94
|
+
|
|
95
|
+
expect(container).toMatchSnapshot();
|
|
97
96
|
});
|
|
98
97
|
|
|
99
98
|
it('redirects if unassigned', () => {
|
|
@@ -153,13 +152,14 @@ describe('History', () => {
|
|
|
153
152
|
messages: {},
|
|
154
153
|
},
|
|
155
154
|
});
|
|
156
|
-
const
|
|
155
|
+
const { container } = render(
|
|
157
156
|
<Provider store={store}>
|
|
158
157
|
<History location={{ pathname: '/blog' }} />
|
|
158
|
+
<div id="toolbar"></div>
|
|
159
159
|
</Provider>,
|
|
160
160
|
);
|
|
161
|
-
|
|
162
|
-
expect(
|
|
161
|
+
|
|
162
|
+
expect(container).toMatchSnapshot();
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it('redirects if unassigned, no token gives unauthorized', () => {
|
|
@@ -217,14 +217,15 @@ describe('History', () => {
|
|
|
217
217
|
messages: {},
|
|
218
218
|
},
|
|
219
219
|
});
|
|
220
|
-
const
|
|
220
|
+
const { container } = render(
|
|
221
221
|
<Provider store={store}>
|
|
222
222
|
<StaticRouter context={{}} location={'/blog'}>
|
|
223
223
|
<History location={{ pathname: '/blog' }} />
|
|
224
|
+
<div id="toolbar"></div>
|
|
224
225
|
</StaticRouter>
|
|
225
226
|
</Provider>,
|
|
226
227
|
);
|
|
227
|
-
|
|
228
|
-
expect(
|
|
228
|
+
|
|
229
|
+
expect(container).toMatchSnapshot();
|
|
229
230
|
});
|
|
230
231
|
});
|