@plone/volto 18.11.0 → 18.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc +2 -0
- package/CHANGELOG.md +27 -0
- package/cypress/support/commands.js +19 -2
- package/locales/eu.json +1 -1
- package/package.json +10 -4
- package/src/actions/actions/actions.test.js +3 -3
- package/src/actions/addons/addons.test.js +15 -12
- package/src/actions/aliases/aliases.test.js +1 -1
- package/src/actions/types/types.test.js +1 -1
- package/src/components/manage/Actions/Actions.test.jsx +1 -1
- package/src/components/manage/Add/Add.test.jsx +6 -3
- package/src/components/manage/Aliases/Aliases.test.jsx +7 -7
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +3 -3
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +44 -16
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -1
- package/src/components/manage/Blocks/Description/View.test.jsx +1 -1
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +7 -5
- package/src/components/manage/Blocks/HTML/View.test.jsx +1 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +2 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +3 -1
- package/src/components/manage/Blocks/Listing/View.test.jsx +3 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -1
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +8 -7
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +7 -6
- package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +11 -1
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -1
- package/src/components/manage/Contents/Contents.test.jsx +24 -13
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -1
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -1
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -1
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -1
- package/src/components/manage/Contents/__mocks__/index.tsx +3 -2
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +28 -3
- package/src/components/manage/Controlpanels/Aliases.test.jsx +30 -3
- package/src/components/manage/Controlpanels/ContentType.test.jsx +25 -3
- package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +4 -2
- package/src/components/manage/Controlpanels/ContentTypes.test.jsx +25 -2
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +37 -6
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +47 -3
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +15 -9
- package/src/components/manage/Controlpanels/ModerateComments.test.jsx +31 -5
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +8 -4
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +9 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +8 -4
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +7 -3
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +29 -4
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -1
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +15 -9
- package/src/components/manage/Delete/Delete.test.jsx +45 -4
- package/src/components/manage/Diff/Diff.test.jsx +12 -6
- package/src/components/manage/Diff/DiffField.test.jsx +7 -6
- package/src/components/manage/Display/Display.test.jsx +8 -6
- package/src/components/manage/Edit/Edit.test.jsx +7 -3
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -1
- package/src/components/manage/Form/Form.test.jsx +1 -1
- package/src/components/manage/Form/InlineForm.test.jsx +1 -1
- package/src/components/manage/Form/ModalForm.test.jsx +1 -1
- package/src/components/manage/Form/__mocks__/index.tsx +10 -10
- package/src/components/manage/History/History.test.jsx +3 -1
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +6 -4
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +3 -2
- package/src/components/manage/Preferences/ChangePassword.test.jsx +4 -2
- package/src/components/manage/Preferences/PersonalInformation.test.jsx +3 -1
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +11 -7
- package/src/components/manage/Rules/Rules.test.jsx +6 -3
- package/src/components/manage/Sharing/Sharing.test.jsx +3 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.test.jsx +3 -3
- package/src/components/manage/Toolbar/More.test.jsx +6 -7
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +1 -1
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +18 -5
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +7 -5
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +17 -6
- package/src/components/manage/Widgets/FileWidget.jsx +3 -3
- package/src/components/manage/Widgets/FileWidget.test.jsx +54 -22
- package/src/components/manage/Widgets/NumberWidget.test.jsx +8 -7
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -2
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +10 -8
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -1
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +7 -5
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +7 -6
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +3 -3
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +43 -41
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +7 -5
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +7 -5
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +7 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +7 -6
- package/src/components/manage/Widgets/TimeWidget.test.jsx +8 -5
- package/src/components/manage/Widgets/TokenWidget.test.jsx +7 -6
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +10 -9
- package/src/components/manage/Widgets/__mocks__/index.tsx +35 -35
- package/src/components/manage/Workflow/Workflow.test.jsx +8 -7
- package/src/components/theme/App/App.test.jsx +21 -17
- package/src/components/theme/AppExtras/AppExtras.test.jsx +8 -6
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -1
- package/src/components/theme/Comments/Comments.test.jsx +21 -12
- package/src/components/theme/ContactForm/ContactForm.test.jsx +4 -4
- package/src/components/theme/Header/Header.test.jsx +19 -13
- package/src/components/theme/Logo/Logo.jsx +2 -1
- package/src/components/theme/Logout/Logout.test.jsx +1 -1
- package/src/components/theme/Navigation/ContextNavigation.jsx +7 -2
- package/src/components/theme/PasswordReset/PasswordReset.test.jsx +10 -1
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +1 -1
- package/src/components/theme/Search/Search.test.jsx +6 -4
- package/src/components/theme/TsTest/TsTest.test.tsx +0 -1
- package/src/components/theme/View/EventDatesInfo.test.jsx +7 -5
- package/src/components/theme/View/EventView.test.jsx +7 -5
- package/src/components/theme/View/ListingView.test.jsx +2 -0
- package/src/components/theme/View/SummaryView.test.jsx +10 -0
- package/src/components/theme/View/TabularView.test.jsx +1 -0
- package/src/components/theme/View/View.test.jsx +42 -23
- package/src/helpers/Api/Api.plone.rest.test.js +12 -9
- package/src/helpers/Api/Api.test.js +12 -9
- package/src/helpers/AsyncConnect/AsyncConnect.test.jsx +145 -189
- package/src/helpers/AuthToken/AuthToken.test.js +61 -22
- package/src/helpers/Blocks/Blocks.js +1 -1
- package/src/helpers/Blocks/Blocks.test.js +1 -1
- package/src/helpers/Html/Html.test.jsx +32 -28
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -6
- package/src/middleware/storeProtectLoadUtils.test.js +90 -78
- package/test-setup-globals.js +36 -2
- package/tsconfig.json +23 -6
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/server.d.ts +1 -1
- package/vite-plugins/svg.js +81 -0
- package/vitest.config.ts +61 -0
|
@@ -9,9 +9,13 @@ import Aliases from './Aliases';
|
|
|
9
9
|
const middlewares = [thunk];
|
|
10
10
|
const mockStore = configureMockStore(middlewares);
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
vi.mock('../Toolbar/Toolbar', () => ({
|
|
13
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
14
|
+
}));
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
vi.mock('../Toolbar/More', () => ({
|
|
17
|
+
default: vi.fn(() => <div className="More" />),
|
|
18
|
+
}));
|
|
15
19
|
|
|
16
20
|
describe('Aliases', () => {
|
|
17
21
|
it('renders aliases object control', () => {
|
|
@@ -27,11 +31,7 @@ describe('Aliases', () => {
|
|
|
27
31
|
loading: false,
|
|
28
32
|
error: null,
|
|
29
33
|
},
|
|
30
|
-
get: {
|
|
31
|
-
loading: false,
|
|
32
|
-
loaded: true,
|
|
33
|
-
error: null,
|
|
34
|
-
},
|
|
34
|
+
get: { __esModule: true, loading: false, loaded: true, error: null },
|
|
35
35
|
items: [],
|
|
36
36
|
},
|
|
37
37
|
content: {
|
|
@@ -142,7 +142,7 @@ const BlocksForm = (props) => {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
const onMutateBlock = (id, value) => {
|
|
145
|
-
const newFormData = mutateBlock(properties, id, value,
|
|
145
|
+
const newFormData = mutateBlock(properties, id, value, null, intl);
|
|
146
146
|
onChangeFormData(newFormData);
|
|
147
147
|
};
|
|
148
148
|
|
|
@@ -153,7 +153,7 @@ const BlocksForm = (props) => {
|
|
|
153
153
|
value,
|
|
154
154
|
current,
|
|
155
155
|
config.experimental.addBlockButton.enabled ? 1 : 0,
|
|
156
|
-
|
|
156
|
+
null,
|
|
157
157
|
intl,
|
|
158
158
|
);
|
|
159
159
|
|
|
@@ -172,7 +172,7 @@ const BlocksForm = (props) => {
|
|
|
172
172
|
|
|
173
173
|
const onAddBlock = (type, index) => {
|
|
174
174
|
if (editable) {
|
|
175
|
-
const [id, newFormData] = addBlock(properties, type, index,
|
|
175
|
+
const [id, newFormData] = addBlock(properties, type, index, null, intl);
|
|
176
176
|
const blocksFieldname = getBlocksFieldname(newFormData);
|
|
177
177
|
const blockData = newFormData[blocksFieldname][id];
|
|
178
178
|
newFormData[blocksFieldname][id] = applyBlockDefaults({
|
|
@@ -3,25 +3,46 @@ import { Provider } from 'react-intl-redux';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import BlocksForm from './BlocksForm';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
-
|
|
7
6
|
import config from '@plone/volto/registry';
|
|
8
7
|
|
|
9
8
|
config.experimental = { addBlockButton: { enabled: false } };
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
beforeAll(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
10
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
const { __setLoadables } = await import(
|
|
13
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
14
|
+
);
|
|
15
|
+
await __setLoadables();
|
|
16
|
+
});
|
|
16
17
|
|
|
17
18
|
let mockSerial = 0;
|
|
18
|
-
|
|
19
|
-
jest.mock('uuid', () => {
|
|
19
|
+
vi.mock('uuid', () => {
|
|
20
20
|
return {
|
|
21
|
-
v4:
|
|
21
|
+
v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`),
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
vi.mock('react-beautiful-dnd', () => ({
|
|
26
|
+
DragDropContext: ({ children }) => <div>{children}</div>,
|
|
27
|
+
Droppable: ({ children }) =>
|
|
28
|
+
children({
|
|
29
|
+
innerRef: () => {},
|
|
30
|
+
droppableProps: {},
|
|
31
|
+
placeholder: <div />,
|
|
32
|
+
}),
|
|
33
|
+
Draggable: ({ children }) =>
|
|
34
|
+
children({
|
|
35
|
+
innerRef: () => {},
|
|
36
|
+
draggableProps: {},
|
|
37
|
+
dragHandleProps: {},
|
|
38
|
+
}),
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
vi.mock('./Order/Order', () => ({
|
|
42
|
+
__esModule: true,
|
|
43
|
+
default: () => <div>Order Component</div>,
|
|
44
|
+
}));
|
|
45
|
+
|
|
25
46
|
const mockStore = configureStore();
|
|
26
47
|
|
|
27
48
|
test('Allow override of blocksConfig', () => {
|
|
@@ -70,10 +91,13 @@ test('Allow override of blocksConfig', () => {
|
|
|
70
91
|
|
|
71
92
|
const { container } = render(
|
|
72
93
|
<Provider store={store}>
|
|
73
|
-
<
|
|
74
|
-
|
|
94
|
+
<div>
|
|
95
|
+
<BlocksForm {...data} />
|
|
96
|
+
<div id="sidebar-order"></div>
|
|
97
|
+
</div>
|
|
75
98
|
</Provider>,
|
|
76
99
|
);
|
|
100
|
+
|
|
77
101
|
expect(container).toMatchSnapshot();
|
|
78
102
|
});
|
|
79
103
|
|
|
@@ -88,7 +112,7 @@ test('Removes invalid blocks on saving', () => {
|
|
|
88
112
|
},
|
|
89
113
|
});
|
|
90
114
|
|
|
91
|
-
const onChangeFormData =
|
|
115
|
+
const onChangeFormData = vi.fn(() => {});
|
|
92
116
|
|
|
93
117
|
const data = {
|
|
94
118
|
pathname: '/test',
|
|
@@ -126,18 +150,22 @@ test('Removes invalid blocks on saving', () => {
|
|
|
126
150
|
|
|
127
151
|
render(
|
|
128
152
|
<Provider store={store}>
|
|
129
|
-
<
|
|
130
|
-
|
|
153
|
+
<div>
|
|
154
|
+
<BlocksForm {...data} />
|
|
155
|
+
<div id="sidebar-order"></div>
|
|
156
|
+
</div>
|
|
131
157
|
</Provider>,
|
|
132
158
|
);
|
|
133
|
-
|
|
159
|
+
|
|
160
|
+
expect(onChangeFormData).toHaveBeenCalledWith({
|
|
134
161
|
blocks: {
|
|
135
162
|
a: { '@type': 'custom', text: 'a' },
|
|
136
163
|
b: { '@type': 'custom', text: 'b' },
|
|
137
164
|
},
|
|
138
165
|
blocks_layout: { items: ['a', 'b', 'MISSING-YOU-1'] },
|
|
139
166
|
});
|
|
140
|
-
|
|
167
|
+
|
|
168
|
+
expect(onChangeFormData).toHaveBeenCalledWith({
|
|
141
169
|
blocks: {
|
|
142
170
|
a: { '@type': 'custom', text: 'a' },
|
|
143
171
|
b: { '@type': 'custom', text: 'b' },
|
|
@@ -5,7 +5,7 @@ import configureStore from 'redux-mock-store';
|
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
9
9
|
|
|
10
10
|
const mockStore = configureStore();
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
it('renders a view description component', () => {
|
|
6
6
|
const component = renderer.create(
|
|
7
7
|
<View properties={{ description: 'My Description' }} />,
|
|
8
8
|
);
|
|
@@ -7,11 +7,13 @@ import Edit from './Edit';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
beforeAll(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
10
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
const { __setLoadables } = await import(
|
|
13
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
14
|
+
);
|
|
15
|
+
await __setLoadables();
|
|
16
|
+
});
|
|
15
17
|
|
|
16
18
|
test('renders an edit html block component', async () => {
|
|
17
19
|
const store = mockStore({
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
it('renders a view html component', () => {
|
|
6
6
|
const component = renderer.create(<View data={{ html: '<h1></h1>' }} />);
|
|
7
7
|
const json = component.toJSON();
|
|
8
8
|
expect(json).toMatchSnapshot();
|
|
@@ -5,11 +5,11 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import ImageSidebar from './ImageSidebar';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
9
9
|
|
|
10
10
|
const mockStore = configureStore();
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
it('renders an Image Block Sidebar component', () => {
|
|
13
13
|
const store = mockStore({
|
|
14
14
|
content: {
|
|
15
15
|
create: {},
|
|
@@ -5,7 +5,7 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import LeadImageSidebar from './LeadImageSidebar';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Widgets');
|
|
9
9
|
|
|
10
10
|
const mockStore = configureStore();
|
|
11
11
|
|
|
@@ -16,6 +16,7 @@ test('renders a Lead Image block Sidebar component', () => {
|
|
|
16
16
|
messages: {},
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
|
+
|
|
19
20
|
const component = renderer.create(
|
|
20
21
|
<Provider store={store}>
|
|
21
22
|
<LeadImageSidebar
|
|
@@ -45,6 +46,7 @@ test('renders a Lead Image block Sidebar component', () => {
|
|
|
45
46
|
/>
|
|
46
47
|
</Provider>,
|
|
47
48
|
);
|
|
49
|
+
|
|
48
50
|
const json = component.toJSON();
|
|
49
51
|
expect(json).toMatchSnapshot();
|
|
50
52
|
});
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
vi.mock('./ListingBody', () => ({
|
|
6
|
+
default: () => <div className="theblock" />,
|
|
7
|
+
}));
|
|
6
8
|
|
|
7
9
|
test('renders a view image component for the listing block', () => {
|
|
8
10
|
const component = renderer.create(
|
|
@@ -2,18 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import { waitFor, render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
5
|
import DateRangeFacet from './DateRangeFacet';
|
|
7
6
|
|
|
8
7
|
const mockStore = configureStore();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
beforeAll(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
const { __setLoadables } = await import(
|
|
12
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
13
|
+
);
|
|
14
|
+
await __setLoadables();
|
|
15
|
+
});
|
|
15
16
|
|
|
16
|
-
describe('
|
|
17
|
+
describe('DateRangeFacet', () => {
|
|
17
18
|
it('renders a facet component with a date range widget', async () => {
|
|
18
19
|
const store = mockStore({
|
|
19
20
|
userSession: { token: null },
|
|
@@ -2,16 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import { waitFor, render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
5
|
import SelectFacet from './SelectFacet';
|
|
7
6
|
|
|
8
7
|
const mockStore = configureStore();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
beforeAll(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
const { __setLoadables } = await import(
|
|
12
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
13
|
+
);
|
|
14
|
+
await __setLoadables();
|
|
15
|
+
});
|
|
15
16
|
|
|
16
17
|
describe('SelectFacet', () => {
|
|
17
18
|
it('renders a facet component with select dropdown', async () => {
|
|
@@ -8,6 +8,12 @@ const mockStore = configureStore();
|
|
|
8
8
|
|
|
9
9
|
const data = { '@type': 'toc', variation: 'default' };
|
|
10
10
|
|
|
11
|
+
const properties = {
|
|
12
|
+
title: 'Table of Contents',
|
|
13
|
+
hide_title: false,
|
|
14
|
+
ordered: true,
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
const tocEntries = [
|
|
12
18
|
{
|
|
13
19
|
level: 2,
|
|
@@ -35,7 +41,11 @@ test('renders a default toc renderer component', () => {
|
|
|
35
41
|
const component = renderer.create(
|
|
36
42
|
<Provider store={store}>
|
|
37
43
|
<MemoryRouter>
|
|
38
|
-
<DefaultTocRenderer
|
|
44
|
+
<DefaultTocRenderer
|
|
45
|
+
properties={properties}
|
|
46
|
+
data={data}
|
|
47
|
+
tocEntries={tocEntries}
|
|
48
|
+
/>
|
|
39
49
|
</MemoryRouter>
|
|
40
50
|
</Provider>,
|
|
41
51
|
);
|
|
@@ -8,20 +8,24 @@ import { __test__ as Contents } from './Contents';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
beforeAll(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
11
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
12
|
+
beforeAll(async () => {
|
|
13
|
+
const { __setLoadables } = await import(
|
|
14
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
15
|
+
);
|
|
16
|
+
await __setLoadables();
|
|
17
|
+
});
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
vi.mock('../Toolbar/Toolbar', () => ({
|
|
20
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
21
|
+
}));
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
23
|
+
vi.mock('../../theme/Pagination/Pagination', () => ({
|
|
24
|
+
default: vi.fn(() => <div className="Pagination" />),
|
|
25
|
+
}));
|
|
26
|
+
vi.mock('./ContentsUploadModal', () => ({
|
|
27
|
+
default: vi.fn(() => <div className="UploadModal" />),
|
|
28
|
+
}));
|
|
25
29
|
|
|
26
30
|
describe('Contents', () => {
|
|
27
31
|
it('renders a folder contents view component', () => {
|
|
@@ -87,7 +91,14 @@ describe('Contents', () => {
|
|
|
87
91
|
},
|
|
88
92
|
intl: {
|
|
89
93
|
locale: 'en',
|
|
90
|
-
messages: {
|
|
94
|
+
messages: {
|
|
95
|
+
ID: 'ID',
|
|
96
|
+
Title: 'Title',
|
|
97
|
+
'Publication date': 'Publication date',
|
|
98
|
+
'Created on': 'Created on',
|
|
99
|
+
'Last modified': 'Last modified',
|
|
100
|
+
Type: 'Type',
|
|
101
|
+
},
|
|
91
102
|
},
|
|
92
103
|
});
|
|
93
104
|
const { container } = render(
|
|
@@ -7,7 +7,7 @@ import ContentsPropertiesModal from './ContentsPropertiesModal';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
11
11
|
|
|
12
12
|
describe('ContentsPropertiesModal', () => {
|
|
13
13
|
it('renders a contents properties modal component', () => {
|
|
@@ -7,7 +7,7 @@ import ContentsRenameModal from './ContentsRenameModal';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
11
11
|
|
|
12
12
|
describe('ContentsRenameModal', () => {
|
|
13
13
|
it('renders a contents rename modal component', () => {
|
|
@@ -7,7 +7,7 @@ import ContentsTagsModal from './ContentsTagsModal';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
11
11
|
|
|
12
12
|
describe('ContentsTagsModal', () => {
|
|
13
13
|
it('renders a contents tags modal component', () => {
|
|
@@ -7,7 +7,7 @@ import ContentsWorkflowModal from './ContentsWorkflowModal';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
11
11
|
|
|
12
12
|
describe('ContentsWorkflowModal', () => {
|
|
13
13
|
it('renders a contents workflow modal component', () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
export const Contents = vi.fn(() => <div className="Contents" />);
|
|
2
3
|
|
|
3
|
-
export const ContentsRenameModal =
|
|
4
|
+
export const ContentsRenameModal = vi.fn(() => (
|
|
4
5
|
<div className="ContentsRenameModal" />
|
|
5
6
|
));
|
|
@@ -7,7 +7,9 @@ import AddonsControlpanel from './AddonsControlpanel';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
vi.mock('../../Toolbar/Toolbar', () => ({
|
|
11
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
12
|
+
}));
|
|
11
13
|
|
|
12
14
|
describe('AddonsControlpanel', () => {
|
|
13
15
|
it('renders an addon control component', () => {
|
|
@@ -54,11 +56,34 @@ describe('AddonsControlpanel', () => {
|
|
|
54
56
|
locale: 'en',
|
|
55
57
|
messages: {},
|
|
56
58
|
},
|
|
59
|
+
actions: {
|
|
60
|
+
actions: {},
|
|
61
|
+
},
|
|
62
|
+
userSession: {
|
|
63
|
+
token: null,
|
|
64
|
+
},
|
|
65
|
+
content: {
|
|
66
|
+
data: {},
|
|
67
|
+
get: {
|
|
68
|
+
loading: false,
|
|
69
|
+
loaded: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
types: {
|
|
73
|
+
types: [],
|
|
74
|
+
get: {
|
|
75
|
+
loading: false,
|
|
76
|
+
loaded: true,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
57
79
|
});
|
|
80
|
+
store.dispatch = vi.fn(() => Promise.resolve());
|
|
58
81
|
const { container } = render(
|
|
59
82
|
<Provider store={store}>
|
|
60
|
-
<
|
|
61
|
-
|
|
83
|
+
<div>
|
|
84
|
+
<AddonsControlpanel location={{ pathname: '/blog' }} />
|
|
85
|
+
<div id="toolbar"></div>
|
|
86
|
+
</div>
|
|
62
87
|
</Provider>,
|
|
63
88
|
);
|
|
64
89
|
|
|
@@ -10,8 +10,10 @@ import { MemoryRouter } from 'react-router';
|
|
|
10
10
|
const middlewares = [thunk];
|
|
11
11
|
const mockStore = configureMockStore(middlewares);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
vi.mock('@plone/volto/components/manage/Widgets');
|
|
14
|
+
vi.mock('../../Toolbar/Toolbar', () => ({
|
|
15
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
16
|
+
}));
|
|
15
17
|
|
|
16
18
|
describe('Aliases', () => {
|
|
17
19
|
it('renders an aliases control component', () => {
|
|
@@ -55,7 +57,11 @@ describe('Aliases', () => {
|
|
|
55
57
|
},
|
|
56
58
|
intl: {
|
|
57
59
|
locale: 'en',
|
|
58
|
-
messages: {
|
|
60
|
+
messages: {
|
|
61
|
+
Both: 'Both',
|
|
62
|
+
Automatically: 'Automatically',
|
|
63
|
+
Manually: 'Manually',
|
|
64
|
+
},
|
|
59
65
|
},
|
|
60
66
|
site: {
|
|
61
67
|
data: {
|
|
@@ -64,7 +70,28 @@ describe('Aliases', () => {
|
|
|
64
70
|
},
|
|
65
71
|
},
|
|
66
72
|
},
|
|
73
|
+
actions: {
|
|
74
|
+
actions: {},
|
|
75
|
+
},
|
|
76
|
+
userSession: {
|
|
77
|
+
token: null,
|
|
78
|
+
},
|
|
79
|
+
content: {
|
|
80
|
+
data: {},
|
|
81
|
+
get: {
|
|
82
|
+
loading: false,
|
|
83
|
+
loaded: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
types: {
|
|
87
|
+
types: [],
|
|
88
|
+
get: {
|
|
89
|
+
loading: false,
|
|
90
|
+
loaded: true,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
67
93
|
});
|
|
94
|
+
store.dispatch = vi.fn(() => Promise.resolve());
|
|
68
95
|
const { container } = render(
|
|
69
96
|
<Provider store={store}>
|
|
70
97
|
<MemoryRouter>
|
|
@@ -8,8 +8,10 @@ import ContentType from './ContentType';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
12
|
+
vi.mock('../../Toolbar/Toolbar', () => ({
|
|
13
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
14
|
+
}));
|
|
13
15
|
|
|
14
16
|
describe('ContentType', () => {
|
|
15
17
|
it('renders dexterity content-type component', () => {
|
|
@@ -32,8 +34,28 @@ describe('ContentType', () => {
|
|
|
32
34
|
locale: 'en',
|
|
33
35
|
messages: {},
|
|
34
36
|
},
|
|
37
|
+
actions: {
|
|
38
|
+
actions: {},
|
|
39
|
+
},
|
|
40
|
+
userSession: {
|
|
41
|
+
token: null,
|
|
42
|
+
},
|
|
43
|
+
content: {
|
|
44
|
+
data: {},
|
|
45
|
+
get: {
|
|
46
|
+
loading: false,
|
|
47
|
+
loaded: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
types: {
|
|
51
|
+
types: [],
|
|
52
|
+
get: {
|
|
53
|
+
loading: false,
|
|
54
|
+
loaded: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
35
57
|
});
|
|
36
|
-
|
|
58
|
+
store.dispatch = vi.fn(() => Promise.resolve());
|
|
37
59
|
const { container } = render(
|
|
38
60
|
<Provider store={store}>
|
|
39
61
|
<MemoryRouter
|
|
@@ -8,9 +8,11 @@ import ContentTypeLayout from './ContentTypeLayout';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
vi.mock('../../Toolbar/Toolbar', () => ({
|
|
12
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
13
|
+
}));
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
vi.mock('../Form/Form', () => ({ default: vi.fn(() => <div id="form" />) }));
|
|
14
16
|
|
|
15
17
|
describe('ContentTypeLayout', () => {
|
|
16
18
|
it('renders dexterity content-type layout component', () => {
|