@griddo/ax 12.3.0 → 12.4.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/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 +7 -6
- package/src/__tests__/components/ConfigPanel/GlobalPageForm/GlobalPageForm.test.tsx +11 -11
- package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +11 -10
- 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 +1 -1
- package/src/__tests__/components/EmptyState/EmptyState.test.tsx +2 -2
- 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 +4 -3
- 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 +7 -6
- 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 +55 -55
- 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 +4 -4
- 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 +8 -7
- package/src/__tests__/components/Fields/IntegrationsField/IntegrationsField.test.tsx +9 -8
- 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 +1 -1
- package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +8 -8
- 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 +13 -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 +2 -2
- package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +6 -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 +1 -1
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.atoms.test.tsx +11 -11
- 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 +15 -14
- 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 +10 -11
- 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 +25 -23
- 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 +11 -10
- 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 +9 -9
- 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 +8 -9
- package/src/__tests__/components/Tag/Tag.test.tsx +3 -3
- package/src/__tests__/components/Toast/Toast.test.tsx +6 -6
- 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 +40 -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 +2 -2
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +7 -6
- 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 +3 -3
- package/src/__tests__/modules/Users/Roles/Roles.test.tsx +11 -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/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/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 { MockedFunction } from "vitest";
|
|
1
2
|
import { useRef } from "react";
|
|
2
3
|
|
|
3
4
|
import { ThemeProvider } from "styled-components";
|
|
@@ -8,16 +9,16 @@ import "@testing-library/jest-dom";
|
|
|
8
9
|
import FloatingMenu, { type IFloatingProps } from "@ax/components/FloatingMenu";
|
|
9
10
|
import globalTheme from "@ax/themes/theme.json";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
const originReact =
|
|
13
|
-
const mUseRef =
|
|
12
|
+
vi.mock("react", async () => {
|
|
13
|
+
const originReact = await vi.importActual("react");
|
|
14
|
+
const mUseRef = vi.fn();
|
|
14
15
|
return {
|
|
15
16
|
...originReact,
|
|
16
17
|
useRef: mUseRef,
|
|
17
18
|
};
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
const useMockRef = useRef as
|
|
21
|
+
const useMockRef = useRef as MockedFunction<typeof useRef>;
|
|
21
22
|
|
|
22
23
|
afterEach(cleanup);
|
|
23
24
|
beforeEach(() => {
|
|
@@ -75,7 +76,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
75
76
|
Object.defineProperty(wrapperRef, "current", {
|
|
76
77
|
set(_current) {
|
|
77
78
|
if (_current) {
|
|
78
|
-
|
|
79
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
79
80
|
}
|
|
80
81
|
this._current = _current;
|
|
81
82
|
},
|
|
@@ -86,7 +87,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
86
87
|
Object.defineProperty(buttonRef, "current", {
|
|
87
88
|
set(_current) {
|
|
88
89
|
if (_current) {
|
|
89
|
-
|
|
90
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
90
91
|
}
|
|
91
92
|
this._current = _current;
|
|
92
93
|
},
|
|
@@ -97,7 +98,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
97
98
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
98
99
|
set(_current) {
|
|
99
100
|
if (_current) {
|
|
100
|
-
|
|
101
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
101
102
|
}
|
|
102
103
|
this._current = _current;
|
|
103
104
|
},
|
|
@@ -155,7 +156,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
155
156
|
Object.defineProperty(wrapperRef, "current", {
|
|
156
157
|
set(_current) {
|
|
157
158
|
if (_current) {
|
|
158
|
-
|
|
159
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
159
160
|
}
|
|
160
161
|
this._current = _current;
|
|
161
162
|
},
|
|
@@ -166,7 +167,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
166
167
|
Object.defineProperty(buttonRef, "current", {
|
|
167
168
|
set(_current) {
|
|
168
169
|
if (_current) {
|
|
169
|
-
|
|
170
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
170
171
|
}
|
|
171
172
|
this._current = _current;
|
|
172
173
|
},
|
|
@@ -177,7 +178,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
177
178
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
178
179
|
set(_current) {
|
|
179
180
|
if (_current) {
|
|
180
|
-
|
|
181
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
181
182
|
}
|
|
182
183
|
this._current = _current;
|
|
183
184
|
},
|
|
@@ -205,7 +206,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
205
206
|
Object.defineProperty(wrapperRef, "current", {
|
|
206
207
|
set(_current) {
|
|
207
208
|
if (_current) {
|
|
208
|
-
|
|
209
|
+
vi.spyOn(_current, "contains").mockReturnValue(false);
|
|
209
210
|
}
|
|
210
211
|
this._current = _current;
|
|
211
212
|
},
|
|
@@ -245,7 +246,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
245
246
|
Object.defineProperty(wrapperRef, "current", {
|
|
246
247
|
set(_current) {
|
|
247
248
|
if (_current) {
|
|
248
|
-
|
|
249
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
249
250
|
}
|
|
250
251
|
this._current = _current;
|
|
251
252
|
},
|
|
@@ -256,7 +257,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
256
257
|
Object.defineProperty(buttonRef, "current", {
|
|
257
258
|
set(_current) {
|
|
258
259
|
if (_current) {
|
|
259
|
-
|
|
260
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
260
261
|
}
|
|
261
262
|
this._current = _current;
|
|
262
263
|
},
|
|
@@ -267,7 +268,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
267
268
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
268
269
|
set(_current) {
|
|
269
270
|
if (_current) {
|
|
270
|
-
|
|
271
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
271
272
|
}
|
|
272
273
|
this._current = _current;
|
|
273
274
|
},
|
|
@@ -295,7 +296,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
295
296
|
Object.defineProperty(wrapperRef, "current", {
|
|
296
297
|
set(_current) {
|
|
297
298
|
if (_current) {
|
|
298
|
-
|
|
299
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
299
300
|
}
|
|
300
301
|
this._current = _current;
|
|
301
302
|
},
|
|
@@ -306,7 +307,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
306
307
|
Object.defineProperty(buttonRef, "current", {
|
|
307
308
|
set(_current) {
|
|
308
309
|
if (_current) {
|
|
309
|
-
|
|
310
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
310
311
|
}
|
|
311
312
|
this._current = _current;
|
|
312
313
|
},
|
|
@@ -317,7 +318,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
317
318
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
318
319
|
set(_current) {
|
|
319
320
|
if (_current) {
|
|
320
|
-
|
|
321
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
321
322
|
}
|
|
322
323
|
this._current = _current;
|
|
323
324
|
},
|
|
@@ -385,7 +386,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
385
386
|
Object.defineProperty(wrapperRef, "current", {
|
|
386
387
|
set(_current) {
|
|
387
388
|
if (_current) {
|
|
388
|
-
|
|
389
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
389
390
|
}
|
|
390
391
|
this._current = _current;
|
|
391
392
|
},
|
|
@@ -396,7 +397,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
396
397
|
Object.defineProperty(buttonRef, "current", {
|
|
397
398
|
set(_current) {
|
|
398
399
|
if (_current) {
|
|
399
|
-
|
|
400
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
400
401
|
}
|
|
401
402
|
this._current = _current;
|
|
402
403
|
},
|
|
@@ -407,7 +408,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
407
408
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
408
409
|
set(_current) {
|
|
409
410
|
if (_current) {
|
|
410
|
-
|
|
411
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
411
412
|
}
|
|
412
413
|
this._current = _current;
|
|
413
414
|
},
|
|
@@ -435,7 +436,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
435
436
|
Object.defineProperty(wrapperRef, "current", {
|
|
436
437
|
set(_current) {
|
|
437
438
|
if (_current) {
|
|
438
|
-
|
|
439
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
439
440
|
}
|
|
440
441
|
this._current = _current;
|
|
441
442
|
},
|
|
@@ -446,7 +447,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
446
447
|
Object.defineProperty(buttonRef, "current", {
|
|
447
448
|
set(_current) {
|
|
448
449
|
if (_current) {
|
|
449
|
-
|
|
450
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
450
451
|
}
|
|
451
452
|
this._current = _current;
|
|
452
453
|
},
|
|
@@ -457,7 +458,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
457
458
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
458
459
|
set(_current) {
|
|
459
460
|
if (_current) {
|
|
460
|
-
|
|
461
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
461
462
|
}
|
|
462
463
|
this._current = _current;
|
|
463
464
|
},
|
|
@@ -532,7 +533,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
532
533
|
Object.defineProperty(wrapperRef, "current", {
|
|
533
534
|
set(_current) {
|
|
534
535
|
if (_current) {
|
|
535
|
-
|
|
536
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
536
537
|
}
|
|
537
538
|
this._current = _current;
|
|
538
539
|
},
|
|
@@ -543,7 +544,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
543
544
|
Object.defineProperty(buttonRef, "current", {
|
|
544
545
|
set(_current) {
|
|
545
546
|
if (_current) {
|
|
546
|
-
|
|
547
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
547
548
|
}
|
|
548
549
|
this._current = _current;
|
|
549
550
|
},
|
|
@@ -554,7 +555,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
554
555
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
555
556
|
set(_current) {
|
|
556
557
|
if (_current) {
|
|
557
|
-
|
|
558
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
558
559
|
}
|
|
559
560
|
this._current = _current;
|
|
560
561
|
},
|
|
@@ -601,7 +602,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
601
602
|
Object.defineProperty(wrapperRef, "current", {
|
|
602
603
|
set(_current) {
|
|
603
604
|
if (_current) {
|
|
604
|
-
|
|
605
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
605
606
|
}
|
|
606
607
|
this._current = _current;
|
|
607
608
|
},
|
|
@@ -612,7 +613,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
612
613
|
Object.defineProperty(buttonRef, "current", {
|
|
613
614
|
set(_current) {
|
|
614
615
|
if (_current) {
|
|
615
|
-
|
|
616
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
616
617
|
}
|
|
617
618
|
this._current = _current;
|
|
618
619
|
},
|
|
@@ -623,7 +624,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
623
624
|
Object.defineProperty(menuOptionsRef, "current", {
|
|
624
625
|
set(_current) {
|
|
625
626
|
if (_current) {
|
|
626
|
-
|
|
627
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(false);
|
|
627
628
|
}
|
|
628
629
|
this._current = _current;
|
|
629
630
|
},
|
|
@@ -675,7 +676,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
675
676
|
Object.defineProperty(wrapperRef, "current", {
|
|
676
677
|
set(_current) {
|
|
677
678
|
if (_current) {
|
|
678
|
-
|
|
679
|
+
vi.spyOn(_current, "contains").mockReturnValue(true);
|
|
679
680
|
}
|
|
680
681
|
this._current = _current;
|
|
681
682
|
},
|
|
@@ -687,7 +688,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
687
688
|
set(_current) {
|
|
688
689
|
if (_current) {
|
|
689
690
|
// true for button click (open), false for option click
|
|
690
|
-
|
|
691
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true).mockReturnValueOnce(false);
|
|
691
692
|
}
|
|
692
693
|
this._current = _current;
|
|
693
694
|
},
|
|
@@ -699,7 +700,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
699
700
|
set(_current) {
|
|
700
701
|
if (_current) {
|
|
701
702
|
// true when clicking menu-children (optionWasSelected)
|
|
702
|
-
|
|
703
|
+
vi.spyOn(_current, "contains").mockReturnValueOnce(true);
|
|
703
704
|
}
|
|
704
705
|
this._current = _current;
|
|
705
706
|
},
|
|
@@ -778,7 +779,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
778
779
|
});
|
|
779
780
|
|
|
780
781
|
it("should call actionOnClose when clicking outside", () => {
|
|
781
|
-
const actionOnClose =
|
|
782
|
+
const actionOnClose = vi.fn();
|
|
782
783
|
const buttonContent = () => <span>trigger</span>;
|
|
783
784
|
|
|
784
785
|
const defaultProps: IFloatingProps = {
|
|
@@ -806,7 +807,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
806
807
|
});
|
|
807
808
|
|
|
808
809
|
it("should call actionOnClose when closing via button toggle", () => {
|
|
809
|
-
const actionOnClose =
|
|
810
|
+
const actionOnClose = vi.fn();
|
|
810
811
|
const buttonContent = () => <span>trigger</span>;
|
|
811
812
|
|
|
812
813
|
const defaultProps: IFloatingProps = {
|
|
@@ -833,7 +834,7 @@ describe("FloatingMenu component rendering", () => {
|
|
|
833
834
|
});
|
|
834
835
|
|
|
835
836
|
it("should call actionOnClose when closing via mouseLeave", () => {
|
|
836
|
-
const actionOnClose =
|
|
837
|
+
const actionOnClose = vi.fn();
|
|
837
838
|
const buttonContent = () => <span>trigger</span>;
|
|
838
839
|
|
|
839
840
|
const defaultProps: IFloatingProps = {
|
|
@@ -17,8 +17,8 @@ describe("FloatingPanel component rendering", () => {
|
|
|
17
17
|
isOpenedSecond: false,
|
|
18
18
|
children: false,
|
|
19
19
|
title: "title",
|
|
20
|
-
toggleModal:
|
|
21
|
-
handlePanel:
|
|
20
|
+
toggleModal: vi.fn(),
|
|
21
|
+
handlePanel: vi.fn(),
|
|
22
22
|
secondary: true,
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -38,8 +38,8 @@ describe("FloatingPanel component rendering", () => {
|
|
|
38
38
|
isOpenedSecond: false,
|
|
39
39
|
children: false,
|
|
40
40
|
title: "title",
|
|
41
|
-
toggleModal:
|
|
42
|
-
handlePanel:
|
|
41
|
+
toggleModal: vi.fn(),
|
|
42
|
+
handlePanel: vi.fn(),
|
|
43
43
|
secondary: true,
|
|
44
44
|
closeOnOutsideClick: false,
|
|
45
45
|
};
|
|
@@ -59,8 +59,8 @@ describe("FloatingPanel component rendering", () => {
|
|
|
59
59
|
|
|
60
60
|
describe("FloatingPanel component events trigger", () => {
|
|
61
61
|
it("should trigger the handleOnClick", () => {
|
|
62
|
-
const handlePanelMock =
|
|
63
|
-
const toggleModalMock =
|
|
62
|
+
const handlePanelMock = vi.fn();
|
|
63
|
+
const toggleModalMock = vi.fn();
|
|
64
64
|
const defaultProps: IFloatingPanelProps = {
|
|
65
65
|
isOpen: true,
|
|
66
66
|
isOpenedSecond: false,
|
|
@@ -88,8 +88,8 @@ describe("FloatingPanel component events trigger", () => {
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
it("should trigger the handleClickOutside and trigger handlePanel", () => {
|
|
91
|
-
const handlePanelMock =
|
|
92
|
-
const toggleModalMock =
|
|
91
|
+
const handlePanelMock = vi.fn();
|
|
92
|
+
const toggleModalMock = vi.fn();
|
|
93
93
|
const defaultProps: IFloatingPanelProps = {
|
|
94
94
|
isOpen: true,
|
|
95
95
|
isOpenedSecond: false,
|
|
@@ -118,8 +118,8 @@ describe("FloatingPanel component events trigger", () => {
|
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it("should trigger the handleClickOutside and not trigger handlePanel", () => {
|
|
121
|
-
const handlePanelMock =
|
|
122
|
-
const toggleModalMock =
|
|
121
|
+
const handlePanelMock = vi.fn();
|
|
122
|
+
const toggleModalMock = vi.fn();
|
|
123
123
|
const defaultProps: IFloatingPanelProps = {
|
|
124
124
|
isOpen: true,
|
|
125
125
|
isOpenedSecond: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
|
-
import { mock } from "
|
|
4
|
+
import { mock } from "vitest-mock-extended";
|
|
5
5
|
import { render, cleanup, screen } from "@testing-library/react";
|
|
6
6
|
import { parseTheme } from "@ax/helpers";
|
|
7
7
|
import "@testing-library/jest-dom";
|
package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/ErrorItem.test.tsx
CHANGED
|
@@ -19,9 +19,9 @@ const mockError: IHeadingError = {
|
|
|
19
19
|
|
|
20
20
|
const defaultProps = {
|
|
21
21
|
error: mockError,
|
|
22
|
-
onSelectHeading:
|
|
23
|
-
onDelete:
|
|
24
|
-
onNavigateHeading:
|
|
22
|
+
onSelectHeading: vi.fn(() => vi.fn()),
|
|
23
|
+
onDelete: vi.fn(),
|
|
24
|
+
onNavigateHeading: vi.fn(),
|
|
25
25
|
parentIsOpen: true,
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -75,7 +75,7 @@ describe("ErrorItem component rendering", () => {
|
|
|
75
75
|
|
|
76
76
|
describe("ErrorItem component events", () => {
|
|
77
77
|
it("should call onSelectHeading when the open button is clicked", () => {
|
|
78
|
-
const onSelectHeadingMock =
|
|
78
|
+
const onSelectHeadingMock = vi.fn(() => vi.fn());
|
|
79
79
|
renderComponent({ ...defaultProps, onSelectHeading: onSelectHeadingMock });
|
|
80
80
|
|
|
81
81
|
const buttons = screen.getAllByRole("button");
|
|
@@ -95,7 +95,7 @@ describe("ErrorItem component events", () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
it("should call onSelectHeading with first heading ID when next button is clicked", () => {
|
|
98
|
-
const onSelectHeadingMock =
|
|
98
|
+
const onSelectHeadingMock = vi.fn(() => vi.fn());
|
|
99
99
|
renderComponent({ ...defaultProps, onSelectHeading: onSelectHeadingMock });
|
|
100
100
|
|
|
101
101
|
const buttons = screen.getAllByRole("button");
|
|
@@ -116,7 +116,7 @@ describe("ErrorItem component events", () => {
|
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
it("should call onSelectHeading with previous heading ID when prev button is clicked", () => {
|
|
119
|
-
const onSelectHeadingMock =
|
|
119
|
+
const onSelectHeadingMock = vi.fn(() => vi.fn());
|
|
120
120
|
renderComponent({ ...defaultProps, onSelectHeading: onSelectHeadingMock });
|
|
121
121
|
|
|
122
122
|
const buttons = screen.getAllByRole("button");
|
|
@@ -124,27 +124,27 @@ describe("ErrorItem component events", () => {
|
|
|
124
124
|
fireEvent.click(buttons[3]);
|
|
125
125
|
fireEvent.click(buttons[3]);
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
vi.clearAllMocks();
|
|
128
128
|
fireEvent.click(buttons[2]);
|
|
129
129
|
|
|
130
130
|
expect(onSelectHeadingMock).toBeCalledWith(mockError.headingIds[0]);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it("should not navigate prev when already at the first heading", () => {
|
|
134
|
-
const onSelectHeadingMock =
|
|
134
|
+
const onSelectHeadingMock = vi.fn(() => vi.fn());
|
|
135
135
|
renderComponent({ ...defaultProps, onSelectHeading: onSelectHeadingMock });
|
|
136
136
|
|
|
137
137
|
const buttons = screen.getAllByRole("button");
|
|
138
138
|
// Open sets currentIndex to 0, then try to go prev
|
|
139
139
|
fireEvent.click(buttons[0]);
|
|
140
|
-
|
|
140
|
+
vi.clearAllMocks();
|
|
141
141
|
fireEvent.click(buttons[2]);
|
|
142
142
|
|
|
143
143
|
expect(onSelectHeadingMock).not.toBeCalled();
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
it("should not navigate next when already at the last heading", () => {
|
|
147
|
-
const onSelectHeadingMock =
|
|
147
|
+
const onSelectHeadingMock = vi.fn(() => vi.fn());
|
|
148
148
|
renderComponent({ ...defaultProps, onSelectHeading: onSelectHeadingMock });
|
|
149
149
|
|
|
150
150
|
const buttons = screen.getAllByRole("button");
|
|
@@ -152,7 +152,7 @@ describe("ErrorItem component events", () => {
|
|
|
152
152
|
fireEvent.click(buttons[3]);
|
|
153
153
|
fireEvent.click(buttons[3]);
|
|
154
154
|
fireEvent.click(buttons[3]);
|
|
155
|
-
|
|
155
|
+
vi.clearAllMocks();
|
|
156
156
|
|
|
157
157
|
// Fourth click should be a no-op
|
|
158
158
|
fireEvent.click(buttons[3]);
|
|
@@ -19,9 +19,9 @@ const mockError: IHeadingError = {
|
|
|
19
19
|
|
|
20
20
|
const defaultProps = {
|
|
21
21
|
errors: [mockError],
|
|
22
|
-
onSelectHeading:
|
|
22
|
+
onSelectHeading: vi.fn(() => vi.fn()),
|
|
23
23
|
isOpen: false,
|
|
24
|
-
setIsOpen:
|
|
24
|
+
setIsOpen: vi.fn(),
|
|
25
25
|
resetKey: 0,
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -70,7 +70,7 @@ describe("ErrorsBanner component rendering", () => {
|
|
|
70
70
|
|
|
71
71
|
describe("ErrorsBanner component events", () => {
|
|
72
72
|
it("should call setIsOpen with true when toggle is clicked and isOpen is false", () => {
|
|
73
|
-
const setIsOpenMock =
|
|
73
|
+
const setIsOpenMock = vi.fn();
|
|
74
74
|
renderComponent({ ...defaultProps, isOpen: false, setIsOpen: setIsOpenMock });
|
|
75
75
|
|
|
76
76
|
const buttons = screen.getAllByRole("button");
|
|
@@ -80,7 +80,7 @@ describe("ErrorsBanner component events", () => {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
it("should call setIsOpen with false when toggle is clicked and isOpen is true", () => {
|
|
83
|
-
const setIsOpenMock =
|
|
83
|
+
const setIsOpenMock = vi.fn();
|
|
84
84
|
renderComponent({ ...defaultProps, isOpen: true, setIsOpen: setIsOpenMock });
|
|
85
85
|
|
|
86
86
|
const buttons = screen.getAllByRole("button");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Mock } from "vitest";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
4
|
import { ThemeProvider } from "styled-components";
|
|
@@ -10,9 +11,9 @@ import HeadingsPreviewModal from "@ax/components/HeadingsPreviewModal";
|
|
|
10
11
|
import * as headingsUtils from "@ax/components/HeadingsPreviewModal/utils";
|
|
11
12
|
import globalTheme from "@ax/themes/theme.json";
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
parseHeadingsTree:
|
|
14
|
+
vi.mock("@ax/components/HeadingsPreviewModal/utils", async () => ({
|
|
15
|
+
...(await vi.importActual("@ax/components/HeadingsPreviewModal/utils")),
|
|
16
|
+
parseHeadingsTree: vi.fn().mockReturnValue([]),
|
|
16
17
|
}));
|
|
17
18
|
|
|
18
19
|
afterEach(cleanup);
|
|
@@ -39,9 +40,9 @@ const browserRef = { current: document.createElement("div") } as React.RefObject
|
|
|
39
40
|
const defaultProps = {
|
|
40
41
|
isOpen: false,
|
|
41
42
|
browserRef: { current: null } as React.RefObject<HTMLDivElement>,
|
|
42
|
-
toggleModal:
|
|
43
|
+
toggleModal: vi.fn(),
|
|
43
44
|
headingsFilter: "all" as const,
|
|
44
|
-
setHeadingsFilter:
|
|
45
|
+
setHeadingsFilter: vi.fn(),
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const renderComponent = (props = defaultProps) =>
|
|
@@ -71,7 +72,7 @@ describe("HeadingsPreviewModal component rendering", () => {
|
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
it("should render heading items when open with headings", () => {
|
|
74
|
-
(headingsUtils.parseHeadingsTree as
|
|
75
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
75
76
|
|
|
76
77
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
77
78
|
|
|
@@ -84,7 +85,7 @@ describe("HeadingsPreviewModal component rendering", () => {
|
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
it("should render filter buttons when open with headings", () => {
|
|
87
|
-
(headingsUtils.parseHeadingsTree as
|
|
88
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
88
89
|
|
|
89
90
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
90
91
|
|
|
@@ -105,7 +106,7 @@ describe("HeadingsPreviewModal component rendering", () => {
|
|
|
105
106
|
|
|
106
107
|
it("should render the errors banner when there are SEO errors", () => {
|
|
107
108
|
const headingsWithoutH1: HeadingNode[] = [createHeadingNode("h2", "Subtitle", 2)];
|
|
108
|
-
(headingsUtils.parseHeadingsTree as
|
|
109
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(headingsWithoutH1);
|
|
109
110
|
|
|
110
111
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
111
112
|
|
|
@@ -114,7 +115,7 @@ describe("HeadingsPreviewModal component rendering", () => {
|
|
|
114
115
|
});
|
|
115
116
|
|
|
116
117
|
it("should not render the errors banner when there are no SEO errors", () => {
|
|
117
|
-
(headingsUtils.parseHeadingsTree as
|
|
118
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
118
119
|
|
|
119
120
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
120
121
|
|
|
@@ -125,7 +126,7 @@ describe("HeadingsPreviewModal component rendering", () => {
|
|
|
125
126
|
|
|
126
127
|
describe("HeadingsPreviewModal component events", () => {
|
|
127
128
|
it("should call toggleModal when close button is clicked", () => {
|
|
128
|
-
const toggleModalMock =
|
|
129
|
+
const toggleModalMock = vi.fn();
|
|
129
130
|
|
|
130
131
|
renderComponent({ ...defaultProps, isOpen: true, toggleModal: toggleModalMock });
|
|
131
132
|
|
|
@@ -135,8 +136,8 @@ describe("HeadingsPreviewModal component events", () => {
|
|
|
135
136
|
});
|
|
136
137
|
|
|
137
138
|
it("should call setHeadingsFilter when a filter button is clicked", () => {
|
|
138
|
-
const setHeadingsFilterMock =
|
|
139
|
-
(headingsUtils.parseHeadingsTree as
|
|
139
|
+
const setHeadingsFilterMock = vi.fn();
|
|
140
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
140
141
|
|
|
141
142
|
renderComponent({ ...defaultProps, isOpen: true, browserRef, setHeadingsFilter: setHeadingsFilterMock });
|
|
142
143
|
|
|
@@ -148,7 +149,7 @@ describe("HeadingsPreviewModal component events", () => {
|
|
|
148
149
|
});
|
|
149
150
|
|
|
150
151
|
it("should select a heading item when clicked", () => {
|
|
151
|
-
(headingsUtils.parseHeadingsTree as
|
|
152
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
152
153
|
|
|
153
154
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
154
155
|
|
|
@@ -162,7 +163,7 @@ describe("HeadingsPreviewModal component events", () => {
|
|
|
162
163
|
});
|
|
163
164
|
|
|
164
165
|
it("should deselect a heading item when clicked again", () => {
|
|
165
|
-
(headingsUtils.parseHeadingsTree as
|
|
166
|
+
(headingsUtils.parseHeadingsTree as Mock).mockReturnValueOnce(mockHeadings);
|
|
166
167
|
|
|
167
168
|
renderComponent({ ...defaultProps, isOpen: true, browserRef });
|
|
168
169
|
|
|
@@ -47,7 +47,7 @@ describe("IconAction component rendering", () => {
|
|
|
47
47
|
|
|
48
48
|
describe("onClick events", () => {
|
|
49
49
|
test("onClick been called if enabled", () => {
|
|
50
|
-
const onClickMock =
|
|
50
|
+
const onClickMock = vi.fn();
|
|
51
51
|
const defaultProps: IIconActionProps = {
|
|
52
52
|
icon: "delete",
|
|
53
53
|
size: "m",
|
|
@@ -68,7 +68,7 @@ describe("onClick events", () => {
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
test("onClick not to be called if disabled", () => {
|
|
71
|
-
const onClickMock =
|
|
71
|
+
const onClickMock = vi.fn();
|
|
72
72
|
const defaultProps: IIconActionProps = {
|
|
73
73
|
icon: "delete",
|
|
74
74
|
size: "m",
|
|
@@ -10,7 +10,7 @@ afterEach(cleanup);
|
|
|
10
10
|
const renderCropStep = (props = {}) =>
|
|
11
11
|
render(
|
|
12
12
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
13
|
-
<CropStep imageSrc="data:image/jpeg;base64,abc" onConfirm={
|
|
13
|
+
<CropStep imageSrc="data:image/jpeg;base64,abc" onConfirm={vi.fn()} onCancel={vi.fn()} {...props} />
|
|
14
14
|
</ThemeProvider>,
|
|
15
15
|
);
|
|
16
16
|
|
|
@@ -46,14 +46,14 @@ describe("CropStep rendering", () => {
|
|
|
46
46
|
|
|
47
47
|
describe("CropStep events", () => {
|
|
48
48
|
it("should call onConfirm with cropped area when Done is clicked", () => {
|
|
49
|
-
const onConfirm =
|
|
49
|
+
const onConfirm = vi.fn();
|
|
50
50
|
renderCropStep({ onConfirm });
|
|
51
51
|
fireEvent.click(screen.getByText("Done"));
|
|
52
52
|
expect(onConfirm).toHaveBeenCalledWith({ x: 0, y: 0, width: 100, height: 100 });
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it("should call onCancel when Upload new image is clicked", () => {
|
|
56
|
-
const onCancel =
|
|
56
|
+
const onCancel = vi.fn();
|
|
57
57
|
renderCropStep({ onCancel });
|
|
58
58
|
fireEvent.click(screen.getByText("Upload new image"));
|
|
59
59
|
expect(onCancel).toHaveBeenCalledTimes(1);
|
|
@@ -10,13 +10,13 @@ import configureStore from "redux-mock-store";
|
|
|
10
10
|
import thunk from "redux-thunk";
|
|
11
11
|
import { ThemeProvider } from "styled-components";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
vi.mock("@ax/containers/Gallery", () => ({
|
|
14
14
|
galleryActions: {
|
|
15
|
-
uploadError:
|
|
16
|
-
resetError:
|
|
17
|
-
uploadImage:
|
|
18
|
-
replaceImage:
|
|
19
|
-
setUploadSuccess:
|
|
15
|
+
uploadError: vi.fn(() => ({ type: "UPLOAD_ERROR" })),
|
|
16
|
+
resetError: vi.fn(() => ({ type: "RESET_ERROR" })),
|
|
17
|
+
uploadImage: vi.fn(() => async () => null),
|
|
18
|
+
replaceImage: vi.fn(() => async () => null),
|
|
19
|
+
setUploadSuccess: vi.fn(() => ({ type: "SET_UPLOAD_SUCCESS" })),
|
|
20
20
|
},
|
|
21
21
|
}));
|
|
22
22
|
|
|
@@ -38,7 +38,7 @@ const renderImageDragAndDrop = (props = {}, storeData = initialStore) => {
|
|
|
38
38
|
return render(
|
|
39
39
|
<Provider store={store}>
|
|
40
40
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
41
|
-
<ImageDragAndDrop siteID="global" handleUpload={
|
|
41
|
+
<ImageDragAndDrop siteID="global" handleUpload={vi.fn()} {...props} />
|
|
42
42
|
</ThemeProvider>
|
|
43
43
|
</Provider>,
|
|
44
44
|
);
|