@plone/volto 19.0.0-alpha.0 → 19.0.0-alpha.1
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 +46 -2
- package/package.json +14 -7
- 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/querystring/querystring.test.js +2 -2
- package/src/actions/types/types.test.js +1 -1
- package/src/components/manage/Actions/Actions.test.jsx +5 -1
- package/src/components/manage/Add/Add.jsx +22 -20
- 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 +1 -0
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +48 -16
- package/src/components/manage/Blocks/Block/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Block/Settings.test.jsx +5 -1
- package/src/components/manage/Blocks/Block/StyleWrapper.jsx +11 -3
- package/src/components/manage/Blocks/Description/View.test.jsx +1 -1
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +12 -5
- package/src/components/manage/Blocks/HTML/View.test.jsx +1 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +6 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +8 -1
- package/src/components/manage/Blocks/Listing/View.test.jsx +3 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +5 -1
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +13 -7
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +12 -6
- package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +11 -1
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +5 -1
- package/src/components/manage/ConditionalLink/ConditionalLink.test.tsx +109 -0
- package/src/components/manage/ConditionalLink/ConditionalLink.tsx +36 -0
- package/src/components/manage/Contents/Contents.test.jsx +29 -13
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +5 -1
- package/src/components/manage/Contents/__mocks__/index.tsx +16 -0
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +5 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +28 -3
- package/src/components/manage/Controlpanels/Aliases.test.jsx +35 -3
- package/src/components/manage/Controlpanels/ContentType.test.jsx +29 -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 +13 -4
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +9 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +12 -4
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +7 -3
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +33 -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 +15 -6
- package/src/components/manage/Diff/DiffField.test.jsx +12 -6
- package/src/components/manage/Display/Display.test.jsx +17 -6
- package/src/components/manage/Edit/Edit.test.jsx +11 -3
- package/src/components/manage/Form/BlockDataForm.test.jsx +5 -1
- package/src/components/manage/Form/Form.test.jsx +5 -1
- package/src/components/manage/Form/InlineForm.test.jsx +5 -1
- package/src/components/manage/Form/ModalForm.test.jsx +5 -1
- package/src/components/manage/Form/__mocks__/index.tsx +17 -0
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +73 -0
- package/src/components/manage/History/History.test.jsx +3 -1
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +6 -4
- package/src/components/manage/MaybeWrap/MaybeWrap.tsx +15 -0
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +3 -2
- package/src/components/manage/Preferences/ChangePassword.test.jsx +9 -2
- package/src/components/manage/Preferences/PersonalInformation.test.jsx +3 -1
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +20 -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 +196 -14
- package/src/components/manage/UniversalLink/UniversalLink.tsx +214 -0
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +22 -5
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +21 -6
- package/src/components/manage/Widgets/ImageWidget.jsx +5 -2
- package/src/components/manage/Widgets/NumberWidget.test.jsx +8 -7
- package/src/components/manage/Widgets/ObjectListWidget.jsx +11 -1
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +18 -8
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +5 -1
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +43 -41
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +12 -5
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +12 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/TimeWidget.test.jsx +13 -5
- package/src/components/manage/Widgets/TokenWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +18 -9
- package/src/components/manage/Widgets/__mocks__/index.tsx +16 -0
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +41 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +17 -7
- package/src/components/theme/App/App.test.jsx +21 -17
- package/src/components/theme/AppExtras/AppExtras.test.jsx +6 -6
- package/src/components/theme/Comments/CommentEditModal.test.jsx +5 -1
- package/src/components/theme/Comments/Comments.test.jsx +29 -12
- package/src/components/theme/ContactForm/ContactForm.test.jsx +8 -4
- package/src/components/theme/Header/Header.test.jsx +19 -13
- package/src/components/theme/Logout/Logout.test.jsx +1 -1
- package/src/components/theme/PasswordReset/PasswordReset.test.jsx +10 -1
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +5 -1
- package/src/components/theme/Register/Register.test.jsx +5 -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 +12 -5
- package/src/components/theme/View/EventView.test.jsx +12 -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 +11 -9
- package/src/helpers/Api/Api.test.js +11 -14
- package/src/helpers/AsyncConnect/AsyncConnect.test.jsx +145 -189
- package/src/helpers/AuthToken/AuthToken.test.js +60 -22
- 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 +16 -1
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +39 -0
- package/src/middleware/Api.test.js +47 -0
- package/src/middleware/api.js +1 -1
- package/src/middleware/storeProtectLoadUtils.test.js +90 -78
- package/test-setup-globals-vitest.js +46 -0
- package/tsconfig.declarations.json +12 -1
- package/tsconfig.json +2 -1
- package/types/components/manage/ConditionalLink/ConditionalLink.d.ts +11 -15
- package/types/components/manage/Contents/__mocks__/index.vitest.d.ts +2 -0
- package/types/components/manage/Form/__mocks__/index.vitest.d.ts +8 -0
- package/types/components/manage/MaybeWrap/MaybeWrap.d.ts +7 -5
- package/types/components/manage/UniversalLink/UniversalLink.d.ts +54 -20
- package/types/components/manage/Widgets/__mocks__/index.vitest.d.ts +33 -0
- package/types/helpers/Loadable/__mocks__/Loadable.vitest.d.ts +3 -0
- package/types/react-router-hash-link.d.ts +12 -0
- package/types/routes.d.ts +4 -0
- package/types/server.d.ts +1 -1
- package/vite-plugins/svg.mjs +81 -0
- package/vitest.config.mjs +77 -0
- package/src/components/manage/ConditionalLink/ConditionalLink.jsx +0 -27
- package/src/components/manage/ConditionalLink/ConditionalLink.test.jsx +0 -30
- package/src/components/manage/MaybeWrap/MaybeWrap.jsx +0 -9
- package/src/components/manage/UniversalLink/UniversalLink.jsx +0 -154
- package/src/components/manage/Widgets/FileWidget.test.jsx +0 -91
|
@@ -7,19 +7,25 @@ import Header from './Header';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
10
|
+
vi.mock('../Logo/Logo', () => ({
|
|
11
|
+
default: vi.fn(() => <div id="logo" />),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
vi.mock('../SearchWidget/SearchWidget', () => ({
|
|
15
|
+
default: vi.fn(() => <div id="searchwidget" />),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
vi.mock('../Anontools/Anontools', () => ({
|
|
19
|
+
default: vi.fn(() => <div id="anontools" />),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
vi.mock('../Navigation/Navigation', () => ({
|
|
23
|
+
default: vi.fn(() => <div id="navigation" />),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
vi.mock('../LanguageSelector/LanguageSelector', () => ({
|
|
27
|
+
default: vi.fn(() => <div id="language-selector" />),
|
|
28
|
+
}));
|
|
23
29
|
|
|
24
30
|
describe('Header', () => {
|
|
25
31
|
it('renders a header component', () => {
|
|
@@ -9,7 +9,7 @@ import Logout from './Logout';
|
|
|
9
9
|
|
|
10
10
|
const mockStore = configureStore();
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
vi.mock('../Login/Login', () => ({ default: vi.fn(() => <div />) }));
|
|
13
13
|
|
|
14
14
|
describe('Logout', () => {
|
|
15
15
|
it('renders a logout component', () => {
|
|
@@ -7,7 +7,16 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
7
7
|
import PasswordReset from './PasswordReset';
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
|
-
|
|
10
|
+
vi.mock('./PasswordReset', () => {
|
|
11
|
+
const ActualPasswordReset = vi.importActual('./PasswordReset');
|
|
12
|
+
return {
|
|
13
|
+
...ActualPasswordReset,
|
|
14
|
+
default: vi.fn((props) => {
|
|
15
|
+
const token = props.match?.params?.token || 'default-token';
|
|
16
|
+
return <div data-testid="password-reset">Password Reset for {token}</div>;
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
11
20
|
describe('PasswordReset', () => {
|
|
12
21
|
it('renders a PasswordReset component', () => {
|
|
13
22
|
const store = mockStore({
|
|
@@ -6,7 +6,11 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
6
6
|
|
|
7
7
|
import RequestPasswordReset from './RequestPasswordReset';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
10
14
|
|
|
11
15
|
const mockStore = configureStore();
|
|
12
16
|
|
|
@@ -6,7 +6,11 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
6
6
|
|
|
7
7
|
import Register from './Register';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
10
14
|
|
|
11
15
|
const mockStore = configureStore();
|
|
12
16
|
|
|
@@ -8,11 +8,13 @@ import { __test__ as Search } from './Search';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
11
|
+
vi.mock('../../manage/Toolbar/Toolbar', () => ({
|
|
12
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
13
|
+
}));
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
vi.mock('./SearchTags', () => ({
|
|
16
|
+
default: vi.fn(() => <div id="search-tags" />),
|
|
17
|
+
}));
|
|
16
18
|
|
|
17
19
|
describe('Search', () => {
|
|
18
20
|
it('renders an empty search component', () => {
|
|
@@ -5,11 +5,18 @@ import { When } from './EventDatesInfo';
|
|
|
5
5
|
import configureStore from 'redux-mock-store';
|
|
6
6
|
const mockStore = configureStore();
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
8
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
9
|
+
return await import(
|
|
10
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
const { __setLoadables } = await import(
|
|
16
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
17
|
+
);
|
|
18
|
+
await __setLoadables();
|
|
19
|
+
});
|
|
13
20
|
|
|
14
21
|
const store = mockStore({
|
|
15
22
|
intl: {
|
|
@@ -14,11 +14,18 @@ const store = mockStore({
|
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
17
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
18
|
+
return await import(
|
|
19
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
const { __setLoadables } = await import(
|
|
25
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
26
|
+
);
|
|
27
|
+
await __setLoadables();
|
|
28
|
+
});
|
|
22
29
|
|
|
23
30
|
const { settings } = config;
|
|
24
31
|
|
|
@@ -29,12 +29,14 @@ describe('ListingView', () => {
|
|
|
29
29
|
description: 'My item description',
|
|
30
30
|
url: '/item',
|
|
31
31
|
'@type': 'Document',
|
|
32
|
+
'@id': 'item1',
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
title: 'Second item',
|
|
35
36
|
description: 'My second item description',
|
|
36
37
|
url: '/item2',
|
|
37
38
|
'@type': 'Document',
|
|
39
|
+
'@id': 'item2',
|
|
38
40
|
},
|
|
39
41
|
],
|
|
40
42
|
}}
|
|
@@ -7,6 +7,16 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
7
7
|
import SummaryView from './SummaryView';
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
|
+
vi.mock('@plone/volto/components/manage/UniversalLink/UniversalLink', () => ({
|
|
11
|
+
default: vi.fn(({ item, ...props }) => {
|
|
12
|
+
// Ensure @id is always present
|
|
13
|
+
const safeItem = {
|
|
14
|
+
...item,
|
|
15
|
+
'@id': item['@id'] || item.url || '/default-link',
|
|
16
|
+
};
|
|
17
|
+
return <div data-testid="universal-link">{safeItem.title}</div>;
|
|
18
|
+
}),
|
|
19
|
+
}));
|
|
10
20
|
|
|
11
21
|
describe('TabularView', () => {
|
|
12
22
|
it('renders a summary view component', () => {
|
|
@@ -26,18 +26,25 @@ global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
|
|
|
26
26
|
|
|
27
27
|
const mockStore = configureStore();
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
29
|
+
vi.mock('../../manage/Toolbar/Toolbar', () => ({
|
|
30
|
+
default: vi.fn(() => <div id="Portal" />),
|
|
31
|
+
}));
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
vi.mock('../Comments/Comments', () => ({
|
|
34
|
+
default: vi.fn(() => <div id="Comments" />),
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
vi.mock('../Tags/Tags', () => ({
|
|
38
|
+
default: vi.fn(() => <div id="Tags" />),
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
vi.mock('../SlotRenderer/SlotRenderer', () => ({
|
|
42
|
+
default: vi.fn(() => <div id="SlotRenderer" />),
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
vi.mock('../ContentMetadataTags/ContentMetadataTags', () => ({
|
|
46
|
+
default: vi.fn(() => <div id="ContentMetadataTags" />),
|
|
47
|
+
}));
|
|
41
48
|
|
|
42
49
|
const actions = {
|
|
43
50
|
document_actions: [],
|
|
@@ -151,8 +158,10 @@ describe('View', () => {
|
|
|
151
158
|
});
|
|
152
159
|
const { container } = render(
|
|
153
160
|
<Provider store={store}>
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
<>
|
|
162
|
+
<View location={{ pathname: '/test' }} />
|
|
163
|
+
<div id="toolbar"></div>
|
|
164
|
+
</>
|
|
156
165
|
</Provider>,
|
|
157
166
|
);
|
|
158
167
|
|
|
@@ -172,8 +181,10 @@ describe('View', () => {
|
|
|
172
181
|
});
|
|
173
182
|
const { container } = render(
|
|
174
183
|
<Provider store={store}>
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
<>
|
|
185
|
+
<View location={{ pathname: '/test' }} />
|
|
186
|
+
<div id="toolbar"></div>
|
|
187
|
+
</>
|
|
177
188
|
</Provider>,
|
|
178
189
|
);
|
|
179
190
|
|
|
@@ -193,8 +204,10 @@ describe('View', () => {
|
|
|
193
204
|
});
|
|
194
205
|
const { container } = render(
|
|
195
206
|
<Provider store={store}>
|
|
196
|
-
|
|
197
|
-
|
|
207
|
+
<>
|
|
208
|
+
<View location={{ pathname: '/test' }} />
|
|
209
|
+
<div id="toolbar"></div>
|
|
210
|
+
</>
|
|
198
211
|
</Provider>,
|
|
199
212
|
);
|
|
200
213
|
|
|
@@ -214,8 +227,10 @@ describe('View', () => {
|
|
|
214
227
|
});
|
|
215
228
|
const { container } = render(
|
|
216
229
|
<Provider store={store}>
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
<>
|
|
231
|
+
<View location={{ pathname: '/test' }} />
|
|
232
|
+
<div id="toolbar"></div>
|
|
233
|
+
</>
|
|
219
234
|
</Provider>,
|
|
220
235
|
);
|
|
221
236
|
|
|
@@ -243,16 +258,20 @@ describe('View', () => {
|
|
|
243
258
|
});
|
|
244
259
|
const { rerender } = render(
|
|
245
260
|
<Provider store={store}>
|
|
246
|
-
|
|
247
|
-
|
|
261
|
+
<>
|
|
262
|
+
<View location={{ pathname: '/test' }} />
|
|
263
|
+
<div id="toolbar"></div>
|
|
264
|
+
</>
|
|
248
265
|
</Provider>,
|
|
249
266
|
);
|
|
250
267
|
expect(instanceCount).toBe(1);
|
|
251
268
|
store.getState().content.data['@id'] = '/b';
|
|
252
269
|
rerender(
|
|
253
270
|
<Provider store={store}>
|
|
254
|
-
|
|
255
|
-
|
|
271
|
+
<>
|
|
272
|
+
<View location={{ pathname: '/test' }} />
|
|
273
|
+
<div id="toolbar"></div>
|
|
274
|
+
</>
|
|
256
275
|
</Provider>,
|
|
257
276
|
);
|
|
258
277
|
expect(instanceCount).toBe(2);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import config from '@plone/volto/registry';
|
|
2
2
|
import Api from './Api';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
url
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
vi.mock('superagent', () => ({
|
|
5
|
+
default: {
|
|
6
|
+
get: vi.fn((url) => ({
|
|
7
|
+
url,
|
|
8
|
+
query: vi.fn(),
|
|
9
|
+
set: vi.fn(),
|
|
10
|
+
type: vi.fn(),
|
|
11
|
+
send: vi.fn(),
|
|
12
|
+
end: vi.fn(),
|
|
13
|
+
})),
|
|
14
|
+
},
|
|
13
15
|
}));
|
|
14
16
|
|
|
15
17
|
beforeAll(() => {
|
|
@@ -2,20 +2,17 @@
|
|
|
2
2
|
import config from '@plone/volto/registry';
|
|
3
3
|
import Api from './Api';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
send: jest.fn(),
|
|
17
|
-
end: jest.fn(),
|
|
18
|
-
})),
|
|
5
|
+
vi.mock('superagent', () => ({
|
|
6
|
+
default: {
|
|
7
|
+
get: vi.fn((url) => ({
|
|
8
|
+
url,
|
|
9
|
+
query: vi.fn(),
|
|
10
|
+
set: vi.fn(),
|
|
11
|
+
type: vi.fn(),
|
|
12
|
+
send: vi.fn(),
|
|
13
|
+
end: vi.fn(),
|
|
14
|
+
})),
|
|
15
|
+
},
|
|
19
16
|
}));
|
|
20
17
|
|
|
21
18
|
beforeAll(() => {
|