@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.
Files changed (130) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc +2 -0
  3. package/CHANGELOG.md +27 -0
  4. package/cypress/support/commands.js +19 -2
  5. package/locales/eu.json +1 -1
  6. package/package.json +10 -4
  7. package/src/actions/actions/actions.test.js +3 -3
  8. package/src/actions/addons/addons.test.js +15 -12
  9. package/src/actions/aliases/aliases.test.js +1 -1
  10. package/src/actions/types/types.test.js +1 -1
  11. package/src/components/manage/Actions/Actions.test.jsx +1 -1
  12. package/src/components/manage/Add/Add.test.jsx +6 -3
  13. package/src/components/manage/Aliases/Aliases.test.jsx +7 -7
  14. package/src/components/manage/Blocks/Block/BlocksForm.jsx +3 -3
  15. package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +44 -16
  16. package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -1
  17. package/src/components/manage/Blocks/Description/View.test.jsx +1 -1
  18. package/src/components/manage/Blocks/HTML/Edit.test.jsx +7 -5
  19. package/src/components/manage/Blocks/HTML/View.test.jsx +1 -1
  20. package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +2 -2
  21. package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +3 -1
  22. package/src/components/manage/Blocks/Listing/View.test.jsx +3 -1
  23. package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -1
  24. package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +8 -7
  25. package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +7 -6
  26. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +11 -1
  27. package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -1
  28. package/src/components/manage/Contents/Contents.test.jsx +24 -13
  29. package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -1
  30. package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -1
  31. package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -1
  32. package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -1
  33. package/src/components/manage/Contents/__mocks__/index.tsx +3 -2
  34. package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +28 -3
  35. package/src/components/manage/Controlpanels/Aliases.test.jsx +30 -3
  36. package/src/components/manage/Controlpanels/ContentType.test.jsx +25 -3
  37. package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +4 -2
  38. package/src/components/manage/Controlpanels/ContentTypes.test.jsx +25 -2
  39. package/src/components/manage/Controlpanels/Controlpanel.test.jsx +37 -6
  40. package/src/components/manage/Controlpanels/Controlpanels.test.jsx +47 -3
  41. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +15 -9
  42. package/src/components/manage/Controlpanels/ModerateComments.test.jsx +31 -5
  43. package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +8 -4
  44. package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +9 -5
  45. package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +8 -4
  46. package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +7 -3
  47. package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +29 -4
  48. package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -1
  49. package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +15 -9
  50. package/src/components/manage/Delete/Delete.test.jsx +45 -4
  51. package/src/components/manage/Diff/Diff.test.jsx +12 -6
  52. package/src/components/manage/Diff/DiffField.test.jsx +7 -6
  53. package/src/components/manage/Display/Display.test.jsx +8 -6
  54. package/src/components/manage/Edit/Edit.test.jsx +7 -3
  55. package/src/components/manage/Form/BlockDataForm.test.jsx +1 -1
  56. package/src/components/manage/Form/Form.test.jsx +1 -1
  57. package/src/components/manage/Form/InlineForm.test.jsx +1 -1
  58. package/src/components/manage/Form/ModalForm.test.jsx +1 -1
  59. package/src/components/manage/Form/__mocks__/index.tsx +10 -10
  60. package/src/components/manage/History/History.test.jsx +3 -1
  61. package/src/components/manage/LinksToItem/LinksToItem.test.jsx +6 -4
  62. package/src/components/manage/Multilingual/ManageTranslations.test.jsx +3 -2
  63. package/src/components/manage/Preferences/ChangePassword.test.jsx +4 -2
  64. package/src/components/manage/Preferences/PersonalInformation.test.jsx +3 -1
  65. package/src/components/manage/Preferences/PersonalPreferences.test.jsx +11 -7
  66. package/src/components/manage/Rules/Rules.test.jsx +6 -3
  67. package/src/components/manage/Sharing/Sharing.test.jsx +3 -1
  68. package/src/components/manage/Sidebar/ObjectBrowserNav.test.jsx +3 -3
  69. package/src/components/manage/Toolbar/More.test.jsx +6 -7
  70. package/src/components/manage/UniversalLink/UniversalLink.test.jsx +1 -1
  71. package/src/components/manage/Widgets/ArrayWidget.test.jsx +18 -5
  72. package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +7 -5
  73. package/src/components/manage/Widgets/DatetimeWidget.test.jsx +17 -6
  74. package/src/components/manage/Widgets/FileWidget.jsx +3 -3
  75. package/src/components/manage/Widgets/FileWidget.test.jsx +54 -22
  76. package/src/components/manage/Widgets/NumberWidget.test.jsx +8 -7
  77. package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -2
  78. package/src/components/manage/Widgets/ObjectListWidget.test.jsx +10 -8
  79. package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -1
  80. package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +7 -5
  81. package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +7 -6
  82. package/src/components/manage/Widgets/RegistryImageWidget.jsx +3 -3
  83. package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +43 -41
  84. package/src/components/manage/Widgets/SchemaWidget.test.jsx +7 -5
  85. package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +7 -5
  86. package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +7 -6
  87. package/src/components/manage/Widgets/SelectWidget.test.jsx +7 -6
  88. package/src/components/manage/Widgets/TimeWidget.test.jsx +8 -5
  89. package/src/components/manage/Widgets/TokenWidget.test.jsx +7 -6
  90. package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +10 -9
  91. package/src/components/manage/Widgets/__mocks__/index.tsx +35 -35
  92. package/src/components/manage/Workflow/Workflow.test.jsx +8 -7
  93. package/src/components/theme/App/App.test.jsx +21 -17
  94. package/src/components/theme/AppExtras/AppExtras.test.jsx +8 -6
  95. package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -1
  96. package/src/components/theme/Comments/Comments.test.jsx +21 -12
  97. package/src/components/theme/ContactForm/ContactForm.test.jsx +4 -4
  98. package/src/components/theme/Header/Header.test.jsx +19 -13
  99. package/src/components/theme/Logo/Logo.jsx +2 -1
  100. package/src/components/theme/Logout/Logout.test.jsx +1 -1
  101. package/src/components/theme/Navigation/ContextNavigation.jsx +7 -2
  102. package/src/components/theme/PasswordReset/PasswordReset.test.jsx +10 -1
  103. package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -1
  104. package/src/components/theme/Register/Register.test.jsx +1 -1
  105. package/src/components/theme/Search/Search.test.jsx +6 -4
  106. package/src/components/theme/TsTest/TsTest.test.tsx +0 -1
  107. package/src/components/theme/View/EventDatesInfo.test.jsx +7 -5
  108. package/src/components/theme/View/EventView.test.jsx +7 -5
  109. package/src/components/theme/View/ListingView.test.jsx +2 -0
  110. package/src/components/theme/View/SummaryView.test.jsx +10 -0
  111. package/src/components/theme/View/TabularView.test.jsx +1 -0
  112. package/src/components/theme/View/View.test.jsx +42 -23
  113. package/src/helpers/Api/Api.plone.rest.test.js +12 -9
  114. package/src/helpers/Api/Api.test.js +12 -9
  115. package/src/helpers/AsyncConnect/AsyncConnect.test.jsx +145 -189
  116. package/src/helpers/AuthToken/AuthToken.test.js +61 -22
  117. package/src/helpers/Blocks/Blocks.js +1 -1
  118. package/src/helpers/Blocks/Blocks.test.js +1 -1
  119. package/src/helpers/Html/Html.test.jsx +32 -28
  120. package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -6
  121. package/src/middleware/storeProtectLoadUtils.test.js +90 -78
  122. package/test-setup-globals.js +36 -2
  123. package/tsconfig.json +23 -6
  124. package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
  125. package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
  126. package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
  127. package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
  128. package/types/server.d.ts +1 -1
  129. package/vite-plugins/svg.js +81 -0
  130. package/vitest.config.ts +61 -0
