@griddo/ax 12.3.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/{jest/componentsMock.js → tests/componentsMock.cjs} +4 -1
- package/config/tests/reactEasyCropMock.js +15 -0
- package/config/tests/reactTimezoneMock.js +14 -0
- package/config/tests/setup.ts +41 -0
- package/config/webpack.config.js +5 -0
- package/package.json +15 -29
- package/public/img/icons/markdown.svg +6 -0
- package/src/__tests__/components/ActionMenu/ActionMenu.test.tsx +12 -12
- package/src/__tests__/components/Breadcrumb/Breadcrumb.test.tsx +2 -2
- package/src/__tests__/components/Browser/Browser.test.tsx +17 -25
- package/src/__tests__/components/BulkSelectionOptions/BulkSelectionOptions.test.tsx +3 -3
- package/src/__tests__/components/CategoryCell/CategoryCell.test.tsx +3 -2
- package/src/__tests__/components/ConfigPanel/ConfigPanel.test.tsx +4 -4
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/ConnectedField.test.tsx +2 -2
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/NavConnectedField/NavConnectedField.test.tsx +2 -2
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/Field.test.tsx +3 -3
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/PageConnectedField.test.tsx +17 -14
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/TemplateManager.test.tsx +4 -4
- package/src/__tests__/components/ConfigPanel/Form/Form.test.tsx +49 -58
- package/src/__tests__/components/ConfigPanel/GlobalPageForm/GlobalPageForm.test.tsx +11 -11
- package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +51 -46
- package/src/__tests__/components/ConfigPanel/NavigationForm/Field/Field.test.tsx +2 -2
- package/src/__tests__/components/ConfigPanel/NavigationForm/NavigationForm.test.tsx +2 -2
- package/src/__tests__/components/ConfigPanel/PreviewForm/PreviewForm.test.tsx +4 -3
- package/src/__tests__/components/ContextMenu/ContextMenu.test.tsx +24 -24
- package/src/__tests__/components/DragAndDrop/DragAndDrop.test.tsx +6 -5
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +7 -18
- package/src/__tests__/components/EmptyState/EmptyState.test.tsx +11 -11
- package/src/__tests__/components/ErrorCenter/ErrorCenter.test.tsx +11 -11
- package/src/__tests__/components/FieldContainer/FieldContainer.test.tsx +4 -4
- package/src/__tests__/components/Fields/AnalyticsField/AnalyticsField.test.tsx +3 -3
- package/src/__tests__/components/Fields/AnalyticsField/PageAnalytics/PageAnalytics.test.tsx +4 -4
- package/src/__tests__/components/Fields/AnalyticsField/StructuredDataAnalytics/StructuredDataAnalytics.test.tsx +3 -3
- package/src/__tests__/components/Fields/ArrayFieldGroup/ArrayFieldGroup.test.tsx +6 -5
- package/src/__tests__/components/Fields/AsyncCheckGroup/AsyncCheckGroup.test.tsx +19 -18
- package/src/__tests__/components/Fields/AsyncSelect/AsyncSelect.test.tsx +64 -53
- package/src/__tests__/components/Fields/Button/Button.test.tsx +4 -3
- package/src/__tests__/components/Fields/CheckField/CheckField.test.tsx +5 -5
- package/src/__tests__/components/Fields/CheckGroup/CheckGroup.test.tsx +10 -10
- package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +67 -58
- package/src/__tests__/components/Fields/ComponentArray/ComponentArray.test.tsx +3 -3
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/MixableComponentArray.test.tsx +45 -45
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +7 -6
- package/src/__tests__/components/Fields/ComponentArray/SameComponentArray/SameComponentArray.test.tsx +7 -7
- package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +223 -426
- package/src/__tests__/components/Fields/ConditionalField/ConditionalField.test.tsx +1 -1
- package/src/__tests__/components/Fields/DateField/DateField.test.tsx +6 -5
- package/src/__tests__/components/Fields/FieldGroup/FieldGroup.test.tsx +2 -2
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +17 -18
- package/src/__tests__/components/Fields/HeadingField/HeadingField.test.tsx +2 -2
- package/src/__tests__/components/Fields/HiddenField/HiddenField.test.tsx +3 -3
- package/src/__tests__/components/Fields/ImageField/ImageField.test.tsx +280 -263
- package/src/__tests__/components/Fields/IntegrationsField/IntegrationsField.test.tsx +60 -57
- package/src/__tests__/components/Fields/MultiCheckSelect/MultiCheckSelect.test.tsx +1 -1
- package/src/__tests__/components/Fields/MultiCheckSelectGroup/MultiCheckSelectGroup.test.tsx +7 -6
- package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +10 -9
- package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +16 -20
- package/src/__tests__/components/Fields/RadioField/RadioField.test.tsx +2 -2
- package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +17 -16
- package/src/__tests__/components/Fields/RichText/RichText.test.tsx +1 -1
- package/src/__tests__/components/Fields/Select/Select.test.tsx +1 -1
- package/src/__tests__/components/Fields/SliderField/SliderField.test.tsx +5 -4
- package/src/__tests__/components/Fields/SummaryButton/SummaryButton.test.tsx +2 -2
- package/src/__tests__/components/Fields/TagField/TagField.test.tsx +9 -9
- package/src/__tests__/components/Fields/TextArea/TextArea.test.tsx +17 -9
- package/src/__tests__/components/Fields/TextField/TextField.test.tsx +8 -8
- package/src/__tests__/components/Fields/TimeField/HourInput/HourInput.test.tsx +7 -6
- package/src/__tests__/components/Fields/TimeField/TimeField.test.tsx +4 -3
- package/src/__tests__/components/Fields/ToggleField/ToggleField.test.tsx +16 -24
- package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +12 -6
- package/src/__tests__/components/Fields/TranslateButton/TranslateButton.test.tsx +13 -13
- package/src/__tests__/components/Fields/UniqueCheck/UniqueCheck.test.tsx +1 -1
- package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +20 -19
- package/src/__tests__/components/Fields/VisualUniqueSelection/ImageSelection/ImageSelection.test.tsx +3 -2
- package/src/__tests__/components/Fields/VisualUniqueSelection/ScrollableSelection/ScrollableSelection.test.tsx +4 -3
- package/src/__tests__/components/Fields/VisualUniqueSelection/VisualUniqueSelection.test.tsx +30 -22
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.atoms.test.tsx +11 -11
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.config.test.tsx +103 -0
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.helpers.test.tsx +13 -14
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.test.tsx +28 -28
- package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +22 -16
- package/src/__tests__/components/FloatingMenu/FloatingMenu.test.tsx +36 -35
- package/src/__tests__/components/FloatingPanel/FloatingPanel.test.tsx +10 -10
- package/src/__tests__/components/GuardModal/GuardModal.test.tsx +1 -1
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/ErrorItem.test.tsx +11 -11
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorsBanner.test.tsx +4 -4
- package/src/__tests__/components/HeadingsPreviewModal/HeadingsPreviewModal.test.tsx +15 -14
- package/src/__tests__/components/IconAction/IconAction.test.tsx +2 -2
- package/src/__tests__/components/ImageDragAndDrop/CropStep/CropStep.test.tsx +3 -3
- package/src/__tests__/components/ImageDragAndDrop/ImageDragAndDrop.test.tsx +7 -7
- package/src/__tests__/components/KeywordsPreviewModal/KeywordItem/KeywordItem.test.tsx +5 -5
- package/src/__tests__/components/KeywordsPreviewModal/KeywordsPreviewModal.test.tsx +14 -13
- package/src/__tests__/components/KeywordsPreviewModal/atoms.test.tsx +13 -13
- package/src/__tests__/components/LanguageMenu/LanguageMenu.test.tsx +6 -6
- package/src/__tests__/components/Lists/Lists.test.tsx +1 -1
- package/src/__tests__/components/Loader/Loader.test.tsx +1 -1
- package/src/__tests__/components/Login/Login.test.tsx +32 -32
- package/src/__tests__/components/Login/RecoveryModal/RecoveryModal.test.tsx +10 -9
- package/src/__tests__/components/MainWrapper/AppBar/AppBar.test.tsx +21 -21
- package/src/__tests__/components/MenuItem/MenuItem.test.tsx +5 -5
- package/src/__tests__/components/Modal/Modal.test.tsx +20 -20
- package/src/__tests__/components/Nav/Nav.test.tsx +2 -2
- package/src/__tests__/components/Notification/Notification.test.tsx +2 -2
- package/src/__tests__/components/Pagination/Pagination.test.tsx +13 -14
- package/src/__tests__/components/ProfileImage/ProfileImage.test.tsx +6 -7
- package/src/__tests__/components/ReorderArrows/ReorderArrows.test.tsx +4 -3
- package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +18 -17
- package/src/__tests__/components/RestrictionsModal/CurrentAccessList/CurrentAccessList.test.tsx +7 -6
- package/src/__tests__/components/RestrictionsModal/OptionsStep/OptionsStep.test.tsx +12 -11
- package/src/__tests__/components/RestrictionsModal/RestrictionsModal.test.tsx +11 -10
- package/src/__tests__/components/RestrictionsModal/RolesList/RolesList.test.tsx +8 -8
- package/src/__tests__/components/RestrictionsModal/UsersList/UsersList.test.tsx +16 -15
- package/src/__tests__/components/SearchField/SearchField.test.tsx +13 -13
- package/src/__tests__/components/SideModal/SideModal.test.tsx +175 -127
- package/src/__tests__/components/SubNav/SubNav.test.tsx +1 -1
- package/src/__tests__/components/TableFilters/CategoryFilter/CategoryFilter.test.tsx +9 -8
- package/src/__tests__/components/TableFilters/CustomizeFilters/CustomizeFilters.test.tsx +5 -5
- package/src/__tests__/components/TableFilters/DateFilter/DateFilter.test.tsx +8 -8
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +26 -39
- package/src/__tests__/components/TableFilters/NameFilter/NameFilter.test.tsx +10 -10
- package/src/__tests__/components/TableFilters/RoleFilter/RoleFilter.test.tsx +5 -5
- package/src/__tests__/components/TableFilters/SiteFilter/SiteFilter.test.tsx +10 -9
- package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +70 -45
- package/src/__tests__/components/TableFilters/TranslationsFilter/TranslationsFilter.test.tsx +8 -8
- package/src/__tests__/components/TableFilters/TypeFilter/TypeFilter.test.tsx +5 -5
- package/src/__tests__/components/TableFilters/UsersFilter/UsersFilter.test.tsx +8 -8
- package/src/__tests__/components/TableList/TableList.test.tsx +4 -4
- package/src/__tests__/components/Tabs/Tabs.test.tsx +73 -70
- package/src/__tests__/components/Tag/Tag.test.tsx +3 -3
- package/src/__tests__/components/Toast/Toast.test.tsx +24 -26
- package/src/__tests__/hooks/modals.test.tsx +4 -4
- package/src/__tests__/hooks/users.test.tsx +6 -5
- package/src/__tests__/modules/FileDrive/MarkdownFormat.test.tsx +58 -0
- package/src/__tests__/modules/FramePreview/FramePreview.test.tsx +56 -39
- package/src/__tests__/modules/FramePreview/HeadingsOverlay/HeadingsOverlay.test.tsx +11 -11
- package/src/__tests__/modules/Settings/Integrations/Integrations.test.tsx +2 -2
- package/src/__tests__/modules/Settings/Social/Social.test.tsx +4 -3
- package/src/__tests__/modules/Sites/Sites.test.tsx +5 -4
- package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +26 -21
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +19 -9
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/DataStep/DataStep.test.tsx +6 -6
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/FinalStep/FinalStep.test.tsx +4 -4
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/CropView.test.tsx +3 -3
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/ImageStep.test.tsx +9 -5
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/UploadView.test.tsx +8 -6
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/TimezoneStep/TimezoneStep.test.tsx +7 -7
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeModal.test.tsx +1 -1
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeStep/WelcomeStep.test.tsx +3 -3
- package/src/__tests__/modules/Users/Roles/BulkHeader/BulkHeader.test.tsx +72 -67
- package/src/__tests__/modules/Users/Roles/Roles.test.tsx +14 -10
- package/src/__tests__/modules/Users/UserCreate/SiteItem/RolesModal/RoleItem/RoleItem.test.tsx +3 -3
- package/src/__tests__/modules/Users/UserCreate/SiteItem/RolesModal/RolesModal.test.tsx +3 -3
- package/src/__tests__/modules/Users/UserCreate/SiteItem/SiteItem.test.tsx +3 -3
- package/src/__tests__/modules/Users/UserCreate/UserCreate.test.tsx +6 -5
- package/src/__tests__/modules/Users/UserList/UserItem/UserItem.test.tsx +9 -9
- package/src/__tests__/modules/Users/UserList/UserList.test.tsx +4 -4
- package/src/components/Fields/Wysiwyg/config.tsx +68 -17
- package/src/components/Fields/Wysiwyg/helpers.tsx +2 -0
- package/src/components/Fields/Wysiwyg/index.tsx +41 -10
- package/src/components/Flag/components/index.ts +30 -0
- package/src/components/Flag/index.tsx +3 -5
- package/src/components/Icon/components/index.ts +229 -0
- package/src/components/Icon/index.tsx +3 -7
- package/src/components/ResizePanel/index.tsx +7 -2
- package/src/constants/index.ts +1 -1
- package/src/helpers/files.tsx +2 -0
- package/src/modules/FileDrive/FileFilters/Type/index.tsx +1 -0
- package/tsconfig.json +1 -1
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileMock.js +0 -1
- package/config/jest/fileTransform.js +0 -40
- package/config/jest/reactEasyCropMock.js +0 -15
- package/config/jest/reactTimezoneMock.js +0 -13
- package/config/jest/setup.js +0 -31
- package/config/jest/styleMock.js +0 -1
- /package/config/{jest/test-utils.js → tests/test-utils.jsx} +0 -0
- /package/src/components/Flag/components/{Ca_ES.js → Ca_ES.jsx} +0 -0
- /package/src/components/Flag/components/{De_DE.js → De_DE.jsx} +0 -0
- /package/src/components/Flag/components/{En_GB.js → En_GB.jsx} +0 -0
- /package/src/components/Flag/components/{Es_ES.js → Es_ES.jsx} +0 -0
- /package/src/components/Flag/components/{Eu_ES.js → Eu_ES.jsx} +0 -0
- /package/src/components/Flag/components/{Fr_FR.js → Fr_FR.jsx} +0 -0
- /package/src/components/Flag/components/{It_IT.js → It_IT.jsx} +0 -0
- /package/src/components/Flag/components/{Pt_PT.js → Pt_PT.jsx} +0 -0
- /package/src/components/Icon/components/{Active.js → Active.jsx} +0 -0
- /package/src/components/Icon/components/{Add.js → Add.jsx} +0 -0
- /package/src/components/Icon/components/{AddCircle.js → AddCircle.jsx} +0 -0
- /package/src/components/Icon/components/{Alert.js → Alert.jsx} +0 -0
- /package/src/components/Icon/components/{AlignLeft.js → AlignLeft.jsx} +0 -0
- /package/src/components/Icon/components/{Back.js → Back.jsx} +0 -0
- /package/src/components/Icon/components/{BulletList.js → BulletList.jsx} +0 -0
- /package/src/components/Icon/components/{Button.js → Button.jsx} +0 -0
- /package/src/components/Icon/components/{Calendar.js → Calendar.jsx} +0 -0
- /package/src/components/Icon/components/{CancelEvent.js → CancelEvent.jsx} +0 -0
- /package/src/components/Icon/components/{Category.js → Category.jsx} +0 -0
- /package/src/components/Icon/components/{Change.js → Change.jsx} +0 -0
- /package/src/components/Icon/components/{Close.js → Close.jsx} +0 -0
- /package/src/components/Icon/components/{ClosePanel.js → ClosePanel.jsx} +0 -0
- /package/src/components/Icon/components/{CodeBody.js → CodeBody.jsx} +0 -0
- /package/src/components/Icon/components/{CodeHead.js → CodeHead.jsx} +0 -0
- /package/src/components/Icon/components/{CodeHeadBody.js → CodeHeadBody.jsx} +0 -0
- /package/src/components/Icon/components/{Collapsed.js → Collapsed.jsx} +0 -0
- /package/src/components/Icon/components/{ColorPicker.js → ColorPicker.jsx} +0 -0
- /package/src/components/Icon/components/{Compose.js → Compose.jsx} +0 -0
- /package/src/components/Icon/components/{Copy.js → Copy.jsx} +0 -0
- /package/src/components/Icon/components/{Copy2.js → Copy2.jsx} +0 -0
- /package/src/components/Icon/components/{Data.js → Data.jsx} +0 -0
- /package/src/components/Icon/components/{DataAdd.js → DataAdd.jsx} +0 -0
- /package/src/components/Icon/components/{Deactivate.js → Deactivate.jsx} +0 -0
- /package/src/components/Icon/components/{Delete.js → Delete.jsx} +0 -0
- /package/src/components/Icon/components/{Desktop.js → Desktop.jsx} +0 -0
- /package/src/components/Icon/components/{Disabled.js → Disabled.jsx} +0 -0
- /package/src/components/Icon/components/{Done.js → Done.jsx} +0 -0
- /package/src/components/Icon/components/{DownArrow.js → DownArrow.jsx} +0 -0
- /package/src/components/Icon/components/{Download.js → Download.jsx} +0 -0
- /package/src/components/Icon/components/{Drag.js → Drag.jsx} +0 -0
- /package/src/components/Icon/components/{Duplicate.js → Duplicate.jsx} +0 -0
- /package/src/components/Icon/components/{Edit.js → Edit.jsx} +0 -0
- /package/src/components/Icon/components/{Empty.js → Empty.jsx} +0 -0
- /package/src/components/Icon/components/{EmptyCheck.js → EmptyCheck.jsx} +0 -0
- /package/src/components/Icon/components/{Extend.js → Extend.jsx} +0 -0
- /package/src/components/Icon/components/{File.js → File.jsx} +0 -0
- /package/src/components/Icon/components/{Filter.js → Filter.jsx} +0 -0
- /package/src/components/Icon/components/{Form.js → Form.jsx} +0 -0
- /package/src/components/Icon/components/{FullArrowDown.js → FullArrowDown.jsx} +0 -0
- /package/src/components/Icon/components/{FullArrowLeft.js → FullArrowLeft.jsx} +0 -0
- /package/src/components/Icon/components/{FullArrowRight.js → FullArrowRight.jsx} +0 -0
- /package/src/components/Icon/components/{FullArrowUp.js → FullArrowUp.jsx} +0 -0
- /package/src/components/Icon/components/{Grid.js → Grid.jsx} +0 -0
- /package/src/components/Icon/components/{Grid2.js → Grid2.jsx} +0 -0
- /package/src/components/Icon/components/{GriddoLogo.js → GriddoLogo.jsx} +0 -0
- /package/src/components/Icon/components/{HeroCard.js → HeroCard.jsx} +0 -0
- /package/src/components/Icon/components/{Hide.js → Hide.jsx} +0 -0
- /package/src/components/Icon/components/{History.js → History.jsx} +0 -0
- /package/src/components/Icon/components/{Home.js → Home.jsx} +0 -0
- /package/src/components/Icon/components/{Ia.js → Ia.jsx} +0 -0
- /package/src/components/Icon/components/{Image.js → Image.jsx} +0 -0
- /package/src/components/Icon/components/{Info.js → Info.jsx} +0 -0
- /package/src/components/Icon/components/{Laptop.js → Laptop.jsx} +0 -0
- /package/src/components/Icon/components/{LeftArrow.js → LeftArrow.jsx} +0 -0
- /package/src/components/Icon/components/{Link.js → Link.jsx} +0 -0
- /package/src/components/Icon/components/{Lock.js → Lock.jsx} +0 -0
- /package/src/components/Icon/components/{Log.js → Log.jsx} +0 -0
- /package/src/components/Icon/components/{Map.js → Map.jsx} +0 -0
- /package/src/components/Icon/components/{Menu.js → Menu.jsx} +0 -0
- /package/src/components/Icon/components/{Microsoft.js → Microsoft.jsx} +0 -0
- /package/src/components/Icon/components/{Modified.js → Modified.jsx} +0 -0
- /package/src/components/Icon/components/{Modules.js → Modules.jsx} +0 -0
- /package/src/components/Icon/components/{More.js → More.jsx} +0 -0
- /package/src/components/Icon/components/{NewFolder.js → NewFolder.jsx} +0 -0
- /package/src/components/Icon/components/{Offline.js → Offline.jsx} +0 -0
- /package/src/components/Icon/components/{OfflinePending.js → OfflinePending.jsx} +0 -0
- /package/src/components/Icon/components/{OpenOutside.js → OpenOutside.jsx} +0 -0
- /package/src/components/Icon/components/{OpenPanel.js → OpenPanel.jsx} +0 -0
- /package/src/components/Icon/components/{OutOfSection.js → OutOfSection.jsx} +0 -0
- /package/src/components/Icon/components/{Page.js → Page.jsx} +0 -0
- /package/src/components/Icon/components/{Party.js → Party.jsx} +0 -0
- /package/src/components/Icon/components/{Paste.js → Paste.jsx} +0 -0
- /package/src/components/Icon/components/{Phone.js → Phone.jsx} +0 -0
- /package/src/components/Icon/components/{PhotoLibrary.js → PhotoLibrary.jsx} +0 -0
- /package/src/components/Icon/components/{Power.js → Power.jsx} +0 -0
- /package/src/components/Icon/components/{Preview.js → Preview.jsx} +0 -0
- /package/src/components/Icon/components/{Project.js → Project.jsx} +0 -0
- /package/src/components/Icon/components/{QrCode.js → QrCode.jsx} +0 -0
- /package/src/components/Icon/components/{Question.js → Question.jsx} +0 -0
- /package/src/components/Icon/components/{Refresh.js → Refresh.jsx} +0 -0
- /package/src/components/Icon/components/{Republish.js → Republish.jsx} +0 -0
- /package/src/components/Icon/components/{RightArrow.js → RightArrow.jsx} +0 -0
- /package/src/components/Icon/components/{Scheduled.js → Scheduled.jsx} +0 -0
- /package/src/components/Icon/components/{Search.js → Search.jsx} +0 -0
- /package/src/components/Icon/components/{SendEmail.js → SendEmail.jsx} +0 -0
- /package/src/components/Icon/components/{Settings.js → Settings.jsx} +0 -0
- /package/src/components/Icon/components/{Share.js → Share.jsx} +0 -0
- /package/src/components/Icon/components/{Subsection.js → Subsection.jsx} +0 -0
- /package/src/components/Icon/components/{Success.js → Success.jsx} +0 -0
- /package/src/components/Icon/components/{SuccessSolid.js → SuccessSolid.jsx} +0 -0
- /package/src/components/Icon/components/{Sync.js → Sync.jsx} +0 -0
- /package/src/components/Icon/components/{Tablet.js → Tablet.jsx} +0 -0
- /package/src/components/Icon/components/{Translate.js → Translate.jsx} +0 -0
- /package/src/components/Icon/components/{Unlink.js → Unlink.jsx} +0 -0
- /package/src/components/Icon/components/{UpArrow.js → UpArrow.jsx} +0 -0
- /package/src/components/Icon/components/{UploadFile.js → UploadFile.jsx} +0 -0
- /package/src/components/Icon/components/{UploadPending.js → UploadPending.jsx} +0 -0
- /package/src/components/Icon/components/{UrlLink.js → UrlLink.jsx} +0 -0
- /package/src/components/Icon/components/{User.js → User.jsx} +0 -0
- /package/src/components/Icon/components/{Users.js → Users.jsx} +0 -0
- /package/src/components/Icon/components/{Video.js → Video.jsx} +0 -0
- /package/src/components/Icon/components/{View.js → View.jsx} +0 -0
- /package/src/components/Icon/components/{Warning.js → Warning.jsx} +0 -0
- /package/src/components/Icon/components/{Web.js → Web.jsx} +0 -0
- /package/src/components/Icon/components/{Working.js → Working.jsx} +0 -0
- /package/src/components/Loader/components/{Circle.js → Circle.jsx} +0 -0
- /package/src/components/Loader/components/{Dots.js → Dots.jsx} +0 -0
- /package/src/components/Loader/components/{SmallCircle.js → SmallCircle.jsx} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Mock } from "vitest";
|
|
1
2
|
import { parseTheme } from "@ax/helpers";
|
|
2
3
|
import * as hooks from "@ax/hooks";
|
|
3
4
|
import FramePreview from "@ax/modules/FramePreview";
|
|
@@ -9,24 +10,24 @@ import configureStore from "redux-mock-store";
|
|
|
9
10
|
import thunk from "redux-thunk";
|
|
10
11
|
import { ThemeProvider } from "styled-components";
|
|
11
12
|
|
|
12
|
-
import { act, cleanup, render, screen } from "../../../../config/
|
|
13
|
+
import { act, cleanup, render, screen } from "../../../../config/tests/test-utils";
|
|
13
14
|
|
|
14
15
|
// Capture BrowserContent props so individual callback functions can be tested
|
|
15
16
|
const capturedBrowserContentProps: { current: Record<string, any> | null } = { current: null };
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
...
|
|
19
|
-
useURLSearchParam:
|
|
20
|
-
useOnMessageReceivedFromOutside:
|
|
21
|
-
useToast:
|
|
18
|
+
vi.mock("@ax/hooks", async () => ({
|
|
19
|
+
...(await vi.importActual("@ax/hooks")),
|
|
20
|
+
useURLSearchParam: vi.fn().mockReturnValue(null),
|
|
21
|
+
useOnMessageReceivedFromOutside: vi.fn(),
|
|
22
|
+
useToast: vi.fn().mockReturnValue({
|
|
22
23
|
isVisible: false,
|
|
23
|
-
toggleToast:
|
|
24
|
-
setIsVisible:
|
|
24
|
+
toggleToast: vi.fn(),
|
|
25
|
+
setIsVisible: vi.fn(),
|
|
25
26
|
state: "",
|
|
26
27
|
}),
|
|
27
28
|
}));
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
vi.mock("@ax/components", async () => {
|
|
30
31
|
const React = require("react");
|
|
31
32
|
return {
|
|
32
33
|
BrowserContent: (props: any) => {
|
|
@@ -38,20 +39,20 @@ jest.mock("@ax/components", () => {
|
|
|
38
39
|
};
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
observeAndAddIdsToHeadings:
|
|
43
|
-
observeAndHighlightKeywords:
|
|
42
|
+
vi.mock("@ax/modules/FramePreview/utils", async () => ({
|
|
43
|
+
observeAndAddIdsToHeadings: vi.fn().mockReturnValue(vi.fn()),
|
|
44
|
+
observeAndHighlightKeywords: vi.fn().mockReturnValue(vi.fn()),
|
|
44
45
|
}));
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
findByEditorID:
|
|
47
|
+
vi.mock("@ax/forms", async () => ({
|
|
48
|
+
findByEditorID: vi.fn().mockReturnValue({
|
|
48
49
|
element: { component: "Page", editorID: 5 },
|
|
49
50
|
parent: { parentEditorID: 0 },
|
|
50
51
|
}),
|
|
51
52
|
}));
|
|
52
53
|
|
|
53
54
|
// Mock action creators as plain functions to avoid thunk side-effects
|
|
54
|
-
|
|
55
|
+
vi.mock("@ax/containers/PageEditor", async () => ({
|
|
55
56
|
pageEditorActions: {
|
|
56
57
|
setSelectedContent: (id: number) => ({ type: "SET_SELECTED_CONTENT", payload: id }),
|
|
57
58
|
setEditorContent: (content: any) => ({ type: "SET_EDITOR_CONTENT", payload: content }),
|
|
@@ -61,7 +62,7 @@ jest.mock("@ax/containers/PageEditor", () => ({
|
|
|
61
62
|
},
|
|
62
63
|
}));
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
vi.mock("@ax/containers/Forms", async () => ({
|
|
65
66
|
formsActions: {
|
|
66
67
|
setSelectedContent: (id: number) => ({ type: "SET_FORM_SELECTED_CONTENT", payload: id }),
|
|
67
68
|
setFormContent: (content: any) => ({ type: "SET_FORM_CONTENT", payload: content }),
|
|
@@ -99,7 +100,23 @@ const renderFramePreview = async (store = buildStore()) => {
|
|
|
99
100
|
afterEach(() => {
|
|
100
101
|
cleanup();
|
|
101
102
|
capturedBrowserContentProps.current = null;
|
|
102
|
-
|
|
103
|
+
vi.restoreAllMocks();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Los valores por defecto se definen dentro de las factorías de `vi.mock`, que
|
|
107
|
+
// solo corren al cargar el módulo, mientras que el `restoreAllMocks` de arriba
|
|
108
|
+
// los borra tras cada test. Los tests que no fijan los suyos dependían de ser
|
|
109
|
+
// los primeros; aquí se rehacen antes de cada uno.
|
|
110
|
+
beforeEach(() => {
|
|
111
|
+
(hooks.useURLSearchParam as Mock).mockReturnValue(null);
|
|
112
|
+
(hooks.useToast as Mock).mockReturnValue({
|
|
113
|
+
isVisible: false,
|
|
114
|
+
toggleToast: vi.fn(),
|
|
115
|
+
setIsVisible: vi.fn(),
|
|
116
|
+
state: "",
|
|
117
|
+
});
|
|
118
|
+
(frameUtils.observeAndAddIdsToHeadings as Mock).mockReturnValue(vi.fn());
|
|
119
|
+
(frameUtils.observeAndHighlightKeywords as Mock).mockReturnValue(vi.fn());
|
|
103
120
|
});
|
|
104
121
|
|
|
105
122
|
describe("FramePreview rendering", () => {
|
|
@@ -122,7 +139,7 @@ describe("FramePreview rendering", () => {
|
|
|
122
139
|
});
|
|
123
140
|
|
|
124
141
|
it("should render HeadingsOverlay when type is 'headings'", async () => {
|
|
125
|
-
(hooks.useURLSearchParam as
|
|
142
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
126
143
|
if (param === "type") return "headings";
|
|
127
144
|
return null;
|
|
128
145
|
});
|
|
@@ -135,7 +152,7 @@ describe("FramePreview rendering", () => {
|
|
|
135
152
|
|
|
136
153
|
describe("FramePreview effects", () => {
|
|
137
154
|
it("should post iframe-mousemove message to parent on window mousemove", async () => {
|
|
138
|
-
const postMessageSpy =
|
|
155
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
139
156
|
|
|
140
157
|
await renderFramePreview();
|
|
141
158
|
|
|
@@ -150,7 +167,7 @@ describe("FramePreview effects", () => {
|
|
|
150
167
|
});
|
|
151
168
|
|
|
152
169
|
it("should set selectedID to '0' in localStorage when disabled param is true", async () => {
|
|
153
|
-
(hooks.useURLSearchParam as
|
|
170
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
154
171
|
if (param === "disabled") return "true";
|
|
155
172
|
return null;
|
|
156
173
|
});
|
|
@@ -161,7 +178,7 @@ describe("FramePreview effects", () => {
|
|
|
161
178
|
});
|
|
162
179
|
|
|
163
180
|
it("should call observeAndAddIdsToHeadings when type is 'headings'", async () => {
|
|
164
|
-
(hooks.useURLSearchParam as
|
|
181
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
165
182
|
if (param === "type") return "headings";
|
|
166
183
|
return null;
|
|
167
184
|
});
|
|
@@ -172,7 +189,7 @@ describe("FramePreview effects", () => {
|
|
|
172
189
|
});
|
|
173
190
|
|
|
174
191
|
it("should call observeAndHighlightKeywords when type is 'keywords'", async () => {
|
|
175
|
-
(hooks.useURLSearchParam as
|
|
192
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
176
193
|
if (param === "type") return "keywords";
|
|
177
194
|
return null;
|
|
178
195
|
});
|
|
@@ -185,7 +202,7 @@ describe("FramePreview effects", () => {
|
|
|
185
202
|
|
|
186
203
|
describe("FramePreview module actions", () => {
|
|
187
204
|
it("should post module-delete and dispatch deleteModule when deleteModuleAction is called", async () => {
|
|
188
|
-
const postMessageSpy =
|
|
205
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
189
206
|
|
|
190
207
|
await renderFramePreview();
|
|
191
208
|
|
|
@@ -195,7 +212,7 @@ describe("FramePreview module actions", () => {
|
|
|
195
212
|
});
|
|
196
213
|
|
|
197
214
|
it("should post module-duplicate when duplicateModuleAction is called", async () => {
|
|
198
|
-
const postMessageSpy =
|
|
215
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
199
216
|
|
|
200
217
|
await renderFramePreview();
|
|
201
218
|
|
|
@@ -205,14 +222,14 @@ describe("FramePreview module actions", () => {
|
|
|
205
222
|
});
|
|
206
223
|
|
|
207
224
|
it("should post module-copy and call toggleToast when copyModuleAction is called", async () => {
|
|
208
|
-
const toggleToastMock =
|
|
209
|
-
(hooks.useToast as
|
|
225
|
+
const toggleToastMock = vi.fn();
|
|
226
|
+
(hooks.useToast as Mock).mockReturnValue({
|
|
210
227
|
isVisible: false,
|
|
211
228
|
toggleToast: toggleToastMock,
|
|
212
|
-
setIsVisible:
|
|
229
|
+
setIsVisible: vi.fn(),
|
|
213
230
|
state: "",
|
|
214
231
|
});
|
|
215
|
-
const postMessageSpy =
|
|
232
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
216
233
|
|
|
217
234
|
await renderFramePreview();
|
|
218
235
|
|
|
@@ -225,19 +242,19 @@ describe("FramePreview module actions", () => {
|
|
|
225
242
|
|
|
226
243
|
describe("FramePreview editor ID selection", () => {
|
|
227
244
|
it("should post module-click when selectEditorID is called", async () => {
|
|
228
|
-
const postMessageSpy =
|
|
245
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
229
246
|
|
|
230
247
|
await renderFramePreview();
|
|
231
248
|
|
|
232
249
|
const { selectEditorID } = capturedBrowserContentProps.current!;
|
|
233
|
-
const mockEvent = { stopPropagation:
|
|
250
|
+
const mockEvent = { stopPropagation: vi.fn() };
|
|
234
251
|
selectEditorID({ editorID: 1, component: "Page", type: "content", parentEditorID: 0 }, null, mockEvent);
|
|
235
252
|
|
|
236
253
|
expect(postMessageSpy).toHaveBeenCalledWith({ type: "module-click", message: 1 }, "*");
|
|
237
254
|
});
|
|
238
255
|
|
|
239
256
|
it("should post module-scroll when selectHoverEditorID is called and parent meets condition", async () => {
|
|
240
|
-
const postMessageSpy =
|
|
257
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
241
258
|
|
|
242
259
|
await renderFramePreview();
|
|
243
260
|
|
|
@@ -248,16 +265,16 @@ describe("FramePreview editor ID selection", () => {
|
|
|
248
265
|
});
|
|
249
266
|
|
|
250
267
|
it("should not post module-click when preview mode is active", async () => {
|
|
251
|
-
(hooks.useURLSearchParam as
|
|
268
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
252
269
|
if (param === "preview") return "true";
|
|
253
270
|
return null;
|
|
254
271
|
});
|
|
255
|
-
const postMessageSpy =
|
|
272
|
+
const postMessageSpy = vi.spyOn(window, "postMessage");
|
|
256
273
|
|
|
257
274
|
await renderFramePreview();
|
|
258
275
|
|
|
259
276
|
const { selectEditorID } = capturedBrowserContentProps.current!;
|
|
260
|
-
const mockEvent = { stopPropagation:
|
|
277
|
+
const mockEvent = { stopPropagation: vi.fn() };
|
|
261
278
|
selectEditorID({ editorID: 1, component: "Page", type: "content", parentEditorID: 0 }, null, mockEvent);
|
|
262
279
|
|
|
263
280
|
expect(postMessageSpy).not.toHaveBeenCalledWith(expect.objectContaining({ type: "module-click" }), "*");
|
|
@@ -266,10 +283,10 @@ describe("FramePreview editor ID selection", () => {
|
|
|
266
283
|
|
|
267
284
|
describe("FramePreview content modes", () => {
|
|
268
285
|
it("should render Toast when isVisible is true", async () => {
|
|
269
|
-
(hooks.useToast as
|
|
286
|
+
(hooks.useToast as Mock).mockReturnValueOnce({
|
|
270
287
|
isVisible: true,
|
|
271
|
-
toggleToast:
|
|
272
|
-
setIsVisible:
|
|
288
|
+
toggleToast: vi.fn(),
|
|
289
|
+
setIsVisible: vi.fn(),
|
|
273
290
|
state: "1 module copied to clipboard",
|
|
274
291
|
});
|
|
275
292
|
|
|
@@ -279,7 +296,7 @@ describe("FramePreview content modes", () => {
|
|
|
279
296
|
});
|
|
280
297
|
|
|
281
298
|
it("should use 'preview' renderer when preview param is true", async () => {
|
|
282
|
-
(hooks.useURLSearchParam as
|
|
299
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
283
300
|
if (param === "preview") return "true";
|
|
284
301
|
return null;
|
|
285
302
|
});
|
|
@@ -290,7 +307,7 @@ describe("FramePreview content modes", () => {
|
|
|
290
307
|
});
|
|
291
308
|
|
|
292
309
|
it("should pass filtered keywords to observeAndHighlightKeywords when keywordFilter param is set", async () => {
|
|
293
|
-
(hooks.useURLSearchParam as
|
|
310
|
+
(hooks.useURLSearchParam as Mock).mockImplementation((param: string) => {
|
|
294
311
|
if (param === "type") return "keywords";
|
|
295
312
|
if (param === "keywordFilter") return "seo";
|
|
296
313
|
return null;
|
|
@@ -13,7 +13,7 @@ beforeEach(() => {
|
|
|
13
13
|
let rafId = 0;
|
|
14
14
|
let processingRaf = false;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
vi.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => {
|
|
17
17
|
// Avoid infinite recursion by checking if we're already processing
|
|
18
18
|
if (!processingRaf) {
|
|
19
19
|
processingRaf = true;
|
|
@@ -26,13 +26,13 @@ beforeEach(() => {
|
|
|
26
26
|
return ++rafId;
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
vi.spyOn(window, "cancelAnimationFrame").mockImplementation(() => {});
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
afterEach(() => {
|
|
33
33
|
cleanup();
|
|
34
34
|
for (const el of document.querySelectorAll("h1, h2, h3, h4, h5, h6")) el.remove();
|
|
35
|
-
|
|
35
|
+
vi.restoreAllMocks();
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
describe("HeadingsOverlay rendering", () => {
|
|
@@ -47,7 +47,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
47
47
|
const h1 = document.createElement("h1");
|
|
48
48
|
h1.dataset.griddoid = "heading-1";
|
|
49
49
|
document.body.appendChild(h1);
|
|
50
|
-
|
|
50
|
+
vi.spyOn(h1, "getBoundingClientRect").mockReturnValue({
|
|
51
51
|
top: 10,
|
|
52
52
|
left: 10,
|
|
53
53
|
width: 200,
|
|
@@ -70,7 +70,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
70
70
|
const h2 = document.createElement("h2");
|
|
71
71
|
h2.dataset.griddoid = "heading-1";
|
|
72
72
|
document.body.appendChild(h2);
|
|
73
|
-
|
|
73
|
+
vi.spyOn(h2, "getBoundingClientRect").mockReturnValue({
|
|
74
74
|
top: 10,
|
|
75
75
|
left: 10,
|
|
76
76
|
width: 200,
|
|
@@ -103,7 +103,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
103
103
|
const h1 = document.createElement("h1");
|
|
104
104
|
h1.dataset.griddoid = "heading-1";
|
|
105
105
|
document.body.appendChild(h1);
|
|
106
|
-
|
|
106
|
+
vi.spyOn(h1, "getBoundingClientRect").mockReturnValue({
|
|
107
107
|
top: 10,
|
|
108
108
|
left: 10,
|
|
109
109
|
width: 200,
|
|
@@ -116,7 +116,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
116
116
|
} as DOMRect);
|
|
117
117
|
|
|
118
118
|
const originalGetComputedStyle = window.getComputedStyle.bind(window);
|
|
119
|
-
|
|
119
|
+
vi.spyOn(window, "getComputedStyle").mockImplementation((el) => {
|
|
120
120
|
if (el === h1) return { display: "none", visibility: "", opacity: "1" } as CSSStyleDeclaration;
|
|
121
121
|
return originalGetComputedStyle(el);
|
|
122
122
|
});
|
|
@@ -132,7 +132,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
132
132
|
const h1 = document.createElement("h1");
|
|
133
133
|
h1.dataset.griddoid = "heading-1";
|
|
134
134
|
document.body.appendChild(h1);
|
|
135
|
-
|
|
135
|
+
vi.spyOn(h1, "getBoundingClientRect").mockReturnValue({
|
|
136
136
|
top: 10,
|
|
137
137
|
left: 10,
|
|
138
138
|
width: 200,
|
|
@@ -145,7 +145,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
145
145
|
} as DOMRect);
|
|
146
146
|
|
|
147
147
|
const originalGetComputedStyle = window.getComputedStyle.bind(window);
|
|
148
|
-
|
|
148
|
+
vi.spyOn(window, "getComputedStyle").mockImplementation((el) => {
|
|
149
149
|
if (el === h1) return { display: "block", visibility: "visible", opacity: "0" } as CSSStyleDeclaration;
|
|
150
150
|
return originalGetComputedStyle(el);
|
|
151
151
|
});
|
|
@@ -161,7 +161,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
161
161
|
const h1 = document.createElement("h1");
|
|
162
162
|
h1.dataset.griddoid = "heading-1";
|
|
163
163
|
document.body.appendChild(h1);
|
|
164
|
-
|
|
164
|
+
vi.spyOn(h1, "getBoundingClientRect").mockReturnValue({
|
|
165
165
|
top: 10,
|
|
166
166
|
left: 10,
|
|
167
167
|
width: 200,
|
|
@@ -176,7 +176,7 @@ describe("HeadingsOverlay rendering", () => {
|
|
|
176
176
|
const h2 = document.createElement("h2");
|
|
177
177
|
h2.dataset.griddoid = "heading-2";
|
|
178
178
|
document.body.appendChild(h2);
|
|
179
|
-
|
|
179
|
+
vi.spyOn(h2, "getBoundingClientRect").mockReturnValue({
|
|
180
180
|
top: 60,
|
|
181
181
|
left: 10,
|
|
182
182
|
width: 200,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ThemeProvider } from "styled-components";
|
|
3
3
|
import { parseTheme } from "@ax/helpers";
|
|
4
|
-
import { mock } from "
|
|
4
|
+
import { mock } from "vitest-mock-extended";
|
|
5
5
|
import configureStore from "redux-mock-store";
|
|
6
6
|
import thunk from "redux-thunk";
|
|
7
7
|
import { Router } from "react-router-dom";
|
|
@@ -9,7 +9,7 @@ import { Router } from "react-router-dom";
|
|
|
9
9
|
import history from "@ax/routes/history";
|
|
10
10
|
import globalTheme from "@ax/themes/theme.json";
|
|
11
11
|
import Integrations, { IIntegrationsProps } from "@ax/modules/Settings/Integrations";
|
|
12
|
-
import { render, cleanup, screen, act } from "../../../../../config/
|
|
12
|
+
import { render, cleanup, screen, act } from "../../../../../config/tests/test-utils";
|
|
13
13
|
|
|
14
14
|
afterEach(cleanup);
|
|
15
15
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import axios from "axios";
|
|
2
3
|
import { Router } from "react-router-dom";
|
|
3
4
|
|
|
@@ -10,10 +11,10 @@ import Social from "@ax/modules/Settings/Social";
|
|
|
10
11
|
import history from "@ax/routes/history";
|
|
11
12
|
import globalTheme from "@ax/themes/theme.json";
|
|
12
13
|
|
|
13
|
-
import { act, cleanup, render, screen } from "../../../../../config/
|
|
14
|
+
import { act, cleanup, render, screen } from "../../../../../config/tests/test-utils";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
const mockedAxios = axios as
|
|
16
|
+
vi.mock("axios");
|
|
17
|
+
const mockedAxios = axios as MockedFunction<typeof axios>;
|
|
17
18
|
|
|
18
19
|
beforeEach(() => {
|
|
19
20
|
mockedAxios.mockResolvedValue({ status: 200, data: {}, statusText: "OK", headers: {}, config: {} as any });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import { Router } from "react-router-dom";
|
|
2
3
|
|
|
3
4
|
import { parseTheme } from "@ax/helpers";
|
|
@@ -6,18 +7,18 @@ import { history } from "@ax/routes";
|
|
|
6
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
7
8
|
|
|
8
9
|
import axios from "axios";
|
|
9
|
-
import { mock } from "
|
|
10
|
+
import { mock } from "vitest-mock-extended";
|
|
10
11
|
import configureStore from "redux-mock-store";
|
|
11
12
|
import thunk from "redux-thunk";
|
|
12
13
|
import { ThemeProvider } from "styled-components";
|
|
13
14
|
|
|
14
|
-
import { act, cleanup, render, screen } from "../../../../config/
|
|
15
|
+
import { act, cleanup, render, screen } from "../../../../config/tests/test-utils";
|
|
15
16
|
import { structuredDataResponse } from "./../../../__mocks__/axios/SitesList";
|
|
16
17
|
import { sitesDataMock, userDataMock } from "./../../../__mocks__/store/SitesList";
|
|
17
18
|
|
|
18
19
|
afterEach(cleanup);
|
|
19
|
-
|
|
20
|
-
const mockedAxios = axios as
|
|
20
|
+
vi.mock("axios");
|
|
21
|
+
const mockedAxios = axios as MockedFunction<typeof axios>;
|
|
21
22
|
|
|
22
23
|
const mockStore = configureStore([thunk]);
|
|
23
24
|
const defaultProps = mock<ISitesProps>();
|
|
@@ -6,39 +6,46 @@ import BulkHeader from "@ax/modules/Sites/SitesList/ListView/BulkHeader";
|
|
|
6
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
7
7
|
|
|
8
8
|
import { act, cleanup, screen } from "@testing-library/react";
|
|
9
|
-
import { mock } from "
|
|
9
|
+
import { mock } from "vitest-mock-extended";
|
|
10
10
|
import configureStore from "redux-mock-store";
|
|
11
11
|
import thunk from "redux-thunk";
|
|
12
12
|
import { ThemeProvider } from "styled-components";
|
|
13
13
|
|
|
14
|
-
import { render } from "../../../../../../../config/
|
|
14
|
+
import { render } from "../../../../../../../config/tests/test-utils";
|
|
15
15
|
import { defaultStore } from "./../../../../../../__mocks__/store/GenericStore";
|
|
16
16
|
|
|
17
17
|
afterEach(cleanup);
|
|
18
18
|
|
|
19
19
|
const store = configureStore([thunk])(defaultStore);
|
|
20
|
-
|
|
20
|
+
// El escenario base es el que el primer test dejaba en el objeto compartido y
|
|
21
|
+
// del que el segundo dependía sin declararlo.
|
|
22
|
+
const makeProps = (overrides: Partial<IBulkHeaderProps> = {}): IBulkHeaderProps =>
|
|
23
|
+
Object.assign(
|
|
24
|
+
mock<IBulkHeaderProps>(),
|
|
25
|
+
{
|
|
26
|
+
showBulk: false,
|
|
27
|
+
checkState: { isAllSelected: false, indeterminate: false },
|
|
28
|
+
filterValues: {
|
|
29
|
+
order: [{ value: "lastAccess-desc", label: "lastAccess-desc" }],
|
|
30
|
+
liveStatus: [{ value: "all", label: "All" }],
|
|
31
|
+
},
|
|
32
|
+
sortedListStatus: {
|
|
33
|
+
isAscending: false,
|
|
34
|
+
sortedByTitle: false,
|
|
35
|
+
sortedByLastAccess: true,
|
|
36
|
+
sortedByDateCreated: false,
|
|
37
|
+
},
|
|
38
|
+
totalItems: 22,
|
|
39
|
+
},
|
|
40
|
+
overrides,
|
|
41
|
+
);
|
|
21
42
|
|
|
22
43
|
describe("BulkHeader component rendering", () => {
|
|
23
44
|
it("should render table header", async () => {
|
|
24
|
-
defaultProps.showBulk = false;
|
|
25
|
-
defaultProps.checkState = { isAllSelected: false, indeterminate: false };
|
|
26
|
-
defaultProps.filterValues = {
|
|
27
|
-
order: [{ value: "lastAccess-desc", label: "lastAccess-desc" }],
|
|
28
|
-
liveStatus: [{ value: "all", label: "All" }],
|
|
29
|
-
};
|
|
30
|
-
defaultProps.sortedListStatus = {
|
|
31
|
-
isAscending: false,
|
|
32
|
-
sortedByTitle: false,
|
|
33
|
-
sortedByLastAccess: true,
|
|
34
|
-
sortedByDateCreated: false,
|
|
35
|
-
};
|
|
36
|
-
defaultProps.totalItems = 22;
|
|
37
|
-
|
|
38
45
|
await act(async () => {
|
|
39
46
|
render(
|
|
40
47
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
41
|
-
<BulkHeader {...
|
|
48
|
+
<BulkHeader {...makeProps({ showBulk: false })} />
|
|
42
49
|
</ThemeProvider>,
|
|
43
50
|
{ store },
|
|
44
51
|
);
|
|
@@ -48,12 +55,10 @@ describe("BulkHeader component rendering", () => {
|
|
|
48
55
|
});
|
|
49
56
|
|
|
50
57
|
it("should render bulk header", async () => {
|
|
51
|
-
defaultProps.showBulk = true;
|
|
52
|
-
|
|
53
58
|
await act(async () => {
|
|
54
59
|
render(
|
|
55
60
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
56
|
-
<BulkHeader {...
|
|
61
|
+
<BulkHeader {...makeProps({ showBulk: true })} />
|
|
57
62
|
</ThemeProvider>,
|
|
58
63
|
{ store },
|
|
59
64
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import { Router } from "react-router-dom";
|
|
2
3
|
|
|
3
4
|
import { parseTheme } from "@ax/helpers";
|
|
@@ -6,12 +7,12 @@ import { history } from "@ax/routes";
|
|
|
6
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
7
8
|
|
|
8
9
|
import axios from "axios";
|
|
9
|
-
import { mock } from "
|
|
10
|
+
import { mock } from "vitest-mock-extended";
|
|
10
11
|
import configureStore from "redux-mock-store";
|
|
11
12
|
import thunk from "redux-thunk";
|
|
12
13
|
import { ThemeProvider } from "styled-components";
|
|
13
14
|
|
|
14
|
-
import { act, cleanup, fireEvent, render, screen, waitFor } from "./../../../../../config/
|
|
15
|
+
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "./../../../../../config/tests/test-utils";
|
|
15
16
|
import { sitesResponse } from "./../../../../__mocks__/axios/SitesList";
|
|
16
17
|
import { sitesOptions } from "./../../../../__mocks__/axios/SitesListOptions";
|
|
17
18
|
import { sitesDataMock, sitesDataNoThumbnailMock, userDataMock } from "./../../../../__mocks__/store/SitesList";
|
|
@@ -19,8 +20,8 @@ import { sitesDataMock, sitesDataNoThumbnailMock, userDataMock } from "./../../.
|
|
|
19
20
|
afterEach(cleanup);
|
|
20
21
|
|
|
21
22
|
const defaultProps = mock<ISitesListProps>();
|
|
22
|
-
|
|
23
|
-
const mockedAxios = axios as
|
|
23
|
+
vi.mock("axios");
|
|
24
|
+
const mockedAxios = axios as MockedFunction<typeof axios>;
|
|
24
25
|
|
|
25
26
|
const mockStore = configureStore([thunk]);
|
|
26
27
|
|
|
@@ -58,6 +59,15 @@ const renderSitesList = async (storeData: any = initialStore) => {
|
|
|
58
59
|
|
|
59
60
|
beforeEach(() => {
|
|
60
61
|
mockedAxios.mockResolvedValue(sitesResponse);
|
|
62
|
+
// Tres cosas sobreviven al test que las toca y hacían que el resto solo
|
|
63
|
+
// funcionase en un orden concreto: el `history` de @ax/routes es un
|
|
64
|
+
// singleton y los tests de navegación lo dejaban en /sites/pages; SitesList
|
|
65
|
+
// guarda el modo de vista en localStorage, así que el siguiente test
|
|
66
|
+
// arrancaba en la vista equivocada y no encontraba los testids `grid-*`; y
|
|
67
|
+
// el parche de scrollTo se hacía sobre el prototipo dentro de dos tests.
|
|
68
|
+
history.replace("/");
|
|
69
|
+
localStorage.clear();
|
|
70
|
+
window.HTMLElement.prototype.scrollTo = vi.fn();
|
|
61
71
|
});
|
|
62
72
|
|
|
63
73
|
describe("Sites module rendering", () => {
|
|
@@ -197,8 +207,6 @@ describe("Sites module events", () => {
|
|
|
197
207
|
});
|
|
198
208
|
|
|
199
209
|
it("should go to site on click recent site item", async () => {
|
|
200
|
-
window.HTMLElement.prototype.scrollTo = jest.fn();
|
|
201
|
-
|
|
202
210
|
await renderSitesList();
|
|
203
211
|
|
|
204
212
|
const recentSiteItems = screen.getAllByTestId("recent-sites-item");
|
|
@@ -223,8 +231,6 @@ describe("Sites module events", () => {
|
|
|
223
231
|
});
|
|
224
232
|
|
|
225
233
|
it("should go to site on click list site item", async () => {
|
|
226
|
-
window.HTMLElement.prototype.scrollTo = jest.fn();
|
|
227
|
-
|
|
228
234
|
await renderSitesList();
|
|
229
235
|
|
|
230
236
|
const gridIconAction = screen.getByTestId("icon-action-Grid2");
|
|
@@ -237,7 +243,11 @@ describe("Sites module events", () => {
|
|
|
237
243
|
const listSitesItems = screen.getAllByTestId("list-site-item");
|
|
238
244
|
expect(listSitesItems.length).toEqual(2);
|
|
239
245
|
|
|
240
|
-
|
|
246
|
+
// La fila solo tiene onContextMenu; navegan las celdas. Antes se pulsaba la
|
|
247
|
+
// fila y no pasaba nada: la aserción se cumplía porque otro test había
|
|
248
|
+
// dejado ya el history en /sites/pages.
|
|
249
|
+
const nameCell = within(listSitesItems[0]).getAllByRole("cell")[2];
|
|
250
|
+
fireEvent.click(nameCell);
|
|
241
251
|
await waitFor(() => expect(history.location.pathname).toEqual("/sites/pages"));
|
|
242
252
|
});
|
|
243
253
|
|
|
@@ -21,9 +21,9 @@ const renderDataStep = (props = {}) =>
|
|
|
21
21
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
22
22
|
<DataStep
|
|
23
23
|
form={defaultForm}
|
|
24
|
-
setForm={
|
|
25
|
-
onClickNext={
|
|
26
|
-
onClickBack={
|
|
24
|
+
setForm={vi.fn()}
|
|
25
|
+
onClickNext={vi.fn()}
|
|
26
|
+
onClickBack={vi.fn()}
|
|
27
27
|
croppedImageUrl={null}
|
|
28
28
|
{...props}
|
|
29
29
|
/>
|
|
@@ -66,21 +66,21 @@ describe("DataStep rendering", () => {
|
|
|
66
66
|
|
|
67
67
|
describe("DataStep events", () => {
|
|
68
68
|
it("should call onClickBack when Back button is clicked", () => {
|
|
69
|
-
const onClickBack =
|
|
69
|
+
const onClickBack = vi.fn();
|
|
70
70
|
renderDataStep({ onClickBack });
|
|
71
71
|
fireEvent.click(screen.getByText("Back"));
|
|
72
72
|
expect(onClickBack).toHaveBeenCalledTimes(1);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it("should call onClickNext when Next step button is clicked", () => {
|
|
76
|
-
const onClickNext =
|
|
76
|
+
const onClickNext = vi.fn();
|
|
77
77
|
renderDataStep({ onClickNext });
|
|
78
78
|
fireEvent.click(screen.getByText("Next step"));
|
|
79
79
|
expect(onClickNext).toHaveBeenCalledTimes(1);
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
it("should not call onClickNext when username is empty", () => {
|
|
83
|
-
const onClickNext =
|
|
83
|
+
const onClickNext = vi.fn();
|
|
84
84
|
renderDataStep({ onClickNext, form: { ...defaultForm, username: "" } });
|
|
85
85
|
const nextButton = screen.getByText("Next step").closest("button");
|
|
86
86
|
nextButton && fireEvent.click(nextButton);
|
|
@@ -68,8 +68,8 @@ const renderFinalStep = (props = {}) =>
|
|
|
68
68
|
userRoles={[]}
|
|
69
69
|
roles={mockRoles}
|
|
70
70
|
sites={mockSites}
|
|
71
|
-
onClose={
|
|
72
|
-
onViewProfile={
|
|
71
|
+
onClose={vi.fn()}
|
|
72
|
+
onViewProfile={vi.fn()}
|
|
73
73
|
{...props}
|
|
74
74
|
/>
|
|
75
75
|
</ThemeProvider>,
|
|
@@ -142,14 +142,14 @@ describe("FinalStep learn items", () => {
|
|
|
142
142
|
|
|
143
143
|
describe("FinalStep events", () => {
|
|
144
144
|
it("should call onClose when Start Using Griddo is clicked", () => {
|
|
145
|
-
const onClose =
|
|
145
|
+
const onClose = vi.fn();
|
|
146
146
|
renderFinalStep({ onClose });
|
|
147
147
|
fireEvent.click(screen.getByText("Start Using Griddo"));
|
|
148
148
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
it("should call onViewProfile when View profile is clicked", () => {
|
|
152
|
-
const onViewProfile =
|
|
152
|
+
const onViewProfile = vi.fn();
|
|
153
153
|
renderFinalStep({ onViewProfile });
|
|
154
154
|
fireEvent.click(screen.getByText("View profile"));
|
|
155
155
|
expect(onViewProfile).toHaveBeenCalledTimes(1);
|
package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/CropView.test.tsx
CHANGED
|
@@ -10,7 +10,7 @@ afterEach(cleanup);
|
|
|
10
10
|
const renderCropView = (props = {}) =>
|
|
11
11
|
render(
|
|
12
12
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
13
|
-
<CropView imageSrc="data:image/jpeg;base64,abc" onConfirm={
|
|
13
|
+
<CropView imageSrc="data:image/jpeg;base64,abc" onConfirm={vi.fn()} onUploadNew={vi.fn()} {...props} />
|
|
14
14
|
</ThemeProvider>,
|
|
15
15
|
);
|
|
16
16
|
|
|
@@ -36,14 +36,14 @@ describe("CropView rendering", () => {
|
|
|
36
36
|
|
|
37
37
|
describe("CropView events", () => {
|
|
38
38
|
it("should call onConfirm with cropped area when Next step is clicked", () => {
|
|
39
|
-
const onConfirm =
|
|
39
|
+
const onConfirm = vi.fn();
|
|
40
40
|
renderCropView({ onConfirm });
|
|
41
41
|
fireEvent.click(screen.getByText("Next step"));
|
|
42
42
|
expect(onConfirm).toHaveBeenCalledWith({ x: 0, y: 0, width: 100, height: 100 });
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it("should call onUploadNew when Upload new image is clicked", () => {
|
|
46
|
-
const onUploadNew =
|
|
46
|
+
const onUploadNew = vi.fn();
|
|
47
47
|
renderCropView({ onUploadNew });
|
|
48
48
|
fireEvent.click(screen.getByText("Upload new image"));
|
|
49
49
|
expect(onUploadNew).toHaveBeenCalledTimes(1);
|