@plone/volto 18.14.0 → 18.15.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/CHANGELOG.md +16 -1
- package/package.json +4 -4
- package/src/components/manage/Actions/Actions.test.jsx +5 -1
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +6 -2
- package/src/components/manage/Blocks/Block/Settings.test.jsx +5 -1
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +6 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +5 -1
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +5 -0
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +5 -1
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +6 -1
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +6 -1
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +5 -1
- package/src/components/manage/Contents/Contents.test.jsx +6 -1
- 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 +18 -2
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +5 -0
- package/src/components/manage/Controlpanels/Aliases.test.jsx +6 -1
- package/src/components/manage/Controlpanels/ContentType.test.jsx +5 -1
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +6 -1
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +5 -1
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +5 -1
- package/src/components/manage/Diff/Diff.test.jsx +6 -1
- package/src/components/manage/Diff/DiffField.test.jsx +6 -1
- package/src/components/manage/Display/Display.test.jsx +11 -2
- package/src/components/manage/Edit/Edit.test.jsx +5 -1
- 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 +27 -9
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +73 -0
- package/src/components/manage/MaybeWrap/MaybeWrap.tsx +15 -0
- package/src/components/manage/Preferences/ChangePassword.test.jsx +6 -1
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +11 -2
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +5 -1
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +5 -1
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +10 -2
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +5 -1
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +6 -1
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +6 -1
- package/src/components/manage/Widgets/SelectWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/TimeWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/TokenWidget.test.jsx +6 -1
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +10 -2
- package/src/components/manage/Widgets/__mocks__/index.tsx +51 -33
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +41 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +11 -2
- package/src/components/theme/Comments/CommentEditModal.test.jsx +5 -1
- package/src/components/theme/Comments/Comments.test.jsx +10 -2
- package/src/components/theme/ContactForm/ContactForm.test.jsx +5 -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/View/EventDatesInfo.test.jsx +6 -1
- package/src/components/theme/View/EventView.test.jsx +6 -1
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +22 -7
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +39 -0
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +2 -1
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Contents/__mocks__/index.vitest.d.ts +2 -0
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- 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/Widgets/__mocks__/index.d.ts +33 -33
- package/types/components/manage/Widgets/__mocks__/index.vitest.d.ts +33 -0
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/helpers/Loadable/__mocks__/Loadable.vitest.d.ts +3 -0
- package/src/components/manage/MaybeWrap/MaybeWrap.jsx +0 -9
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/* TODO: When the Volto Team removes Jest configuration support from Volto core, update this file with the Vitest version of the mock.
|
|
2
|
+
Then, in the tests, we need to replace:
|
|
3
|
+
|
|
4
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
5
|
+
return await import(
|
|
6
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
7
|
+
);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
with the following:
|
|
11
|
+
|
|
12
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
13
|
+
|
|
14
|
+
Finally, remove this comment.
|
|
15
|
+
*/
|
|
16
|
+
|
|
2
17
|
import config from '@plone/volto/registry';
|
|
3
18
|
const loadables = config.settings.loadables;
|
|
4
19
|
|
|
@@ -18,21 +33,21 @@ export const __setLoadables = async () => {
|
|
|
18
33
|
};
|
|
19
34
|
|
|
20
35
|
// TODO: filter mockAllLoadables
|
|
21
|
-
export const injectLazyLibs =
|
|
36
|
+
export const injectLazyLibs = jest.fn().mockImplementation(function ([
|
|
22
37
|
libraries,
|
|
23
38
|
]) {
|
|
24
|
-
return
|
|
25
|
-
|
|
39
|
+
return jest.fn((WrappedComponent) =>
|
|
40
|
+
jest.fn((props) => {
|
|
26
41
|
return <WrappedComponent {...props} {...mockAllLoadables} />;
|
|
27
42
|
}),
|
|
28
43
|
);
|
|
29
44
|
});
|
|
30
45
|
|
|
31
|
-
export const preloadLazyLibs =
|
|
46
|
+
export const preloadLazyLibs = jest.fn().mockImplementation(function ([
|
|
32
47
|
libraries,
|
|
33
48
|
]) {
|
|
34
|
-
return
|
|
35
|
-
|
|
49
|
+
return jest.fn((WrappedComponent) =>
|
|
50
|
+
jest.fn((props) => {
|
|
36
51
|
return <WrappedComponent {...props} />;
|
|
37
52
|
}),
|
|
38
53
|
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import config from '@plone/volto/registry';
|
|
3
|
+
const loadables = config.settings.loadables;
|
|
4
|
+
|
|
5
|
+
let mockAllLoadables = Object.create(null);
|
|
6
|
+
|
|
7
|
+
export const __setLoadables = async () => {
|
|
8
|
+
if (Object.keys(mockAllLoadables).length > 0) return;
|
|
9
|
+
const resolved = await Promise.all(
|
|
10
|
+
Object.keys(loadables).map(async (n) => {
|
|
11
|
+
const lib = await Promise.resolve(loadables[n].load());
|
|
12
|
+
return [n, { current: lib }];
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
resolved.forEach(([name, { current }]) => {
|
|
16
|
+
mockAllLoadables[name] = current;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// TODO: filter mockAllLoadables
|
|
21
|
+
export const injectLazyLibs = vi.fn().mockImplementation(function ([
|
|
22
|
+
libraries,
|
|
23
|
+
]) {
|
|
24
|
+
return vi.fn((WrappedComponent) =>
|
|
25
|
+
vi.fn((props) => {
|
|
26
|
+
return <WrappedComponent {...props} {...mockAllLoadables} />;
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const preloadLazyLibs = vi.fn().mockImplementation(function ([
|
|
32
|
+
libraries,
|
|
33
|
+
]) {
|
|
34
|
+
return vi.fn((WrappedComponent) =>
|
|
35
|
+
vi.fn((props) => {
|
|
36
|
+
return <WrappedComponent {...props} />;
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const Contents: any
|
|
2
|
-
export declare const ContentsRenameModal: any
|
|
1
|
+
export declare const Contents: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
2
|
+
export declare const ContentsRenameModal: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const Field: any
|
|
2
|
-
export declare const InlineForm: any
|
|
3
|
-
export declare const ModalForm: any
|
|
4
|
-
export declare const UndoToolbar: any
|
|
5
|
-
export declare const BlocksToolbar: any
|
|
6
|
-
export declare const BlockDataForm: any
|
|
7
|
-
export declare const BlocksForm: any
|
|
8
|
-
export declare const Form: any
|
|
1
|
+
export declare const Field: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
2
|
+
export declare const InlineForm: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
3
|
+
export declare const ModalForm: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
4
|
+
export declare const UndoToolbar: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
5
|
+
export declare const BlocksToolbar: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
6
|
+
export declare const BlockDataForm: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
7
|
+
export declare const BlocksForm: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
8
|
+
export declare const Form: jest.Mock<import("react/jsx-runtime").JSX.Element, [props: any], any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Field: any;
|
|
2
|
+
export declare const InlineForm: any;
|
|
3
|
+
export declare const ModalForm: any;
|
|
4
|
+
export declare const UndoToolbar: any;
|
|
5
|
+
export declare const BlocksToolbar: any;
|
|
6
|
+
export declare const BlockDataForm: any;
|
|
7
|
+
export declare const BlocksForm: any;
|
|
8
|
+
export declare const Form: any;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
condition:
|
|
4
|
-
as
|
|
5
|
-
}
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
type MaybeWrapProps<T extends React.ElementType> = {
|
|
3
|
+
condition: boolean;
|
|
4
|
+
as: T;
|
|
5
|
+
} & ComponentPropsWithoutRef<React.ElementType extends T ? 'div' : T>;
|
|
6
|
+
declare function MaybeWrap<T extends React.ElementType = 'div'>(props: MaybeWrapProps<T>): any;
|
|
7
|
+
export default MaybeWrap;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export declare const AlignWidget: any
|
|
2
|
-
export declare const ButtonsWidget: any
|
|
3
|
-
export declare const ArrayWidget: any
|
|
4
|
-
export declare const CheckboxWidget: any
|
|
5
|
-
export declare const FileWidget: any
|
|
6
|
-
export declare const IdWidget: any
|
|
7
|
-
export declare const PasswordWidget: any
|
|
8
|
-
export declare const QueryWidget: any
|
|
9
|
-
export declare const QuerySortOnWidget: any
|
|
10
|
-
export declare const QuerystringWidget: any
|
|
11
|
-
export declare const SchemaWidget: any
|
|
12
|
-
export declare const SelectWidget: any
|
|
13
|
-
export declare const TextareaWidget: any
|
|
14
|
-
export declare const TextWidget: any
|
|
15
|
-
export declare const TokenWidget: any
|
|
16
|
-
export declare const WysiwygWidget: any
|
|
17
|
-
export declare const UrlWidget: any
|
|
18
|
-
export declare const InternalUrlWidget: any
|
|
19
|
-
export declare const EmailWidget: any
|
|
20
|
-
export declare const NumberWidget: any
|
|
21
|
-
export declare const ImageSizeWidget: any
|
|
22
|
-
export declare const RegistryImageWidget: any
|
|
23
|
-
export declare const ReferenceWidget: any
|
|
24
|
-
export declare const ObjectBrowserWidget: any
|
|
25
|
-
export declare const ObjectWidget: any
|
|
26
|
-
export declare const ObjectListWidget: any
|
|
27
|
-
export declare const VocabularyTermsWidget: any
|
|
28
|
-
export declare const SelectMetadataWidget: any
|
|
29
|
-
export declare const SelectAutoComplete: any
|
|
30
|
-
export declare const ColorPickerWidget: any
|
|
31
|
-
export declare const DatetimeWidget: any
|
|
32
|
-
export declare const RecurrenceWidget: any
|
|
33
|
-
export declare const FormFieldWrapper: any
|
|
1
|
+
export declare const AlignWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
2
|
+
export declare const ButtonsWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
3
|
+
export declare const ArrayWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
4
|
+
export declare const CheckboxWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
5
|
+
export declare const FileWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
6
|
+
export declare const IdWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
7
|
+
export declare const PasswordWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
8
|
+
export declare const QueryWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
9
|
+
export declare const QuerySortOnWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
10
|
+
export declare const QuerystringWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
11
|
+
export declare const SchemaWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
12
|
+
export declare const SelectWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
13
|
+
export declare const TextareaWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
14
|
+
export declare const TextWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
15
|
+
export declare const TokenWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
16
|
+
export declare const WysiwygWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
17
|
+
export declare const UrlWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
18
|
+
export declare const InternalUrlWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
19
|
+
export declare const EmailWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
20
|
+
export declare const NumberWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
21
|
+
export declare const ImageSizeWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
22
|
+
export declare const RegistryImageWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
23
|
+
export declare const ReferenceWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
24
|
+
export declare const ObjectBrowserWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
25
|
+
export declare const ObjectWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
26
|
+
export declare const ObjectListWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
27
|
+
export declare const VocabularyTermsWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
28
|
+
export declare const SelectMetadataWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
29
|
+
export declare const SelectAutoComplete: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
30
|
+
export declare const ColorPickerWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
31
|
+
export declare const DatetimeWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
32
|
+
export declare const RecurrenceWidget: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
33
|
+
export declare const FormFieldWrapper: jest.Mock<import("react/jsx-runtime").JSX.Element, [], any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const AlignWidget: any;
|
|
2
|
+
export declare const ButtonsWidget: any;
|
|
3
|
+
export declare const ArrayWidget: any;
|
|
4
|
+
export declare const CheckboxWidget: any;
|
|
5
|
+
export declare const FileWidget: any;
|
|
6
|
+
export declare const IdWidget: any;
|
|
7
|
+
export declare const PasswordWidget: any;
|
|
8
|
+
export declare const QueryWidget: any;
|
|
9
|
+
export declare const QuerySortOnWidget: any;
|
|
10
|
+
export declare const QuerystringWidget: any;
|
|
11
|
+
export declare const SchemaWidget: any;
|
|
12
|
+
export declare const SelectWidget: any;
|
|
13
|
+
export declare const TextareaWidget: any;
|
|
14
|
+
export declare const TextWidget: any;
|
|
15
|
+
export declare const TokenWidget: any;
|
|
16
|
+
export declare const WysiwygWidget: any;
|
|
17
|
+
export declare const UrlWidget: any;
|
|
18
|
+
export declare const InternalUrlWidget: any;
|
|
19
|
+
export declare const EmailWidget: any;
|
|
20
|
+
export declare const NumberWidget: any;
|
|
21
|
+
export declare const ImageSizeWidget: any;
|
|
22
|
+
export declare const RegistryImageWidget: any;
|
|
23
|
+
export declare const ReferenceWidget: any;
|
|
24
|
+
export declare const ObjectBrowserWidget: any;
|
|
25
|
+
export declare const ObjectWidget: any;
|
|
26
|
+
export declare const ObjectListWidget: any;
|
|
27
|
+
export declare const VocabularyTermsWidget: any;
|
|
28
|
+
export declare const SelectMetadataWidget: any;
|
|
29
|
+
export declare const SelectAutoComplete: any;
|
|
30
|
+
export declare const ColorPickerWidget: any;
|
|
31
|
+
export declare const DatetimeWidget: any;
|
|
32
|
+
export declare const RecurrenceWidget: any;
|
|
33
|
+
export declare const FormFieldWrapper: any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export function __setLoadables(): Promise<void>;
|
|
2
|
-
export const injectLazyLibs: any
|
|
3
|
-
export const preloadLazyLibs: any
|
|
2
|
+
export const injectLazyLibs: jest.Mock<any, any, any>;
|
|
3
|
+
export const preloadLazyLibs: jest.Mock<any, any, any>;
|