@@ -4,20 +4,22 @@ import { render } from '@testing-library/react';
4
4
  import configureStore from 'redux-mock-store';
5
5
  import ObjectListWidget from './ObjectListWidget';
6
6
 
7
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
8
- jest.mock('@plone/volto/components/manage/Form');
7
+ vi.mock('@plone/volto/helpers/Loadable/Loadable');
8
+ vi.mock('@plone/volto/components/manage/Form');
9
9
 
10
- beforeAll(
11
- async () =>
12
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
13
- );
10
+ beforeAll(async () => {
11
+ const { __setLoadables } = await import(
12
+ '@plone/volto/helpers/Loadable/Loadable'
13
+ );
14
+ await __setLoadables();
15
+ });
14
16
 
15
17
  let mockSerial = 0;
16
18
  const mockStore = configureStore();
17
19
 
18
- jest.mock('uuid', () => {
20
+ vi.mock('uuid', () => {
19
21
  return {
20
- v4: jest.fn().mockImplementation(() => `id-${mockSerial++}`),
22
+ v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`),
21
23
  };
22
24
  });
23
25
 
@@ -5,7 +5,7 @@ import { Provider } from 'react-intl-redux';
5
5
  import { render, fireEvent } from '@testing-library/react';
6
6
  import ObjectWidget from './ObjectWidget';
7
7
 
8
- jest.mock('@plone/volto/components/manage/Form');
8
+ vi.mock('@plone/volto/components/manage/Form');
9
9
 
10
10
  const mockStore = configureStore();
11
11
 
@@ -7,11 +7,13 @@ import RadioGroupWidget from './RadioGroupWidget';
7
7
 
8
8
  const mockStore = configureStore();
9
9
 
10
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
11
- beforeAll(
12
- async () =>
13
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
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 a radio group widget component', async () => {
17
19
  const store = mockStore({
@@ -3,14 +3,15 @@ import renderer from 'react-test-renderer';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import { waitFor } from '@testing-library/react';
6
-
7
6
  import RecurrenceWidget from './RecurrenceWidget';
8
7
 
9
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
10
- beforeAll(
11
- async () =>
12
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
13
- );
8
+ vi.mock('@plone/volto/helpers/Loadable/Loadable');
9
+ beforeAll(async () => {
10
+ const { __setLoadables } = await import(
11
+ '@plone/volto/helpers/Loadable/Loadable'
12
+ );
13
+ await __setLoadables();
14
+ });
14
15
 
15
16
  const mockStore = configureStore();
16
17
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React, { useState } from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { Button, Image, Dimmer } from 'semantic-ui-react';
8
+ import { Button, Dimmer } from 'semantic-ui-react';
9
9
  import { readAsDataURL } from 'promise-file-reader';
10
10
  import { injectIntl } from 'react-intl';
11
11
  import deleteSVG from '@plone/volto/icons/delete.svg';
@@ -15,6 +15,7 @@ import loadable from '@loadable/component';
15
15
  import { defineMessages, useIntl } from 'react-intl';
16
16
  import { toPublicURL } from '@plone/volto/helpers/Url/Url';
17
17
  import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
18
+ import Image from '@plone/volto/components/theme/Image/Image';
18
19
 
19
20
  const imageMimetypes = [
20
21
  'image/png',
@@ -119,9 +120,8 @@ const RegistryImageWidget = (props) => {
119
120
  {isDragActive && <Dimmer active></Dimmer>}
120
121
  {previewSrc ? (
121
122
  <Image
122
- className="image-preview"
123
+ className="image-preview small ui image"
123
124
  id={`field-${id}-image`}
124
- size="small"
125
125
  src={previewSrc}
126
126
  />
127
127
  ) : (
@@ -4,10 +4,9 @@ import { render, waitFor } from '@testing-library/react';
4
4
  import configureStore from 'redux-mock-store';
5
5
 
6
6
  import RegistryImageWidget from './RegistryImageWidget';
7
-
8
7
  import config from '@plone/volto/registry';
9
8
 
10
- jest.spyOn(global.Date, 'now').mockImplementation(() => '0');
9
+ vi.spyOn(global.Date, 'now').mockImplementation(() => 1234567890);
11
10
 
12
11
  const mockStore = configureStore();
13
12
 
@@ -15,14 +14,30 @@ beforeAll(() => {
15
14
  config.settings.publicURL = 'http://localhost:3000';
16
15
  });
17
16
 
17
+ const createStore = () =>
18
+ mockStore({
19
+ intl: {
20
+ locale: 'en',
21
+ messages: {},
22
+ },
23
+ });
24
+
18
25
  describe('RegistryImageWidget', () => {
19
- test('renders an empty file widget component', async () => {
20
- const store = mockStore({
21
- intl: {
22
- locale: 'en',
23
- messages: {},
26
+ beforeEach(() => {
27
+ vi.clearAllTimers();
28
+ Object.defineProperty(global.Image.prototype, 'complete', {
29
+ get() {
30
+ return true;
24
31
  },
25
32
  });
33
+ });
34
+
35
+ afterEach(() => {
36
+ vi.clearAllMocks();
37
+ });
38
+
39
+ test('renders an empty file widget component', async () => {
40
+ const store = createStore();
26
41
 
27
42
  const { container } = render(
28
43
  <Provider store={store}>
@@ -35,16 +50,18 @@ describe('RegistryImageWidget', () => {
35
50
  </Provider>,
36
51
  );
37
52
 
38
- await waitFor(() => {});
53
+ await waitFor(
54
+ () => {
55
+ expect(container.querySelector('.file-widget-dropzone')).toBeTruthy();
56
+ },
57
+ { timeout: 1000 },
58
+ );
59
+
39
60
  expect(container).toMatchSnapshot();
40
61
  });
62
+
41
63
  test('renders a file widget component with value', async () => {
42
- const store = mockStore({
43
- intl: {
44
- locale: 'en',
45
- messages: {},
46
- },
47
- });
64
+ const store = createStore();
48
65
 
49
66
  const { container } = render(
50
67
  <Provider store={store}>
@@ -54,38 +71,23 @@ describe('RegistryImageWidget', () => {
54
71
  fieldSet="default"
55
72
  onChange={() => {}}
56
73
  value={
57
- 'filenameb64:bG9nby5jYWI5NDVkOC5zdmc=;datab64:PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE1OC4yNTNweCIgaGVpZ2h0PSI0MC42ODZweCIgdmlld0JveD0iMCAwIDE1OC4yNTMgNDAuNjg2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNTguMjUzIDQwLjY4NiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CiAgICAgICAgICAgICAgICAgICAgPGc+PHBhdGggZmlsbD0iIzAwODZDMyIgZD0iTTY1LjMyNywyMy4yMDhoLTYuNTg5djExLjM4OGgtNC4zOTNWNS42MzhoMTAuOTgxYzUuNjUzLDAsOS4yNzEsMy43NDIsOS4yNzEsOC43ODUgICAgICAgICAgICAgICAgIFM3MC45NzksMjMuMjA4LDY1LjMyNywyMy4yMDh6IE02NS4wODIsOS41ODNoLTYuMzQ1djkuNjM5aDYuMzQ1YzMuMDUsMCw1LjEyNC0xLjc0OSw1LjEyNC00Ljc5OSAgICAgICAgICAgICAgICAgQzcwLjIwNiwxMS4zNzIsNjguMTMyLDkuNTgzLDY1LjA4Miw5LjU4M3oiLz48cGF0aCBmaWxsPSIjMDA4NkMzIiBkPSJNODMuOTY5LDM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AgICAgICAgICA8L3N2Zz4=}'
74
+ 'filenameb64:bG9nby5jYWI5NDVkOC5zdmc=;datab64:PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE1OC4yNTNweCIgaGVpZ2h0PSI0MC42ODZweCIgdmlld0JveD0iMCAwIDE1OC4yNTMgNDAuNjg2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNTguMjUzIDQwLjY4NiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CiAgICAgICAgICAgICAgICAgICAgPGc+PHBhdGggZmlsbD0iIzAwODZDMyIgZD0iTTY1LjMyNywyMy4yMDhoLTYuNTg5djExLjM4OGgtNC4zOTNWNS42MzhoMTAuOTgxYzUuNjUzLDAsOS4yNzEsMy43NDIsOS4yNzEsOC43ODUgICAgICAgICAgICAgICAgIFM3MC45NzksMjMuMjA4LDY1LjMyNywyMy4yMDh6IE02NS4wODIsOS41ODNoLTYuMzQ1djkuNjM5aDYuMzQ1YzMuMDUsMCw1LjEyNC0xLjc0OSw1LjEyNC00Ljc5OSAgICAgICAgICAgICAgICAgQzcwLjIwNiwxMS4zNzIsNjguMTMyLDkuNTgzLDY1LjA4Miw5LjU4M3oiLz48L3c+'
58
75
  }
59
76
  />
60
77
  </Provider>,
61
78
  );
62
79
 
63
- await waitFor(() => {});
80
+ await waitFor(
81
+ () => {
82
+ const dropzone = container.querySelector('.file-widget-dropzone');
83
+ const preview = container.querySelector('.image-preview');
84
+ const filename = container.querySelector('.field-file-name');
85
+
86
+ return dropzone && preview && filename;
87
+ },
88
+ { timeout: 1000 },
89
+ );
90
+
64
91
  expect(container).toMatchSnapshot();
65
92
  });
66
- // test('renders a file widget component with value in raw data', async () => {
67
- // const store = mockStore({
68
- // intl: {
69
- // locale: 'en',
70
- // messages: {},
71
- // },
72
- // });
73
-
74
- // const { container } = render(
75
- // <Provider store={store}>
76
- // <RegistryImageWidget
77
- // id="my-field"
78
- // title="My field"
79
- // fieldSet="default"
80
- // onChange={() => {}}
81
- // value={
82
- // 'filenameb64:bG9nby5jYWI5NDVkOC5zdmc=;datab64:PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE1OC4yNTNweCIgaGVpZ2h0PSI0MC42ODZweCIgdmlld0JveD0iMCAwIDE1OC4yNTMgNDAuNjg2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNTguMjUzIDQwLjY4NiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CiAgICAgICAgICAgICAgICAgICAgPGc+PHBhdGggZmlsbD0iIzAwODZDMyIgZD0iTTY1LjMyNywyMy4yMDhoLTYuNTg5djExLjM4OGgtNC4zOTNWNS42MzhoMTAuOTgxYzUuNjUzLDAsOS4yNzEsMy43NDIsOS4yNzEsOC43ODUgICAgICAgICAgICAgICAgIFM3MC45NzksMjMuMjA4LDY1LjMyNywyMy4yMDh6IE02NS4wODIsOS41ODNoLTYuMzQ1djkuNjM5aDYuMzQ1YzMuMDUsMCw1LjEyNC0xLjc0OSw1LjEyNC00Ljc5OSAgICAgICAgICAgICAgICAgQzcwLjIwNiwxMS4zNzIsNjguMTMyLDkuNTgzLDY1LjA4Miw5LjU4M3oiLz48cGF0aCBmaWxsPSIjMDA4NkMzIiBkPSJNODMuOTY5LDM0LjU5NmMtMy45MDQsMC01LjY1Mi0yLjY0NC01LjY1Mi01LjY5M1Y1LjYzOGg0LjE0OHYyMy4wMjFjMCwxLjU4NywwLjU2NywyLj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MSwzMS43NDd6Ii8+PC9nPjxnPjxwYXRoIGZpbGw9IiMwMDg2QzMiIGQ9Ik0xNTMuOTg1LDkuOTVjLTEuMTk1LDAtMi4xNjQsMC45NzEtMi4xNjQsMi4xNjhjMC4wMDIsMS4xOTcsMC45NjksMi4xNjgsMi4xNjQsMi4xNjggICAgICAgICAgICAgICAgICAgICBjMS4xOTksMCwyLjE3Mi0wLjk3MSwyLjE3Mi0yLjE2OFMxNTUuMTg0LDkuOTUsMTUzLjk4NSw5Ljk1eiBNMTUzLjk4NSwxMy45NjhjLTEuMDIxLTAuMDAyLTEuODQ2LTAuODI3LTEuODQ2LTEuODUgICAgICAgICAgICAgICAgICAgICBjMC4wMDItMS4wMjEsMC44MjUtMS44NDksMS44NDYtMS44NTFjMS4wMjMsMC4wMDIsMS44NTIsMC44MjgsMS44NTQsMS44NTFDMTU1LjgzNiwxMy4xNDEsMTU1LjAwOCwxMy45NjYsMTUzLjk4NSwxMy45Njh6Ii8+PC9nPjxnPjxwYXRoIGZpbGw9IiMwMDg2QzMiIGQ9Ik0xNTQuNTA3LDEzLjQwOWwtMC41NC0xLjA4aC0wLjQ4NnYxLjA4aC0wLjM4OXYtMi41NjRoMC45OTRjMC40ODQsMCwwLjc5NiwwLjMxMywwLjc5NiwwLjc1ICAgICAgICAgICAgICAgICAgICAgYzAsMC4zNjctMC4yMjQsMC42MDItMC41MTMsMC42OGwwLjU5MiwxLjEzNkwxNTQuNTA3LDEzLjQwOUwxNTQuNTA3LDEzLjQwOXogTTE1NC4wNTYsMTEuMTk1aC0wLjU3NXYwLjgwM2gwLjU3NSBjMC4yNjEsMCwwLjQzNy0wLjE0NywwLjQzNy0wLjM5OVMxNTQuMzE3LDExLjE5NSwxNTQuMDU2LDExLjE5NXoiLz48L2c+PC9nPgogICAgICAgICAgICAgICAgICA8L3N2Zz4=}'
83
- // }
84
- // />
85
- // </Provider>,
86
- // );
87
-
88
- // await waitFor(() => {});
89
- // expect(container).toMatchSnapshot();
90
- // });
91
93
  });
@@ -5,11 +5,13 @@ import { Provider } from 'react-intl-redux';
5
5
 
6
6
  import SchemaWidget from './SchemaWidget';
7
7
 
8
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
9
- beforeAll(
10
- async () =>
11
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
12
- );
8
+ vi.mock('@plone/volto/helpers/Loadable/Loadable');
9
+ beforeAll(async () => {
10
+ const { __setLoadables } = await import(
11
+ '@plone/volto/helpers/Loadable/Loadable'
12
+ );
13
+ await __setLoadables();
14
+ });
13
15
 
14
16
  const mockStore = configureStore();
15
17
 
@@ -3,11 +3,13 @@ import { DragDropContext, Droppable } from 'react-beautiful-dnd';
3
3
  import { render } from '@testing-library/react';
4
4
  import SchemaWidgetFieldsetComponent from './SchemaWidgetFieldset';
5
5
 
6
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
7
- beforeAll(
8
- async () =>
9
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
10
- );
6
+ vi.mock('@plone/volto/helpers/Loadable/Loadable');
7
+ beforeAll(async () => {
8
+ const { __setLoadables } = await import(
9
+ '@plone/volto/helpers/Loadable/Loadable'
10
+ );
11
+ await __setLoadables();
12
+ });
11
13
 
12
14
  test('renders a contents item component', () => {
13
15
  const { container } = render(
@@ -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 SelectAutoComplete from './SelectAutoComplete';
7
6
 
8
7
  const mockStore = configureStore();
9
8
 
10
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
11
- beforeAll(
12
- async () =>
13
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
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
  test('renders a select widget component', async () => {
17
18
  const store = mockStore({
@@ -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, fireEvent } from '@testing-library/react';
5
-
6
5
  import SelectWidget from './SelectWidget';
7
6
 
8
7
  const mockStore = configureStore();
9
8
 
10
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
11
- beforeAll(
12
- async () =>
13
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
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
  test('renders a select widget component', async () => {
17
18
  const store = mockStore({
@@ -6,11 +6,13 @@ import { waitFor, render, screen } from '@testing-library/react';
6
6
 
7
7
  const mockStore = configureStore();
8
8
 
9
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
10
- beforeAll(
11
- async () =>
12
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
13
- );
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
+ });
14
16
 
15
17
  test('renders a time widget component', async () => {
16
18
  const store = mockStore({
@@ -31,5 +33,6 @@ test('renders a time widget component', async () => {
31
33
  </Provider>,
32
34
  );
33
35
  await waitFor(() => screen.getByText(/My field/));
36
+ await waitFor(() => screen.getByPlaceholderText('Time'));
34
37
  expect(container).toMatchSnapshot();
35
38
  });
@@ -3,16 +3,17 @@ import renderer from 'react-test-renderer';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import { waitFor } from '@testing-library/react';
6
-
7
6
  import TokenWidget from './TokenWidget';
8
7
 
9
8
  const mockStore = configureStore();
10
9
 
11
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
12
- beforeAll(
13
- async () =>
14
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
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
  test('renders a token widget component', async () => {
18
19
  const store = mockStore({
@@ -2,23 +2,24 @@ import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
-
6
5
  import VocabularyTermsWidget from './VocabularyTermsWidget';
7
6
 
8
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
9
- jest.mock('@plone/volto/components/manage/Form');
7
+ vi.mock('@plone/volto/helpers/Loadable/Loadable');
8
+ vi.mock('@plone/volto/components/manage/Form');
10
9
 
11
- beforeAll(
12
- async () =>
13
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
14
- );
10
+ beforeAll(async () => {
11
+ const { __setLoadables } = await import(
12
+ '@plone/volto/helpers/Loadable/Loadable'
13
+ );
14
+ await __setLoadables();
15
+ });
15
16
 
16
17
  let mockSerial = 0;
17
18
  const mockStore = configureStore();
18
19
 
19
- jest.mock('uuid', () => {
20
+ vi.mock('uuid', () => {
20
21
  return {
21
- v4: jest.fn().mockImplementation(() => `id-${mockSerial++}`),
22
+ v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`),
22
23
  };
23
24
  });
24
25
 
@@ -1,43 +1,43 @@
1
- export const AlignWidget = jest.fn(() => <div id="AlignWidget" />);
2
- export const ButtonsWidget = jest.fn(() => <div id="ButtonsWidget" />);
3
- export const ArrayWidget = jest.fn(() => <div id="ArrayWidget" />);
4
- export const CheckboxWidget = jest.fn(() => <div id="CheckboxWidget" />);
5
- export const FileWidget = jest.fn(() => <div id="FileWidget" />);
6
- export const IdWidget = jest.fn(() => <div id="IdWidget" />);
7
- export const PasswordWidget = jest.fn(() => <div id="PasswordWidget" />);
8
- export const QueryWidget = jest.fn(() => <div id="QueryWidget" />);
9
- export const QuerySortOnWidget = jest.fn(() => <div id="QuerySortOnWidget" />);
10
- export const QuerystringWidget = jest.fn(() => <div id="QuerystringWidget" />);
11
- export const SchemaWidget = jest.fn(() => <div id="SchemaWidget" />);
12
- export const SelectWidget = jest.fn(() => <div id="SelectWidget" />);
13
- export const TextareaWidget = jest.fn(() => <div id="TextareaWidget" />);
14
- export const TextWidget = jest.fn(() => <div id="TextWidget" />);
15
- export const TokenWidget = jest.fn(() => <div id="TokenWidget" />);
16
- export const WysiwygWidget = jest.fn(() => <div id="WysiwygWidget" />);
17
- export const UrlWidget = jest.fn(() => <div id="UrlWidget" />);
18
- export const InternalUrlWidget = jest.fn(() => <div id="InternalUrlWidget" />);
19
- export const EmailWidget = jest.fn(() => <div id="EmailWidget" />);
20
- export const NumberWidget = jest.fn(() => <div id="NumberWidget" />);
21
- export const ImageSizeWidget = jest.fn(() => <div id="ImageSizeWidget" />);
22
- export const RegistryImageWidget = jest.fn(() => (
1
+ import { vi } from 'vitest';
2
+
3
+ export const AlignWidget = vi.fn(() => <div id="AlignWidget" />);
4
+ export const ButtonsWidget = vi.fn(() => <div id="ButtonsWidget" />);
5
+ export const ArrayWidget = vi.fn(() => <div id="ArrayWidget" />);
6
+ export const CheckboxWidget = vi.fn(() => <div id="CheckboxWidget" />);
7
+ export const FileWidget = vi.fn(() => <div id="FileWidget" />);
8
+ export const IdWidget = vi.fn(() => <div id="IdWidget" />);
9
+ export const PasswordWidget = vi.fn(() => <div id="PasswordWidget" />);
10
+ export const QueryWidget = vi.fn(() => <div id="QueryWidget" />);
11
+ export const QuerySortOnWidget = vi.fn(() => <div id="QuerySortOnWidget" />);
12
+ export const QuerystringWidget = vi.fn(() => <div id="QuerystringWidget" />);
13
+ export const SchemaWidget = vi.fn(() => <div id="SchemaWidget" />);
14
+ export const SelectWidget = vi.fn(() => <div id="SelectWidget" />);
15
+ export const TextareaWidget = vi.fn(() => <div id="TextareaWidget" />);
16
+ export const TextWidget = vi.fn(() => <div id="TextWidget" />);
17
+ export const TokenWidget = vi.fn(() => <div id="TokenWidget" />);
18
+ export const WysiwygWidget = vi.fn(() => <div id="WysiwygWidget" />);
19
+ export const UrlWidget = vi.fn(() => <div id="UrlWidget" />);
20
+ export const InternalUrlWidget = vi.fn(() => <div id="InternalUrlWidget" />);
21
+ export const EmailWidget = vi.fn(() => <div id="EmailWidget" />);
22
+ export const NumberWidget = vi.fn(() => <div id="NumberWidget" />);
23
+ export const ImageSizeWidget = vi.fn(() => <div id="ImageSizeWidget" />);
24
+ export const RegistryImageWidget = vi.fn(() => (
23
25
  <div id="RegistryImageWidget" />
24
26
  ));
25
- export const ReferenceWidget = jest.fn(() => <div id="ReferenceWidget" />);
26
- export const ObjectBrowserWidget = jest.fn(() => (
27
+ export const ReferenceWidget = vi.fn(() => <div id="ReferenceWidget" />);
28
+ export const ObjectBrowserWidget = vi.fn(() => (
27
29
  <div id="ObjectBrowserWidget" />
28
30
  ));
29
- export const ObjectWidget = jest.fn(() => <div id="ObjectWidget" />);
30
- export const ObjectListWidget = jest.fn(() => <div id="ObjectListWidget" />);
31
- export const VocabularyTermsWidget = jest.fn(() => (
31
+ export const ObjectWidget = vi.fn(() => <div id="ObjectWidget" />);
32
+ export const ObjectListWidget = vi.fn(() => <div id="ObjectListWidget" />);
33
+ export const VocabularyTermsWidget = vi.fn(() => (
32
34
  <div id="VocabularyTermsWidget" />
33
35
  ));
34
- export const SelectMetadataWidget = jest.fn(() => (
36
+ export const SelectMetadataWidget = vi.fn(() => (
35
37
  <div id="SelectMetadataWidget" />
36
38
  ));
37
- export const SelectAutoComplete = jest.fn(() => (
38
- <div id="SelectAutoComplete" />
39
- ));
40
- export const ColorPickerWidget = jest.fn(() => <div id="ColorPickerWidget" />);
41
- export const DatetimeWidget = jest.fn(() => <div id="DatetimeWidget" />);
42
- export const RecurrenceWidget = jest.fn(() => <div id="RecurrenceWidget" />);
43
- export const FormFieldWrapper = jest.fn(() => <div id="FormFieldWrapper" />);
39
+ export const SelectAutoComplete = vi.fn(() => <div id="SelectAutoComplete" />);
40
+ export const ColorPickerWidget = vi.fn(() => <div id="ColorPickerWidget" />);
41
+ export const DatetimeWidget = vi.fn(() => <div id="DatetimeWidget" />);
42
+ export const RecurrenceWidget = vi.fn(() => <div id="RecurrenceWidget" />);
43
+ export const FormFieldWrapper = vi.fn(() => <div id="FormFieldWrapper" />);
@@ -3,17 +3,18 @@ import configureStore from 'redux-mock-store';
3
3
  import { Provider } from 'react-intl-redux';
4
4
  import { render } from '@testing-library/react';
5
5
  import config from '@plone/volto/registry';
6
-
7
6
  import Workflow from './Workflow';
8
7
 
9
8
  const mockStore = configureStore();
10
9
 
11
- jest.mock('@plone/volto/components/manage/Widgets');
12
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
13
- beforeAll(
14
- async () =>
15
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
16
- );
10
+ vi.mock('@plone/volto/components/manage/Widgets');
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
+ });
17
18
 
18
19
  beforeEach(() => {
19
20
  config.settings.workflowMapping = {
@@ -16,24 +16,28 @@ beforeAll(() => {
16
16
 
17
17
  const mockStore = configureStore();
18
18
 
19
- jest.mock('../../manage/Toolbar/Toolbar', () =>
20
- jest.fn(() => <div id="toolbar" />),
21
- );
22
- jest.mock('../Header/Header', () => jest.fn(() => <div id="toolbar" />));
23
- jest.mock('../Breadcrumbs/Breadcrumbs', () =>
24
- jest.fn(() => <div id="breadcrumbs" />),
25
- );
26
- jest.mock('../../manage/Messages/Messages', () =>
27
- jest.fn(() => <div id="messages" />),
28
- );
29
- jest.mock('../Navigation/Navigation', () =>
30
- jest.fn(() => <div id="navigation" />),
31
- );
32
- jest.mock('semantic-ui-react', () => ({
33
- Segment: jest.fn(() => <div id="segment" />),
34
- Container: jest.fn(() => <div id="container" />),
19
+ vi.mock('../../manage/Toolbar/Toolbar', () => ({
20
+ default: vi.fn(() => <div id="toolbar" />),
21
+ }));
22
+ vi.mock('../Header/Header', () => ({
23
+ default: vi.fn(() => <div id="header" />),
24
+ }));
25
+ vi.mock('../Breadcrumbs/Breadcrumbs', () => ({
26
+ default: vi.fn(() => <div id="breadcrumbs" />),
27
+ }));
28
+ vi.mock('../../manage/Messages/Messages', () => ({
29
+ default: vi.fn(() => <div id="messages" />),
30
+ }));
31
+ vi.mock('../Navigation/Navigation', () => ({
32
+ default: vi.fn(() => <div id="navigation" />),
33
+ }));
34
+ vi.mock('semantic-ui-react', () => ({
35
+ Segment: vi.fn(() => <div id="segment" />),
36
+ Container: vi.fn(() => <div id="container" />),
37
+ }));
38
+ vi.mock('../Footer/Footer', () => ({
39
+ default: vi.fn(() => <div id="footer" />),
35
40
  }));
36
- jest.mock('../Footer/Footer', () => jest.fn(() => <div id="footer" />));
37
41
 
38
42
  describe('App', () => {
39
43
  it('renders a app component', () => {