@plone/volto 19.0.0-alpha.0 → 19.0.0-alpha.10
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 +2 -0
- package/.eslintrc +37 -0
- package/CHANGELOG.md +274 -2
- package/README.md +3 -6
- package/cypress/docker/prefixed-rules.yml +26 -0
- package/cypress/docker/prefixed.yml +24 -0
- package/cypress/support/commands.js +12 -6
- package/cypress/support/guillotina.js +1 -0
- package/cypress.config.js +1 -0
- package/locales/af.json +1 -0
- package/locales/ar.json +1 -0
- package/locales/bg.json +1 -0
- package/locales/bn.json +1 -0
- package/locales/ca/LC_MESSAGES/volto.po +96 -17
- package/locales/ca.json +1 -1
- package/locales/cs.json +1 -0
- package/locales/cy.json +1 -0
- package/locales/da.json +1 -0
- package/locales/de/LC_MESSAGES/volto.po +104 -25
- package/locales/de.json +1 -1
- package/locales/el.json +1 -0
- package/locales/en/LC_MESSAGES/volto.po +97 -18
- package/locales/en.json +1 -1
- package/locales/en_AU.json +1 -0
- package/locales/en_GB.json +1 -0
- package/locales/eo.json +1 -0
- package/locales/es/LC_MESSAGES/volto.po +97 -18
- package/locales/es.json +1 -1
- package/locales/et.json +1 -0
- package/locales/eu/LC_MESSAGES/volto.po +96 -17
- package/locales/eu.json +1 -1
- package/locales/fa.json +1 -0
- package/locales/fi/LC_MESSAGES/volto.po +96 -17
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +97 -18
- package/locales/fr.json +1 -1
- package/locales/fu.json +1 -0
- package/locales/gl.json +1 -0
- package/locales/he.json +1 -0
- package/locales/hi/LC_MESSAGES/volto.po +100 -21
- package/locales/hi.json +1 -1
- package/locales/hr.json +1 -0
- package/locales/hu.json +1 -0
- package/locales/hy.json +1 -0
- package/locales/id.json +1 -0
- package/locales/it/LC_MESSAGES/volto.po +101 -22
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +96 -17
- package/locales/ja.json +1 -1
- package/locales/ka.json +1 -0
- package/locales/kn.json +1 -0
- package/locales/ko.json +1 -0
- package/locales/lt.json +1 -0
- package/locales/lv.json +1 -0
- package/locales/mi.json +1 -0
- package/locales/mk.json +1 -0
- package/locales/my.json +1 -0
- package/locales/nb_NO.json +1 -0
- package/locales/nl/LC_MESSAGES/volto.po +100 -21
- package/locales/nl.json +1 -1
- package/locales/nn.json +1 -0
- package/locales/pl.json +1 -0
- package/locales/pt/LC_MESSAGES/volto.po +96 -17
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +116 -37
- package/locales/pt_BR.json +1 -1
- package/locales/rm.json +1 -0
- package/locales/ro/LC_MESSAGES/volto.po +100 -21
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +100 -21
- package/locales/ru.json +1 -1
- package/locales/sk.json +1 -0
- package/locales/sl.json +1 -0
- package/locales/sm.json +1 -0
- package/locales/sq.json +1 -0
- package/locales/sr.json +1 -0
- package/locales/sr@cyrl.json +1 -0
- package/locales/sr@latn.json +1 -0
- package/locales/sv.json +1 -1
- package/locales/ta.json +1 -0
- package/locales/te.json +1 -0
- package/locales/th.json +1 -0
- package/locales/to.json +1 -0
- package/locales/tr.json +1 -0
- package/locales/uk.json +1 -0
- package/locales/vi.json +1 -0
- package/locales/volto.pot +97 -18
- package/locales/zh_CN/LC_MESSAGES/volto.po +96 -17
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant.json +1 -0
- package/locales/zh_Hant_HK.json +1 -0
- package/package.json +36 -27
- package/razzle.config.js +16 -0
- 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/content/content.js +0 -1
- package/src/actions/controlpanels/controlpanels.js +13 -7
- package/src/actions/controlpanels/controlpanels.test.js +11 -5
- package/src/actions/querystring/querystring.test.js +2 -2
- package/src/actions/types/types.test.js +1 -1
- package/src/actions/users/users.js +2 -2
- package/src/components/manage/Actions/Actions.test.jsx +5 -1
- package/src/components/manage/Add/Add.jsx +27 -26
- 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 +3 -1
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
- 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/Edit.jsx +5 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +6 -2
- package/src/components/manage/Blocks/LeadImage/Edit.jsx +2 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +1 -1
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +8 -1
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Listing/View.test.jsx +3 -1
- package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +5 -1
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +21 -4
- 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/Teaser/Data.jsx +21 -7
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +1 -1
- package/src/components/manage/Blocks/Teaser/schema.js +8 -3
- package/src/components/manage/Blocks/Title/Edit.jsx +8 -2
- package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +11 -1
- package/src/components/manage/Blocks/Video/Edit.jsx +2 -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.jsx +23 -2
- package/src/components/manage/Contents/Contents.test.jsx +36 -13
- package/src/components/manage/Contents/ContentsBreadcrumbs.Multilingual.test.jsx +18 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +20 -26
- package/src/components/manage/Contents/ContentsBreadcrumbs.test.jsx +14 -0
- package/src/components/manage/Contents/ContentsDeleteModal.jsx +258 -206
- package/src/components/manage/Contents/ContentsDeleteModal.stories.jsx +26 -8
- package/src/components/manage/Contents/ContentsItem.jsx +10 -2
- 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/ContentsUploadModal.test.jsx +13 -22
- 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.jsx +1 -1
- 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.jsx +3 -2
- 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/RenderUsers.jsx +156 -175
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -1
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +575 -630
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +16 -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.jsx +2 -3
- 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.jsx +32 -0
- package/src/components/manage/Form/Form.test.jsx +27 -19
- package/src/components/manage/Form/InlineForm.jsx +2 -2
- 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/CompareLanguages.jsx +2 -5
- package/src/components/manage/Multilingual/CreateTranslation.jsx +8 -8
- package/src/components/manage/Multilingual/ManageTranslations.jsx +4 -2
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +8 -3
- package/src/components/manage/Multilingual/TranslationObject.jsx +1 -1
- 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.jsx +2 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.test.jsx +3 -3
- package/src/components/manage/Sidebar/SidebarPortal.test.tsx +42 -0
- package/src/components/manage/Sidebar/SidebarPortal.tsx +48 -0
- package/src/components/manage/TemplateChooser/TemplateChooser.jsx +2 -1
- package/src/components/manage/Toolbar/More.jsx +4 -1
- package/src/components/manage/Toolbar/More.test.jsx +9 -7
- package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
- package/src/components/manage/Toolbar/Toolbar.jsx +3 -4
- package/src/components/manage/Toolbar/Types.jsx +7 -7
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +196 -14
- package/src/components/manage/UniversalLink/UniversalLink.tsx +215 -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.jsx +5 -0
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +21 -6
- package/src/components/manage/Widgets/FileWidget.jsx +14 -8
- package/src/components/manage/Widgets/ImageWidget.jsx +176 -40
- package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/NumberWidget.test.jsx +8 -7
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -0
- 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 +44 -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.jsx +29 -12
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +12 -6
- package/src/components/manage/Widgets/SelectWidget.jsx +3 -1
- 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/UrlWidget.jsx +2 -0
- 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/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -3
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +0 -4
- package/src/components/theme/App/App.jsx +3 -1
- package/src/components/theme/App/App.test.jsx +22 -17
- package/src/components/theme/AppExtras/AppExtras.test.jsx +6 -6
- package/src/components/theme/Avatar/Avatar.jsx +2 -1
- 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/FormattedDate/FormattedDate.stories.jsx +20 -2
- package/src/components/theme/Header/Header.test.jsx +19 -13
- package/src/components/theme/Image/Image.jsx +11 -8
- package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +6 -6
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
- package/src/components/theme/Logo/Logo.Multilingual.test.jsx +0 -5
- package/src/components/theme/Logout/Logout.test.jsx +1 -1
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +8 -12
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.test.jsx +3 -5
- package/src/components/theme/Navigation/NavItem.jsx +1 -5
- package/src/components/theme/Navigation/Navigation.Multilingual.test.jsx +0 -5
- package/src/components/theme/NotFound/NotFound.jsx +5 -2
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -0
- package/src/components/theme/PasswordReset/PasswordReset.test.jsx +10 -1
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +5 -1
- package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +5 -1
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Search/Search.test.jsx +6 -4
- package/src/components/theme/Sitemap/Sitemap.jsx +6 -5
- package/src/components/theme/Sitemap/Sitemap.test.jsx +0 -1
- 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/FileView.jsx +9 -1
- 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.jsx +1 -1
- package/src/components/theme/View/View.test.jsx +42 -23
- package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
- package/src/config/ControlPanels.js +1 -0
- package/src/config/index.js +18 -25
- package/src/config/server.js +0 -2
- package/src/express-middleware/devproxy.js +20 -5
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +7 -4
- 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/AsyncConnect/ssr.js +4 -1
- package/src/helpers/AuthToken/AuthToken.test.js +60 -22
- package/src/helpers/Blocks/Blocks.test.js +1 -1
- package/src/helpers/Content/Content.js +23 -0
- package/src/helpers/Content/Content.test.js +39 -0
- package/src/helpers/Content/withClientSideContent.jsx +35 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.jsx +4 -1
- package/src/helpers/Html/Html.jsx +13 -7
- package/src/helpers/Html/Html.test.jsx +32 -28
- package/src/helpers/LanguageMap/LanguageMap.js +115 -8
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +16 -1
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +39 -0
- package/src/helpers/MessageLabels/MessageLabels.js +5 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +32 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/helpers/Utils/withSaveAsDraft.jsx +241 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/middleware/Api.test.js +51 -0
- package/src/middleware/api.js +78 -29
- package/src/middleware/storeProtectLoadUtils.test.js +93 -81
- package/src/reducers/content/content.js +3 -18
- package/src/reducers/diff/diff.js +5 -1
- package/src/reducers/diff/diff.test.js +60 -4
- package/src/routes.js +4 -2
- package/src/server.jsx +45 -14
- package/src/start-client.jsx +9 -6
- package/src/start-server.js +9 -3
- package/test-setup-config.jsx +0 -2
- package/test-setup-globals-vitest.js +46 -0
- package/theme/themes/pastanaga/collections/table.overrides +9 -0
- package/theme/themes/pastanaga/extras/blocks.less +26 -0
- package/theme/themes/pastanaga/extras/contents.less +17 -5
- package/theme/themes/pastanaga/extras/main.less +32 -2
- package/tsconfig.declarations.json +12 -1
- package/tsconfig.json +5 -5
- package/types/components/manage/Blocks/Teaser/schema.d.ts +1 -0
- 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/Controlpanels/Users/RenderUsers.d.ts +18 -2
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +6 -2
- package/types/components/manage/Controlpanels/index.d.ts +2 -2
- 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/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/UniversalLink/UniversalLink.d.ts +54 -20
- package/types/components/manage/Widgets/ImageWidget.d.ts +41 -1
- package/types/components/manage/Widgets/RecurrenceWidget/Utils.d.ts +12 -18
- package/types/components/manage/Widgets/__mocks__/index.vitest.d.ts +33 -0
- package/types/components/theme/FormattedDate/FormattedDate.stories.d.ts +1 -1
- package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
- package/types/helpers/Content/Content.d.ts +7 -0
- package/types/helpers/Content/withClientSideContent.d.ts +1 -0
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +4 -5
- package/types/helpers/Helmet/Helmet.d.ts +1 -1
- package/types/helpers/LanguageMap/LanguageMap.d.ts +428 -4
- package/types/helpers/Loadable/__mocks__/Loadable.vitest.d.ts +3 -0
- package/types/helpers/MessageLabels/MessageLabels.d.ts +68 -62
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/helpers/Utils/withSaveAsDraft.d.ts +1 -0
- package/types/middleware/api.d.ts +6 -9
- package/types/react-router-hash-link.d.ts +12 -0
- package/types/reducers/index.d.ts +1 -0
- package/types/routes.d.ts +4 -0
- package/types/server.d.ts +1 -1
- package/types/start-client.d.ts +0 -1
- package/vite-plugins/svg.mjs +81 -0
- package/vitest.config.mjs +77 -0
- package/package-why.json +0 -34
- package/src/actions/content/content.multilingual.test.js +0 -17
- 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/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/UniversalLink/UniversalLink.jsx +0 -154
- package/src/components/manage/Widgets/FileWidget.test.jsx +0 -91
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -77
- package/theme/themes/pastanaga/extras/utils.less +0 -63
|
@@ -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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 =
|
|
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,24 @@ describe('RegistryImageWidget', () => {
|
|
|
54
71
|
fieldSet="default"
|
|
55
72
|
onChange={() => {}}
|
|
56
73
|
value={
|
|
57
|
-
'filenameb64:bG9nby5jYWI5NDVkOC5zdmc=;datab64:PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE1OC4yNTNweCIgaGVpZ2h0PSI0MC42ODZweCIgdmlld0JveD0iMCAwIDE1OC4yNTMgNDAuNjg2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNTguMjUzIDQwLjY4NiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CiAgICAgICAgICAgICAgICAgICAgPGc+
|
|
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
|
+
const img = container.querySelector('img[src*="logo"]');
|
|
86
|
+
|
|
87
|
+
return dropzone && preview && filename && img && img.complete;
|
|
88
|
+
},
|
|
89
|
+
{ timeout: 2000 },
|
|
90
|
+
);
|
|
91
|
+
|
|
64
92
|
expect(container).toMatchSnapshot();
|
|
65
93
|
});
|
|
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+PHBhdGggZmlsbD0iIzAwODZDMyIgZD0iTTY1LjMyNywyMy4yMDhoLTYuNTg5djExLjM4OGgtNC4zOTNWNS42MzhoMTAuOTgxYzUuNjUzLDAsOS4yNzEsMy43NDIsOS4yNzEsOC43ODUgICAgICAgICAgICAgICAgIFM3MC45NzksMjMuMjA4LDY1LjMyNywyMy4yMDh6IE02NS4wODIsOS41ODNoLTYuMzQ1djkuNjM5aDYuMzQ1YzMuMDUsMCw1LjEyNC0xLjc0OSw1LjEyNC00Ljc5OSAgICAgICAgICAgICAgICAgQzcwLjIwNiwxMS4zNzIsNjguMTMyLDkuNTgzLDY1LjA4Miw5LjU4M3oiLz48cGF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TQuMDU2LDExLjE5NXoiLz48L2c+PC9nPgogICAgICAgICAgICAgICAgICA8L3N2Zz4=}'
|
|
83
|
-
// }
|
|
84
|
-
// />
|
|
85
|
-
// </Provider>,
|
|
86
|
-
// );
|
|
87
|
-
|
|
88
|
-
// await waitFor(() => {});
|
|
89
|
-
// expect(container).toMatchSnapshot();
|
|
90
|
-
// });
|
|
91
94
|
});
|
|
@@ -5,11 +5,18 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import SchemaWidget from './SchemaWidget';
|
|
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 mockStore = configureStore();
|
|
15
22
|
|
|
@@ -3,11 +3,18 @@ import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
4
|
import SchemaWidgetFieldsetComponent from './SchemaWidgetFieldset';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
6
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
7
|
+
return await import(
|
|
8
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
9
|
+
);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
beforeAll(async () => {
|
|
13
|
+
const { __setLoadables } = await import(
|
|
14
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
15
|
+
);
|
|
16
|
+
await __setLoadables();
|
|
17
|
+
});
|
|
11
18
|
|
|
12
19
|
test('renders a contents item component', () => {
|
|
13
20
|
const { container } = render(
|
|
@@ -105,6 +105,7 @@ class SelectAutoComplete extends Component {
|
|
|
105
105
|
error: [],
|
|
106
106
|
choices: [],
|
|
107
107
|
value: null,
|
|
108
|
+
isMulti: true,
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
/**
|
|
@@ -127,10 +128,16 @@ class SelectAutoComplete extends Component {
|
|
|
127
128
|
componentDidMount() {
|
|
128
129
|
const { id, lang, value, choices } = this.props;
|
|
129
130
|
if (value && value?.length > 0) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
let tokensQuery;
|
|
132
|
+
if (typeof value === 'string') {
|
|
133
|
+
tokensQuery = convertValueToVocabQuery(
|
|
134
|
+
normalizeValue(choices, [value], this.props.intl),
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
tokensQuery = convertValueToVocabQuery(
|
|
138
|
+
normalizeValue(choices, value, this.props.intl),
|
|
139
|
+
);
|
|
140
|
+
}
|
|
134
141
|
this.props.getVocabularyTokenTitle({
|
|
135
142
|
vocabNameOrURL: this.props.vocabBaseUrl,
|
|
136
143
|
subrequest: `widget-${id}-${lang}`,
|
|
@@ -160,13 +167,22 @@ class SelectAutoComplete extends Component {
|
|
|
160
167
|
* @returns {undefined}
|
|
161
168
|
*/
|
|
162
169
|
handleChange(selectedOption) {
|
|
163
|
-
|
|
164
|
-
this.props.id,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
if (!Array.isArray(selectedOption)) {
|
|
171
|
+
this.props.onChange(this.props.id, selectedOption?.value || null);
|
|
172
|
+
if (selectedOption) {
|
|
173
|
+
this.setState((state) => ({
|
|
174
|
+
termsPairsCache: [...state.termsPairsCache, selectedOption],
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
this.props.onChange(
|
|
179
|
+
this.props.id,
|
|
180
|
+
selectedOption ? selectedOption.map((item) => item.value) : null,
|
|
181
|
+
);
|
|
182
|
+
this.setState((state) => ({
|
|
183
|
+
termsPairsCache: [...state.termsPairsCache, ...selectedOption],
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
timeoutRef = React.createRef();
|
|
@@ -251,7 +267,8 @@ class SelectAutoComplete extends Component {
|
|
|
251
267
|
this.props.intl.formatMessage(messages.select)
|
|
252
268
|
}
|
|
253
269
|
onChange={this.handleChange}
|
|
254
|
-
isMulti
|
|
270
|
+
isMulti={this.props.isMulti}
|
|
271
|
+
isClearable={!this.props.isMulti}
|
|
255
272
|
/>
|
|
256
273
|
</FormFieldWrapper>
|
|
257
274
|
);
|
|
@@ -2,16 +2,22 @@ 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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
const { __setLoadables } = await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
18
|
+
);
|
|
19
|
+
await __setLoadables();
|
|
20
|
+
});
|
|
15
21
|
|
|
16
22
|
test('renders a select widget component', async () => {
|
|
17
23
|
const store = mockStore({
|
|
@@ -128,6 +128,7 @@ class SelectWidget extends Component {
|
|
|
128
128
|
isMulti: PropTypes.bool,
|
|
129
129
|
placeholder: PropTypes.string,
|
|
130
130
|
sort: PropTypes.bool,
|
|
131
|
+
isClearable: PropTypes.bool,
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
/**
|
|
@@ -156,6 +157,7 @@ class SelectWidget extends Component {
|
|
|
156
157
|
noValueOption: true,
|
|
157
158
|
customOptionStyling: null,
|
|
158
159
|
sort: false,
|
|
160
|
+
isClearable: true,
|
|
159
161
|
};
|
|
160
162
|
|
|
161
163
|
/**
|
|
@@ -302,7 +304,7 @@ class SelectWidget extends Component {
|
|
|
302
304
|
: undefined,
|
|
303
305
|
);
|
|
304
306
|
}}
|
|
305
|
-
isClearable
|
|
307
|
+
isClearable={this.props.isClearable}
|
|
306
308
|
/>
|
|
307
309
|
</FormFieldWrapper>
|
|
308
310
|
);
|
|
@@ -2,16 +2,22 @@ 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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
const { __setLoadables } = await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
18
|
+
);
|
|
19
|
+
await __setLoadables();
|
|
20
|
+
});
|
|
15
21
|
|
|
16
22
|
test('renders a select widget component', async () => {
|
|
17
23
|
const store = mockStore({
|
|
@@ -6,11 +6,18 @@ import { waitFor, render, screen } from '@testing-library/react';
|
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore();
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
const { __setLoadables } = await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
18
|
+
);
|
|
19
|
+
await __setLoadables();
|
|
20
|
+
});
|
|
14
21
|
|
|
15
22
|
test('renders a time widget component', async () => {
|
|
16
23
|
const store = mockStore({
|
|
@@ -31,5 +38,6 @@ test('renders a time widget component', async () => {
|
|
|
31
38
|
</Provider>,
|
|
32
39
|
);
|
|
33
40
|
await waitFor(() => screen.getByText(/My field/));
|
|
41
|
+
await waitFor(() => screen.getByPlaceholderText('Time'));
|
|
34
42
|
expect(container).toMatchSnapshot();
|
|
35
43
|
});
|
|
@@ -3,16 +3,22 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
10
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
11
|
+
return await import(
|
|
12
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
const { __setLoadables } = await import(
|
|
18
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
19
|
+
);
|
|
20
|
+
await __setLoadables();
|
|
21
|
+
});
|
|
16
22
|
|
|
17
23
|
test('renders a token widget component', async () => {
|
|
18
24
|
const store = mockStore({
|
|
@@ -105,6 +105,7 @@ export const UrlWidget = (props) => {
|
|
|
105
105
|
{value?.length > 0 ? (
|
|
106
106
|
<Button.Group>
|
|
107
107
|
<Button
|
|
108
|
+
type="button"
|
|
108
109
|
basic
|
|
109
110
|
className="cancel"
|
|
110
111
|
aria-label="clearUrlBrowser"
|
|
@@ -120,6 +121,7 @@ export const UrlWidget = (props) => {
|
|
|
120
121
|
) : (
|
|
121
122
|
<Button.Group>
|
|
122
123
|
<Button
|
|
124
|
+
type="button"
|
|
123
125
|
basic
|
|
124
126
|
icon
|
|
125
127
|
aria-label="openUrlBrowser"
|
|
@@ -2,23 +2,32 @@ 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
|
-
|
|
9
|
-
|
|
7
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
8
|
+
return await import(
|
|
9
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
13
|
+
return await import(
|
|
14
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
15
|
+
);
|
|
16
|
+
});
|
|
10
17
|
|
|
11
|
-
beforeAll(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
const { __setLoadables } = await import(
|
|
20
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
21
|
+
);
|
|
22
|
+
await __setLoadables();
|
|
23
|
+
});
|
|
15
24
|
|
|
16
25
|
let mockSerial = 0;
|
|
17
26
|
const mockStore = configureStore();
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
vi.mock('uuid', () => {
|
|
20
29
|
return {
|
|
21
|
-
v4:
|
|
30
|
+
v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`),
|
|
22
31
|
};
|
|
23
32
|
});
|
|
24
33
|
|
|
@@ -1,3 +1,19 @@
|
|
|
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/components/manage/Widgets', async () => {
|
|
5
|
+
return await import(
|
|
6
|
+
'@plone/volto/components/manage/Widgets/__mocks__/index.vitest.tsx'
|
|
7
|
+
);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
with the following:
|
|
11
|
+
|
|
12
|
+
vi.mock('@plone/volto/components/manage/Widgets');
|
|
13
|
+
|
|
14
|
+
Finally, remove this comment.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
export const AlignWidget = jest.fn(() => <div id="AlignWidget" />);
|
|
2
18
|
export const ButtonsWidget = jest.fn(() => <div id="ButtonsWidget" />);
|
|
3
19
|
export const ArrayWidget = jest.fn(() => <div id="ArrayWidget" />);
|
|
@@ -0,0 +1,41 @@
|
|
|
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" />);
|
|
@@ -3,17 +3,27 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
10
|
+
vi.mock('@plone/volto/components/manage/Widgets', async () => {
|
|
11
|
+
return await import(
|
|
12
|
+
'@plone/volto/components/manage/Widgets/__mocks__/index.vitest.tsx'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
16
|
+
return await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
beforeAll(async () => {
|
|
22
|
+
const { __setLoadables } = await import(
|
|
23
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
24
|
+
);
|
|
25
|
+
await __setLoadables();
|
|
26
|
+
});
|
|
17
27
|
|
|
18
28
|
beforeEach(() => {
|
|
19
29
|
config.settings.workflowMapping = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import config from '@plone/volto/registry';
|
|
2
1
|
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
3
2
|
import { flattenToAppURL, toPublicURL } from '@plone/volto/helpers/Url/Url';
|
|
4
3
|
|
|
@@ -6,8 +5,7 @@ const AlternateHrefLangs = (props) => {
|
|
|
6
5
|
const { content } = props;
|
|
7
6
|
return (
|
|
8
7
|
<Helmet>
|
|
9
|
-
{
|
|
10
|
-
content['@components']?.translations?.items &&
|
|
8
|
+
{content['@components']?.translations?.items &&
|
|
11
9
|
[
|
|
12
10
|
...content['@components']?.translations?.items,
|
|
13
11
|
{ '@id': content['@id'], language: content.language.token },
|
|
@@ -13,7 +13,6 @@ const mockStore = configureStore();
|
|
|
13
13
|
describe('AlternateHrefLangs', () => {
|
|
14
14
|
beforeEach(() => {});
|
|
15
15
|
it('non multilingual site, renders nothing', () => {
|
|
16
|
-
config.settings.isMultilingual = false;
|
|
17
16
|
const content = {
|
|
18
17
|
'@id': '/',
|
|
19
18
|
'@components': {},
|
|
@@ -38,7 +37,6 @@ describe('AlternateHrefLangs', () => {
|
|
|
38
37
|
|
|
39
38
|
it('multilingual site, with some translations', () => {
|
|
40
39
|
config.settings.publicURL = 'https://plone.org';
|
|
41
|
-
config.settings.isMultilingual = true;
|
|
42
40
|
config.settings.supportedLanguages = ['en', 'es', 'eu'];
|
|
43
41
|
|
|
44
42
|
const content = {
|
|
@@ -85,7 +83,6 @@ describe('AlternateHrefLangs', () => {
|
|
|
85
83
|
|
|
86
84
|
it('multilingual site, with all available translations', () => {
|
|
87
85
|
config.settings.publicURL = 'https://plone.org';
|
|
88
|
-
config.settings.isMultilingual = true;
|
|
89
86
|
config.settings.supportedLanguages = ['en', 'es', 'eu'];
|
|
90
87
|
const store = mockStore({
|
|
91
88
|
intl: {
|
|
@@ -139,7 +136,6 @@ describe('AlternateHrefLangs', () => {
|
|
|
139
136
|
|
|
140
137
|
it('multilingual site, with all available translations - with server URL', () => {
|
|
141
138
|
config.settings.publicURL = 'https://plone.org';
|
|
142
|
-
config.settings.isMultilingual = true;
|
|
143
139
|
config.settings.supportedLanguages = ['en', 'es', 'eu'];
|
|
144
140
|
const store = mockStore({
|
|
145
141
|
intl: {
|
|
@@ -235,7 +235,9 @@ export const fetchContent = async ({ store, location }) => {
|
|
|
235
235
|
|
|
236
236
|
const visitor = ([id, data]) => {
|
|
237
237
|
const blockType = data['@type'];
|
|
238
|
-
const
|
|
238
|
+
const block = blocksConfig[blockType];
|
|
239
|
+
if (!block) return;
|
|
240
|
+
const { getAsyncData } = block;
|
|
239
241
|
if (getAsyncData) {
|
|
240
242
|
const p = getAsyncData({
|
|
241
243
|
store,
|