@plone/volto 19.0.0-alpha.13 → 19.0.0-alpha.14
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/.eslintrc +0 -1
- package/CHANGELOG.md +25 -0
- package/babel.js +1 -3
- package/global-test-setup.js +1 -2
- package/package.json +19 -79
- package/razzle.config.js +2 -2
- package/src/components/manage/Actions/Actions.test.jsx +1 -5
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +1 -5
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -5
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +1 -5
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -5
- package/src/components/manage/Contents/Contents.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -5
- package/src/components/manage/Contents/__mocks__/index.tsx +2 -18
- package/src/components/manage/Controlpanels/Aliases.test.jsx +1 -5
- package/src/components/manage/Controlpanels/ContentType.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +1 -5
- package/src/components/manage/Diff/Diff.test.jsx +1 -6
- package/src/components/manage/Diff/DiffField.test.jsx +1 -6
- package/src/components/manage/Display/Display.test.jsx +2 -11
- package/src/components/manage/Edit/Edit.test.jsx +1 -5
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -5
- package/src/components/manage/Form/Form.test.jsx +1 -5
- package/src/components/manage/Form/InlineForm.test.jsx +1 -5
- package/src/components/manage/Form/ModalForm.test.jsx +1 -5
- package/src/components/manage/Form/__mocks__/index.tsx +9 -27
- package/src/components/manage/Preferences/ChangePassword.test.jsx +1 -5
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -17
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +1 -11
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -5
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TokenWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +1 -11
- package/src/components/manage/Widgets/__mocks__/index.tsx +33 -51
- package/src/components/manage/Workflow/Workflow.test.jsx +2 -11
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -5
- package/src/components/theme/Comments/Comments.test.jsx +1 -11
- package/src/components/theme/ContactForm/ContactForm.test.jsx +1 -5
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -5
- package/src/components/theme/Register/Register.test.jsx +1 -5
- package/src/components/theme/View/EventDatesInfo.test.jsx +1 -6
- package/src/components/theme/View/EventView.test.jsx +1 -6
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -22
- package/test-addons-loader.js +3 -0
- package/test-setup-globals.js +30 -2
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +1 -1
- 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/vitest.config.mjs +4 -4
- package/webpack-plugins/webpack-scss-plugin.js +170 -0
- package/jest-addons-loader.js +0 -3
- package/jest-extender-plugin.js +0 -39
- package/jest-setup-afterenv.js +0 -2
- package/jest-svgsystem-transform.js +0 -10
- package/patches/patchit.sh +0 -2
- package/patches/razzle-jest.patch +0 -10
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +0 -5
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +0 -73
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +0 -41
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +0 -39
- package/test-setup-globals-vitest.js +0 -46
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import React from 'react';
|
|
17
2
|
import config from '@plone/volto/registry';
|
|
18
3
|
const loadables = config.settings.loadables;
|
|
19
4
|
|
|
@@ -33,21 +18,21 @@ export const __setLoadables = async () => {
|
|
|
33
18
|
};
|
|
34
19
|
|
|
35
20
|
// TODO: filter mockAllLoadables
|
|
36
|
-
export const injectLazyLibs =
|
|
21
|
+
export const injectLazyLibs = vi.fn().mockImplementation(function ([
|
|
37
22
|
libraries,
|
|
38
23
|
]) {
|
|
39
|
-
return
|
|
40
|
-
|
|
24
|
+
return vi.fn((WrappedComponent) =>
|
|
25
|
+
vi.fn((props) => {
|
|
41
26
|
return <WrappedComponent {...props} {...mockAllLoadables} />;
|
|
42
27
|
}),
|
|
43
28
|
);
|
|
44
29
|
});
|
|
45
30
|
|
|
46
|
-
export const preloadLazyLibs =
|
|
31
|
+
export const preloadLazyLibs = vi.fn().mockImplementation(function ([
|
|
47
32
|
libraries,
|
|
48
33
|
]) {
|
|
49
|
-
return
|
|
50
|
-
|
|
34
|
+
return vi.fn((WrappedComponent) =>
|
|
35
|
+
vi.fn((props) => {
|
|
51
36
|
return <WrappedComponent {...props} />;
|
|
52
37
|
}),
|
|
53
38
|
);
|
package/test-setup-globals.js
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
|
|
1
3
|
global.__CLIENT__ = true;
|
|
2
4
|
global.__DEVELOPMENT__ = false;
|
|
5
|
+
global.__SERVER__ = false;
|
|
6
|
+
global.__TEST__ = true;
|
|
3
7
|
|
|
4
8
|
window.matchMedia =
|
|
5
9
|
window.matchMedia ||
|
|
6
|
-
function () {
|
|
10
|
+
function (query) {
|
|
7
11
|
return {
|
|
8
|
-
matches:
|
|
12
|
+
matches: query === '(min-width: 1024px)',
|
|
9
13
|
addListener: function () {},
|
|
10
14
|
removeListener: function () {},
|
|
11
15
|
};
|
|
12
16
|
};
|
|
17
|
+
|
|
18
|
+
vi.stubGlobal(
|
|
19
|
+
'fetch',
|
|
20
|
+
vi.fn(() =>
|
|
21
|
+
Promise.resolve({
|
|
22
|
+
json: () => Promise.resolve({}),
|
|
23
|
+
text: () => Promise.resolve(''),
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
vi.stubGlobal('localStorage', {
|
|
29
|
+
getItem: vi.fn(),
|
|
30
|
+
setItem: vi.fn(),
|
|
31
|
+
removeItem: vi.fn(),
|
|
32
|
+
clear: vi.fn(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
vi.stubGlobal('sessionStorage', {
|
|
36
|
+
getItem: vi.fn(),
|
|
37
|
+
setItem: vi.fn(),
|
|
38
|
+
removeItem: vi.fn(),
|
|
39
|
+
clear: vi.fn(),
|
|
40
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const Contents:
|
|
2
|
-
export declare const ContentsRenameModal:
|
|
1
|
+
export declare const Contents: any;
|
|
2
|
+
export declare const ContentsRenameModal: any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const Field:
|
|
2
|
-
export declare const InlineForm:
|
|
3
|
-
export declare const ModalForm:
|
|
4
|
-
export declare const UndoToolbar:
|
|
5
|
-
export declare const BlocksToolbar:
|
|
6
|
-
export declare const BlockDataForm:
|
|
7
|
-
export declare const BlocksForm:
|
|
8
|
-
export declare const Form:
|
|
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,33 +1,33 @@
|
|
|
1
|
-
export declare const AlignWidget:
|
|
2
|
-
export declare const ButtonsWidget:
|
|
3
|
-
export declare const ArrayWidget:
|
|
4
|
-
export declare const CheckboxWidget:
|
|
5
|
-
export declare const FileWidget:
|
|
6
|
-
export declare const IdWidget:
|
|
7
|
-
export declare const PasswordWidget:
|
|
8
|
-
export declare const QueryWidget:
|
|
9
|
-
export declare const QuerySortOnWidget:
|
|
10
|
-
export declare const QuerystringWidget:
|
|
11
|
-
export declare const SchemaWidget:
|
|
12
|
-
export declare const SelectWidget:
|
|
13
|
-
export declare const TextareaWidget:
|
|
14
|
-
export declare const TextWidget:
|
|
15
|
-
export declare const TokenWidget:
|
|
16
|
-
export declare const WysiwygWidget:
|
|
17
|
-
export declare const UrlWidget:
|
|
18
|
-
export declare const InternalUrlWidget:
|
|
19
|
-
export declare const EmailWidget:
|
|
20
|
-
export declare const NumberWidget:
|
|
21
|
-
export declare const ImageSizeWidget:
|
|
22
|
-
export declare const RegistryImageWidget:
|
|
23
|
-
export declare const ReferenceWidget:
|
|
24
|
-
export declare const ObjectBrowserWidget:
|
|
25
|
-
export declare const ObjectWidget:
|
|
26
|
-
export declare const ObjectListWidget:
|
|
27
|
-
export declare const VocabularyTermsWidget:
|
|
28
|
-
export declare const SelectMetadataWidget:
|
|
29
|
-
export declare const SelectAutoComplete:
|
|
30
|
-
export declare const ColorPickerWidget:
|
|
31
|
-
export declare const DatetimeWidget:
|
|
32
|
-
export declare const RecurrenceWidget:
|
|
33
|
-
export declare const FormFieldWrapper:
|
|
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:
|
|
3
|
-
export const preloadLazyLibs:
|
|
2
|
+
export const injectLazyLibs: any;
|
|
3
|
+
export const preloadLazyLibs: any;
|
package/vitest.config.mjs
CHANGED
|
@@ -38,6 +38,7 @@ export default defineConfig({
|
|
|
38
38
|
'@plone/volto': path.resolve(__dirname, 'src'),
|
|
39
39
|
'@plone/volto-slate': path.resolve(__dirname, '../volto-slate/src'),
|
|
40
40
|
'@root': path.resolve(__dirname, 'src'),
|
|
41
|
+
'@plone/components': path.resolve(__dirname, '../components/src'),
|
|
41
42
|
'promise-file-reader': require.resolve('promise-file-reader'),
|
|
42
43
|
'react-dropzone': require.resolve('react-dropzone'),
|
|
43
44
|
'prop-types': require.resolve('prop-types'),
|
|
@@ -52,10 +53,10 @@ export default defineConfig({
|
|
|
52
53
|
globals: true,
|
|
53
54
|
environment: 'jsdom',
|
|
54
55
|
setupFiles: [
|
|
55
|
-
`${projectRoot}/test-setup-globals
|
|
56
|
+
`${projectRoot}/test-setup-globals.js`,
|
|
56
57
|
`${projectRoot}/test-setup-config.jsx`,
|
|
57
|
-
`${projectRoot}/
|
|
58
|
-
`${projectRoot}/
|
|
58
|
+
`${projectRoot}/test-addons-loader.js`,
|
|
59
|
+
`${projectRoot}/global-test-setup.js`
|
|
59
60
|
],
|
|
60
61
|
globalSetup: `${projectRoot}/global-test-setup.js`,
|
|
61
62
|
coverage: {
|
|
@@ -69,7 +70,6 @@ export default defineConfig({
|
|
|
69
70
|
'node_modules/**',
|
|
70
71
|
'**/dist/**',
|
|
71
72
|
'**/*.config.{js,ts}',
|
|
72
|
-
'**/jest-*.js',
|
|
73
73
|
],
|
|
74
74
|
},
|
|
75
75
|
css: true,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* Razzle SCSS Webpack Plugin `razzle-plugin-scss`
|
|
2
|
+
Forked from https://github.com/jaredpalmer/razzle/blob/master/packages/razzle-plugin-scss/index.js
|
|
3
|
+
version 4.2.18
|
|
4
|
+
See Volto's upgrade guide for more information:
|
|
5
|
+
https://6.docs.plone.org/volto/upgrade-guide/index.html
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const autoprefixer = require('autoprefixer');
|
|
9
|
+
const merge = require('deepmerge');
|
|
10
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
11
|
+
const paths = require('@plone/razzle/config/paths');
|
|
12
|
+
const postcssLoadConfig = require('postcss-load-config');
|
|
13
|
+
|
|
14
|
+
const hasPostCssConfig = () => {
|
|
15
|
+
try {
|
|
16
|
+
return !!postcssLoadConfig.sync();
|
|
17
|
+
} catch (_error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
modifyWebpackConfig(opts) {
|
|
24
|
+
const isServer = opts.env.target !== 'web';
|
|
25
|
+
const constantEnv = opts.env.dev ? 'dev' : 'prod';
|
|
26
|
+
|
|
27
|
+
const razzleOptions = opts.options.razzleOptions;
|
|
28
|
+
const config = Object.assign({}, opts.webpackConfig);
|
|
29
|
+
|
|
30
|
+
const defaultOptions = {
|
|
31
|
+
postcss: {
|
|
32
|
+
dev: {
|
|
33
|
+
sourceMap: true,
|
|
34
|
+
ident: 'postcss',
|
|
35
|
+
},
|
|
36
|
+
prod: {
|
|
37
|
+
sourceMap: razzleOptions.enableSourceMaps,
|
|
38
|
+
ident: 'postcss',
|
|
39
|
+
},
|
|
40
|
+
plugins: [
|
|
41
|
+
[
|
|
42
|
+
autoprefixer,
|
|
43
|
+
{
|
|
44
|
+
overrideBrowserslist: opts.options.razzleOptions.browserslist || [
|
|
45
|
+
'>1%',
|
|
46
|
+
'last 4 versions',
|
|
47
|
+
'Firefox ESR',
|
|
48
|
+
'not ie < 9',
|
|
49
|
+
],
|
|
50
|
+
flexbox: 'no-2009',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
sass: {
|
|
56
|
+
dev: {
|
|
57
|
+
sassOptions: {
|
|
58
|
+
sourceMap: true,
|
|
59
|
+
includePaths: [paths.appNodeModules],
|
|
60
|
+
outputStyle: 'expanded',
|
|
61
|
+
silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
|
|
62
|
+
quietDeps: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
prod: {
|
|
66
|
+
sassOptions: {
|
|
67
|
+
// XXX Source maps are required for the resolve-url-loader to properly
|
|
68
|
+
// function. Disable them in later stages if you do not want source maps.
|
|
69
|
+
sourceMap: true,
|
|
70
|
+
sourceMapContents: false,
|
|
71
|
+
includePaths: [paths.appNodeModules],
|
|
72
|
+
outputStyle: 'expanded',
|
|
73
|
+
silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
|
|
74
|
+
quietDeps: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
css: {
|
|
79
|
+
dev: {
|
|
80
|
+
sourceMap: true,
|
|
81
|
+
importLoaders: 1,
|
|
82
|
+
modules: {
|
|
83
|
+
auto: true,
|
|
84
|
+
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
prod: {
|
|
88
|
+
sourceMap: razzleOptions.enableSourceMaps,
|
|
89
|
+
importLoaders: 1,
|
|
90
|
+
modules: {
|
|
91
|
+
auto: true,
|
|
92
|
+
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
style: {},
|
|
97
|
+
resolveUrl: {
|
|
98
|
+
dev: {},
|
|
99
|
+
prod: {},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const options = Object.assign(
|
|
104
|
+
{},
|
|
105
|
+
defaultOptions,
|
|
106
|
+
opts.options.pluginOptions,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const styleLoader = {
|
|
110
|
+
loader: require.resolve('style-loader'),
|
|
111
|
+
options: options.style,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const cssLoader = {
|
|
115
|
+
loader: require.resolve('css-loader'),
|
|
116
|
+
options: options.css[constantEnv],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const resolveUrlLoader = {
|
|
120
|
+
loader: require.resolve('resolve-url-loader'),
|
|
121
|
+
options: options.resolveUrl[constantEnv],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const postCssLoader = {
|
|
125
|
+
loader: require.resolve('postcss-loader'),
|
|
126
|
+
options: hasPostCssConfig()
|
|
127
|
+
? undefined
|
|
128
|
+
: {
|
|
129
|
+
postcssOptions: Object.assign({}, options.postcss[constantEnv], {
|
|
130
|
+
plugins: options.postcss.plugins,
|
|
131
|
+
}),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const sassLoader = {
|
|
136
|
+
loader: require.resolve('sass-loader'),
|
|
137
|
+
options: options.sass[constantEnv],
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
config.module.rules = [
|
|
141
|
+
...config.module.rules,
|
|
142
|
+
{
|
|
143
|
+
test: /\.(sa|sc)ss$/,
|
|
144
|
+
use: isServer
|
|
145
|
+
? [
|
|
146
|
+
{
|
|
147
|
+
loader: require.resolve('css-loader'),
|
|
148
|
+
options: merge(options.css[constantEnv], {
|
|
149
|
+
modules: {
|
|
150
|
+
exportOnlyLocals: true,
|
|
151
|
+
},
|
|
152
|
+
}),
|
|
153
|
+
},
|
|
154
|
+
resolveUrlLoader,
|
|
155
|
+
postCssLoader,
|
|
156
|
+
sassLoader,
|
|
157
|
+
]
|
|
158
|
+
: [
|
|
159
|
+
opts.env.dev ? styleLoader : MiniCssExtractPlugin.loader,
|
|
160
|
+
cssLoader,
|
|
161
|
+
postCssLoader,
|
|
162
|
+
resolveUrlLoader,
|
|
163
|
+
sassLoader,
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
return config;
|
|
169
|
+
},
|
|
170
|
+
};
|
package/jest-addons-loader.js
DELETED
package/jest-extender-plugin.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Extends the Volto test configuration by injecting the keys in `jest.config.js`
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const projectRootPath = path.resolve('.');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
modifyJestConfig({
|
|
8
|
-
jestConfig: config,
|
|
9
|
-
webpackObject,
|
|
10
|
-
options: { razzleOptions, pluginOptions },
|
|
11
|
-
paths,
|
|
12
|
-
}) {
|
|
13
|
-
// If the RAZZLE_JEST_CONFIG env var exists,
|
|
14
|
-
// use it as the file with the Jest config overrides
|
|
15
|
-
if (process.env.RAZZLE_JEST_CONFIG) {
|
|
16
|
-
if (fs.existsSync(path.resolve(process.env.RAZZLE_JEST_CONFIG))) {
|
|
17
|
-
const jestConfigPath = path.resolve(process.env.RAZZLE_JEST_CONFIG);
|
|
18
|
-
const jestConfig = require(jestConfigPath);
|
|
19
|
-
config = { ...config, ...jestConfig };
|
|
20
|
-
return config;
|
|
21
|
-
}
|
|
22
|
-
if (
|
|
23
|
-
fs.existsSync(`${projectRootPath}/${process.env.RAZZLE_JEST_CONFIG}`)
|
|
24
|
-
) {
|
|
25
|
-
const jestConfig = require(
|
|
26
|
-
`${projectRootPath}/${process.env.RAZZLE_JEST_CONFIG}`,
|
|
27
|
-
);
|
|
28
|
-
config = { ...config, ...jestConfig };
|
|
29
|
-
}
|
|
30
|
-
// if not, use the sensible default, `jest.config.js`
|
|
31
|
-
} else {
|
|
32
|
-
if (fs.existsSync(`${projectRootPath}/jest.config.js`)) {
|
|
33
|
-
const jestConfig = require(`${projectRootPath}/jest.config.js`);
|
|
34
|
-
config = { ...config, ...jestConfig };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return config;
|
|
38
|
-
},
|
|
39
|
-
};
|
package/jest-setup-afterenv.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
process(src, filename) {
|
|
5
|
-
if (filename.includes('src/icons')) {
|
|
6
|
-
return `module.exports = { attributes: { xmlns: '', viewBox: ''}}`;
|
|
7
|
-
}
|
|
8
|
-
return `module.exports = ${JSON.stringify(path.basename(filename))}`;
|
|
9
|
-
},
|
|
10
|
-
};
|
package/patches/patchit.sh
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
--- /Users/sneridagh/Development/plone/volto/node_modules/razzle/config/createJestConfig.js 2020-11-07 16:11:14.489360747 +0100
|
|
2
|
-
+++ /Users/sneridagh/Development/plone/volto/node_modules/razzle/config/createJestConfigNew.js 2020-11-07 16:13:44.816817775 +0100
|
|
3
|
-
@@ -84,6 +84,7 @@
|
|
4
|
-
'mapCoverage',
|
|
5
|
-
'moduleDirectories',
|
|
6
|
-
'moduleFileExtensions',
|
|
7
|
-
+ 'modulePathIgnorePatterns',
|
|
8
|
-
'moduleNameMapper',
|
|
9
|
-
'modulePaths',
|
|
10
|
-
'snapshotSerializers',
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema } from '@plone/types';
|
|
2
|
-
import type { Ref } from 'react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
const cleanupSchema = (schema: JSONSchema | null): JSONSchema | null => {
|
|
6
|
-
if (!schema || !schema.properties) return schema;
|
|
7
|
-
return {
|
|
8
|
-
...schema,
|
|
9
|
-
properties: Object.entries(schema.properties).reduce<Record<string, any>>(
|
|
10
|
-
(acc, [key, value]) => {
|
|
11
|
-
acc[key] = {
|
|
12
|
-
...value,
|
|
13
|
-
description:
|
|
14
|
-
typeof value.description === 'string'
|
|
15
|
-
? value.description
|
|
16
|
-
: undefined,
|
|
17
|
-
};
|
|
18
|
-
return acc;
|
|
19
|
-
},
|
|
20
|
-
{},
|
|
21
|
-
),
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Field = vi.fn((props) => (
|
|
26
|
-
<div className="Field" id={props.id}>
|
|
27
|
-
{props.title}
|
|
28
|
-
</div>
|
|
29
|
-
));
|
|
30
|
-
|
|
31
|
-
export const InlineForm = vi.fn((props) => (
|
|
32
|
-
<div
|
|
33
|
-
id="InlineForm"
|
|
34
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
35
|
-
/>
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
export const ModalForm = vi.fn((props) => (
|
|
39
|
-
<div
|
|
40
|
-
id="ModalForm"
|
|
41
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
42
|
-
/>
|
|
43
|
-
));
|
|
44
|
-
|
|
45
|
-
export const UndoToolbar = vi.fn(() => <div id="UndoToolbar" />);
|
|
46
|
-
|
|
47
|
-
export const BlocksToolbar = vi.fn(() => <div id="BlocksToolbar" />);
|
|
48
|
-
|
|
49
|
-
export const BlockDataForm = vi.fn((props) => (
|
|
50
|
-
<div
|
|
51
|
-
id="BlockDataForm"
|
|
52
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
53
|
-
/>
|
|
54
|
-
));
|
|
55
|
-
|
|
56
|
-
export const BlocksForm = vi.fn((props) => (
|
|
57
|
-
<div
|
|
58
|
-
id="BlocksForm"
|
|
59
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
60
|
-
/>
|
|
61
|
-
));
|
|
62
|
-
|
|
63
|
-
const MockForm = forwardRef(
|
|
64
|
-
(props: { schema: JSONSchema | null }, ref: Ref<any>) => (
|
|
65
|
-
<div
|
|
66
|
-
id="Form"
|
|
67
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
68
|
-
ref={ref}
|
|
69
|
-
/>
|
|
70
|
-
),
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
export const Form = vi.fn((props) => <MockForm {...props} />);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const AlignWidget = vi.fn(() => <div id="AlignWidget" />);
|
|
2
|
-
export const ButtonsWidget = vi.fn(() => <div id="ButtonsWidget" />);
|
|
3
|
-
export const ArrayWidget = vi.fn(() => <div id="ArrayWidget" />);
|
|
4
|
-
export const CheckboxWidget = vi.fn(() => <div id="CheckboxWidget" />);
|
|
5
|
-
export const FileWidget = vi.fn(() => <div id="FileWidget" />);
|
|
6
|
-
export const IdWidget = vi.fn(() => <div id="IdWidget" />);
|
|
7
|
-
export const PasswordWidget = vi.fn(() => <div id="PasswordWidget" />);
|
|
8
|
-
export const QueryWidget = vi.fn(() => <div id="QueryWidget" />);
|
|
9
|
-
export const QuerySortOnWidget = vi.fn(() => <div id="QuerySortOnWidget" />);
|
|
10
|
-
export const QuerystringWidget = vi.fn(() => <div id="QuerystringWidget" />);
|
|
11
|
-
export const SchemaWidget = vi.fn(() => <div id="SchemaWidget" />);
|
|
12
|
-
export const SelectWidget = vi.fn(() => <div id="SelectWidget" />);
|
|
13
|
-
export const TextareaWidget = vi.fn(() => <div id="TextareaWidget" />);
|
|
14
|
-
export const TextWidget = vi.fn(() => <div id="TextWidget" />);
|
|
15
|
-
export const TokenWidget = vi.fn(() => <div id="TokenWidget" />);
|
|
16
|
-
export const WysiwygWidget = vi.fn(() => <div id="WysiwygWidget" />);
|
|
17
|
-
export const UrlWidget = vi.fn(() => <div id="UrlWidget" />);
|
|
18
|
-
export const InternalUrlWidget = vi.fn(() => <div id="InternalUrlWidget" />);
|
|
19
|
-
export const EmailWidget = vi.fn(() => <div id="EmailWidget" />);
|
|
20
|
-
export const NumberWidget = vi.fn(() => <div id="NumberWidget" />);
|
|
21
|
-
export const ImageSizeWidget = vi.fn(() => <div id="ImageSizeWidget" />);
|
|
22
|
-
export const RegistryImageWidget = vi.fn(() => (
|
|
23
|
-
<div id="RegistryImageWidget" />
|
|
24
|
-
));
|
|
25
|
-
export const ReferenceWidget = vi.fn(() => <div id="ReferenceWidget" />);
|
|
26
|
-
export const ObjectBrowserWidget = vi.fn(() => (
|
|
27
|
-
<div id="ObjectBrowserWidget" />
|
|
28
|
-
));
|
|
29
|
-
export const ObjectWidget = vi.fn(() => <div id="ObjectWidget" />);
|
|
30
|
-
export const ObjectListWidget = vi.fn(() => <div id="ObjectListWidget" />);
|
|
31
|
-
export const VocabularyTermsWidget = vi.fn(() => (
|
|
32
|
-
<div id="VocabularyTermsWidget" />
|
|
33
|
-
));
|
|
34
|
-
export const SelectMetadataWidget = vi.fn(() => (
|
|
35
|
-
<div id="SelectMetadataWidget" />
|
|
36
|
-
));
|
|
37
|
-
export const SelectAutoComplete = vi.fn(() => <div id="SelectAutoComplete" />);
|
|
38
|
-
export const ColorPickerWidget = vi.fn(() => <div id="ColorPickerWidget" />);
|
|
39
|
-
export const DatetimeWidget = vi.fn(() => <div id="DatetimeWidget" />);
|
|
40
|
-
export const RecurrenceWidget = vi.fn(() => <div id="RecurrenceWidget" />);
|
|
41
|
-
export const FormFieldWrapper = vi.fn(() => <div id="FormFieldWrapper" />);
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
});
|