@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,15 +1,16 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import axios from "axios";
|
|
3
4
|
import "@testing-library/jest-dom";
|
|
4
5
|
import { ThemeProvider } from "styled-components";
|
|
5
6
|
import { parseTheme } from "@ax/helpers";
|
|
6
|
-
import { mock } from "
|
|
7
|
+
import { mock } from "vitest-mock-extended";
|
|
7
8
|
import configureStore from "redux-mock-store";
|
|
8
9
|
|
|
9
10
|
import ReferenceField, { IReferenceFieldProps } from "@ax/components/Fields/ReferenceField/index";
|
|
10
11
|
import globalTheme from "@ax/themes/theme.json";
|
|
11
12
|
|
|
12
|
-
import { render, cleanup, screen, act, fireEvent } from "../../../../../config/
|
|
13
|
+
import { render, cleanup, screen, act, fireEvent } from "../../../../../config/tests/test-utils";
|
|
13
14
|
import {
|
|
14
15
|
articlesDistributorResponse,
|
|
15
16
|
storiesDistributorResponse,
|
|
@@ -22,7 +23,7 @@ import { structuredDataMock, sitesMock, appMock } from "../../../../__mocks__/st
|
|
|
22
23
|
|
|
23
24
|
afterEach(() => {
|
|
24
25
|
cleanup();
|
|
25
|
-
|
|
26
|
+
vi.resetAllMocks();
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
const defaultProps = mock<IReferenceFieldProps>();
|
|
@@ -38,8 +39,8 @@ const initialStore = {
|
|
|
38
39
|
const mockStore = configureStore();
|
|
39
40
|
const store = mockStore(initialStore);
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
const mockedAxios = axios as
|
|
42
|
+
vi.mock("axios");
|
|
43
|
+
const mockedAxios = axios as MockedFunction<typeof axios>;
|
|
43
44
|
const mockApiCalls = () =>
|
|
44
45
|
mockedAxios.mockImplementation((request: any) => {
|
|
45
46
|
switch (request.url) {
|
|
@@ -62,7 +63,7 @@ describe("ReferenceField component rendering", () => {
|
|
|
62
63
|
order: "alpha-DESC",
|
|
63
64
|
};
|
|
64
65
|
defaultProps.selectionType = ["auto"];
|
|
65
|
-
const onChange =
|
|
66
|
+
const onChange = vi.fn();
|
|
66
67
|
const initialState = { ...initialStore, ...defaultProps };
|
|
67
68
|
|
|
68
69
|
mockApiCalls();
|
|
@@ -140,7 +141,7 @@ describe("ReferenceField component rendering", () => {
|
|
|
140
141
|
fixed: [],
|
|
141
142
|
};
|
|
142
143
|
const initialState = { ...initialStore, ...defaultProps };
|
|
143
|
-
const onChange =
|
|
144
|
+
const onChange = vi.fn();
|
|
144
145
|
|
|
145
146
|
mockedAxios.mockImplementation((request: any) => {
|
|
146
147
|
switch (request.url) {
|
|
@@ -197,7 +198,7 @@ describe("onChange events", () => {
|
|
|
197
198
|
quantity: 1,
|
|
198
199
|
};
|
|
199
200
|
const initialState = { ...initialStore, ...defaultProps };
|
|
200
|
-
const onChange =
|
|
201
|
+
const onChange = vi.fn();
|
|
201
202
|
|
|
202
203
|
mockedAxios.mockImplementation((request: any) => {
|
|
203
204
|
switch (request.url) {
|
|
@@ -267,7 +268,7 @@ describe("onChange events", () => {
|
|
|
267
268
|
fixed: [4492, 4493],
|
|
268
269
|
};
|
|
269
270
|
const initialState = { ...initialStore, ...defaultProps };
|
|
270
|
-
const onChange =
|
|
271
|
+
const onChange = vi.fn();
|
|
271
272
|
|
|
272
273
|
mockApiCalls();
|
|
273
274
|
|
|
@@ -320,7 +321,7 @@ describe("onChange events", () => {
|
|
|
320
321
|
};
|
|
321
322
|
defaultProps.maxItems = 3;
|
|
322
323
|
const initialState = { ...initialStore, ...defaultProps };
|
|
323
|
-
const onChange =
|
|
324
|
+
const onChange = vi.fn();
|
|
324
325
|
|
|
325
326
|
mockApiCalls();
|
|
326
327
|
|
|
@@ -388,7 +389,7 @@ describe("onChange events", () => {
|
|
|
388
389
|
],
|
|
389
390
|
};
|
|
390
391
|
const initialState = { ...initialStore, ...defaultProps };
|
|
391
|
-
const onChange =
|
|
392
|
+
const onChange = vi.fn();
|
|
392
393
|
|
|
393
394
|
mockedAxios.mockImplementation((request: any) => {
|
|
394
395
|
switch (request.url) {
|
|
@@ -445,7 +446,7 @@ describe("onChange events", () => {
|
|
|
445
446
|
fixed: [4492, 4493],
|
|
446
447
|
};
|
|
447
448
|
const initialState = { ...initialStore, ...defaultProps };
|
|
448
|
-
const onChange =
|
|
449
|
+
const onChange = vi.fn();
|
|
449
450
|
|
|
450
451
|
// mockApiCalls();
|
|
451
452
|
|
|
@@ -480,7 +481,7 @@ describe("onChange events", () => {
|
|
|
480
481
|
fixed: [4492, 4493],
|
|
481
482
|
};
|
|
482
483
|
const initialState = { ...initialStore, ...defaultProps };
|
|
483
|
-
const onChange =
|
|
484
|
+
const onChange = vi.fn();
|
|
484
485
|
|
|
485
486
|
mockApiCalls();
|
|
486
487
|
|
|
@@ -509,7 +510,7 @@ describe("onChange events", () => {
|
|
|
509
510
|
fixed: [4492, 4493],
|
|
510
511
|
};
|
|
511
512
|
const initialState = { ...initialStore, ...defaultProps };
|
|
512
|
-
const onChange =
|
|
513
|
+
const onChange = vi.fn();
|
|
513
514
|
|
|
514
515
|
mockApiCalls();
|
|
515
516
|
|
|
@@ -565,7 +566,7 @@ describe("onChange events", () => {
|
|
|
565
566
|
fixed: [4492, 4493],
|
|
566
567
|
};
|
|
567
568
|
const initialState = { ...initialStore, ...defaultProps };
|
|
568
|
-
const onChange =
|
|
569
|
+
const onChange = vi.fn();
|
|
569
570
|
|
|
570
571
|
mockApiCalls();
|
|
571
572
|
|
|
@@ -594,7 +595,7 @@ describe("onChange events", () => {
|
|
|
594
595
|
fixed: [],
|
|
595
596
|
};
|
|
596
597
|
const initialState = { ...initialStore, ...defaultProps };
|
|
597
|
-
const onChange =
|
|
598
|
+
const onChange = vi.fn();
|
|
598
599
|
|
|
599
600
|
mockApiCalls();
|
|
600
601
|
|
|
@@ -3,7 +3,7 @@ import RichText, { IRichTextProps } from "@ax/components/Fields/RichText";
|
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import { parseTheme } from "@ax/helpers";
|
|
5
5
|
import globalTheme from "@ax/themes/theme.json";
|
|
6
|
-
import { mock } from "
|
|
6
|
+
import { mock } from "vitest-mock-extended";
|
|
7
7
|
import { render, screen, cleanup } from "@testing-library/react";
|
|
8
8
|
|
|
9
9
|
afterEach(cleanup);
|
|
@@ -4,7 +4,7 @@ import { ThemeProvider } from "styled-components";
|
|
|
4
4
|
import { parseTheme } from "@ax/helpers";
|
|
5
5
|
import globalTheme from "@ax/themes/theme.json";
|
|
6
6
|
import { render, screen, cleanup } from "@testing-library/react";
|
|
7
|
-
import { mock } from "
|
|
7
|
+
import { mock } from "vitest-mock-extended";
|
|
8
8
|
|
|
9
9
|
afterEach(cleanup);
|
|
10
10
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import SliderField, { ITextFieldProps } from "@ax/components/Fields/SliderField";
|
|
3
4
|
import { ThemeProvider } from "styled-components";
|
|
4
5
|
import { parseTheme } from "@ax/helpers";
|
|
5
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
6
7
|
import { render, screen, cleanup, fireEvent } from "@testing-library/react";
|
|
7
|
-
import { mock } from "
|
|
8
|
+
import { mock } from "vitest-mock-extended";
|
|
8
9
|
|
|
9
10
|
afterEach(cleanup);
|
|
10
11
|
|
|
@@ -15,7 +16,7 @@ describe("Select component rendering", () => {
|
|
|
15
16
|
defaultProps.title = "A title";
|
|
16
17
|
defaultProps.value = 10;
|
|
17
18
|
defaultProps.step = 1;
|
|
18
|
-
const onChangeMock = defaultProps.onChange as
|
|
19
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: number) => void>;
|
|
19
20
|
|
|
20
21
|
render(
|
|
21
22
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
@@ -36,7 +37,7 @@ describe("Select component rendering", () => {
|
|
|
36
37
|
defaultProps.step = 1;
|
|
37
38
|
defaultProps.prefix = "prefix";
|
|
38
39
|
defaultProps.suffix = "suffix";
|
|
39
|
-
const onChangeMock = defaultProps.onChange as
|
|
40
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: number) => void>;
|
|
40
41
|
|
|
41
42
|
render(
|
|
42
43
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
@@ -54,7 +55,7 @@ describe("Select component events trigger", () => {
|
|
|
54
55
|
defaultProps.title = "A title";
|
|
55
56
|
defaultProps.value = 10;
|
|
56
57
|
defaultProps.step = 1;
|
|
57
|
-
const onChangeMock = defaultProps.onChange as
|
|
58
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: number) => void>;
|
|
58
59
|
|
|
59
60
|
render(
|
|
60
61
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { ThemeProvider } from "styled-components";
|
|
3
3
|
import { parseTheme } from "@ax/helpers";
|
|
4
4
|
import globalTheme from "@ax/themes/theme.json";
|
|
5
|
-
import { render, cleanup, screen } from "../../../../../config/
|
|
6
|
-
import { mock } from "
|
|
5
|
+
import { render, cleanup, screen } from "../../../../../config/tests/test-utils";
|
|
6
|
+
import { mock } from "vitest-mock-extended";
|
|
7
7
|
import configureStore from "redux-mock-store";
|
|
8
8
|
import thunk from "redux-thunk";
|
|
9
9
|
import SummaryButton, { ISummaryButtonProps } from "@ax/components/Fields/SummaryButton";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import TagsField from "@ax/components/Fields/TagsField";
|
|
3
2
|
import { ThemeProvider } from "styled-components";
|
|
4
3
|
import { parseTheme } from "@ax/helpers";
|
|
@@ -9,7 +8,7 @@ afterEach(cleanup);
|
|
|
9
8
|
|
|
10
9
|
const props = {
|
|
11
10
|
value: [],
|
|
12
|
-
onChange:
|
|
11
|
+
onChange: vi.fn(),
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
describe("TagsField component", () => {
|
|
@@ -32,7 +31,7 @@ describe("TagsField component", () => {
|
|
|
32
31
|
test("should render the tags if have values", () => {
|
|
33
32
|
const defaultProps = {
|
|
34
33
|
value: ["one", "two"],
|
|
35
|
-
onChange:
|
|
34
|
+
onChange: vi.fn(),
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
render(
|
|
@@ -69,7 +68,7 @@ describe("TagsField events", () => {
|
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
test("should add new value on keyDown if it's not in array", () => {
|
|
72
|
-
const onChange =
|
|
71
|
+
const onChange = vi.fn();
|
|
73
72
|
const defaultProps = {
|
|
74
73
|
value: [],
|
|
75
74
|
onChange,
|
|
@@ -86,7 +85,7 @@ describe("TagsField events", () => {
|
|
|
86
85
|
expect(onChange).toHaveBeenCalledWith(["test"]);
|
|
87
86
|
});
|
|
88
87
|
test("shouldn't add new value on keyDown if it's in array", () => {
|
|
89
|
-
const onChange =
|
|
88
|
+
const onChange = vi.fn();
|
|
90
89
|
const defaultProps = {
|
|
91
90
|
value: ["test"],
|
|
92
91
|
onChange,
|
|
@@ -103,7 +102,7 @@ describe("TagsField events", () => {
|
|
|
103
102
|
expect(onChange).toBeCalledTimes(0);
|
|
104
103
|
});
|
|
105
104
|
test("should delete value from array", () => {
|
|
106
|
-
const onChange =
|
|
105
|
+
const onChange = vi.fn();
|
|
107
106
|
const defaultProps = {
|
|
108
107
|
value: ["one", "two"],
|
|
109
108
|
onChange,
|
|
@@ -121,9 +120,10 @@ describe("TagsField events", () => {
|
|
|
121
120
|
fireEvent.click(tagRendered[0], 0);
|
|
122
121
|
expect(onChange).toBeCalledTimes(1);
|
|
123
122
|
});
|
|
123
|
+
// Asserts the focus actually lands on the input instead of spying on
|
|
124
|
+
// React.useRef: an ESM namespace is immutable, so `vi.spyOn(React, ...)` no
|
|
125
|
+
// longer intercepts the hook the component imported.
|
|
124
126
|
test("should call the focus function", () => {
|
|
125
|
-
// we can check if the focus function is been called
|
|
126
|
-
const useRefSpy = jest.spyOn(React, "useRef").mockReturnValueOnce({ current: { focus: jest.fn() } });
|
|
127
127
|
render(
|
|
128
128
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
129
129
|
<TagsField {...props} />
|
|
@@ -131,6 +131,6 @@ describe("TagsField events", () => {
|
|
|
131
131
|
);
|
|
132
132
|
const tagsFieldWrapper = screen.getByTestId("tag-field-wrapper");
|
|
133
133
|
fireEvent.click(tagsFieldWrapper);
|
|
134
|
-
expect(
|
|
134
|
+
expect(screen.getByTestId("tag-field-input")).toHaveFocus();
|
|
135
135
|
});
|
|
136
136
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import TextArea from "@ax/components/Fields/TextArea";
|
|
3
2
|
import { ThemeProvider } from "styled-components";
|
|
4
3
|
import { parseTheme } from "@ax/helpers";
|
|
@@ -10,7 +9,7 @@ afterEach(cleanup);
|
|
|
10
9
|
const props = {
|
|
11
10
|
name: "",
|
|
12
11
|
value: "",
|
|
13
|
-
onChange:
|
|
12
|
+
onChange: vi.fn(),
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
describe("TextArea component rendering", () => {
|
|
@@ -27,29 +26,34 @@ describe("TextArea component rendering", () => {
|
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
describe("TextArea events", () => {
|
|
29
|
+
// Asserts the observable contract instead of spying on React.useState: an ESM
|
|
30
|
+
// namespace is immutable, so `vi.spyOn(React, ...)` no longer intercepts the
|
|
31
|
+
// hook the component imported. onChange is debounced by 300ms.
|
|
30
32
|
test("should call the onChange", () => {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
jest.spyOn(React, "useState").mockImplementation(useStateMock);
|
|
33
|
+
vi.useFakeTimers();
|
|
34
|
+
const onChange = vi.fn();
|
|
34
35
|
|
|
35
36
|
render(
|
|
36
37
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
37
|
-
<TextArea {...props} />
|
|
38
|
+
<TextArea {...props} onChange={onChange} />
|
|
38
39
|
</ThemeProvider>,
|
|
39
40
|
);
|
|
40
41
|
|
|
41
42
|
const textAreaComponent = screen.getByTestId("text-area-component");
|
|
42
43
|
expect(textAreaComponent).toBeTruthy();
|
|
43
44
|
fireEvent.change(textAreaComponent, { target: { value: "test" } });
|
|
44
|
-
|
|
45
|
+
vi.advanceTimersByTime(300);
|
|
46
|
+
expect(onChange).toHaveBeenCalledWith("test");
|
|
47
|
+
|
|
48
|
+
vi.useRealTimers();
|
|
45
49
|
});
|
|
46
50
|
|
|
47
51
|
test("should call the onBlur", () => {
|
|
48
|
-
const handleValidationMock =
|
|
52
|
+
const handleValidationMock = vi.fn();
|
|
49
53
|
const defaultProps = {
|
|
50
54
|
name: "name",
|
|
51
55
|
value: "value",
|
|
52
|
-
onChange:
|
|
56
|
+
onChange: vi.fn(),
|
|
53
57
|
handleValidation: handleValidationMock,
|
|
54
58
|
};
|
|
55
59
|
|
|
@@ -9,7 +9,7 @@ afterEach(cleanup);
|
|
|
9
9
|
|
|
10
10
|
const defaultProps = {
|
|
11
11
|
value: "",
|
|
12
|
-
onChange:
|
|
12
|
+
onChange: vi.fn(),
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
describe("TextField component rendering", () => {
|
|
@@ -30,7 +30,7 @@ describe("TextField component rendering", () => {
|
|
|
30
30
|
test("should render the component with prefix", () => {
|
|
31
31
|
const props = {
|
|
32
32
|
value: "value",
|
|
33
|
-
onChange:
|
|
33
|
+
onChange: vi.fn(),
|
|
34
34
|
prefix: "prefix",
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ describe("TextField component rendering", () => {
|
|
|
51
51
|
it("should render the component with backgroundIcon", () => {
|
|
52
52
|
const props = {
|
|
53
53
|
value: "value",
|
|
54
|
-
onChange:
|
|
54
|
+
onChange: vi.fn(),
|
|
55
55
|
icon: "icon",
|
|
56
56
|
iconPosition: "in",
|
|
57
57
|
};
|
|
@@ -73,7 +73,7 @@ describe("TextField component rendering", () => {
|
|
|
73
73
|
it("should render the component with button", () => {
|
|
74
74
|
const props = {
|
|
75
75
|
value: "value",
|
|
76
|
-
onChange:
|
|
76
|
+
onChange: vi.fn(),
|
|
77
77
|
icon: "icon",
|
|
78
78
|
iconPosition: "out",
|
|
79
79
|
};
|
|
@@ -95,10 +95,10 @@ describe("TextField component rendering", () => {
|
|
|
95
95
|
|
|
96
96
|
describe("onClick from buttons", () => {
|
|
97
97
|
test("onClickIcon been called in BackgroundIcon", () => {
|
|
98
|
-
const onClickIconMock =
|
|
98
|
+
const onClickIconMock = vi.fn();
|
|
99
99
|
const props = {
|
|
100
100
|
value: "value",
|
|
101
|
-
onChange:
|
|
101
|
+
onChange: vi.fn(),
|
|
102
102
|
icon: "icon",
|
|
103
103
|
iconPosition: "in",
|
|
104
104
|
onClickIcon: onClickIconMock,
|
|
@@ -118,10 +118,10 @@ describe("onClick from buttons", () => {
|
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
test("onClickIcon been called in BackgroundIcon", () => {
|
|
121
|
-
const onClickIconMock =
|
|
121
|
+
const onClickIconMock = vi.fn();
|
|
122
122
|
const props = {
|
|
123
123
|
value: "value",
|
|
124
|
-
onChange:
|
|
124
|
+
onChange: vi.fn(),
|
|
125
125
|
icon: "icon",
|
|
126
126
|
iconPosition: "out",
|
|
127
127
|
onClickIcon: onClickIconMock,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { render, screen, cleanup, fireEvent } from "@testing-library/react";
|
|
3
|
-
import { mock } from "
|
|
4
|
+
import { mock } from "vitest-mock-extended";
|
|
4
5
|
import { ThemeProvider } from "styled-components";
|
|
5
6
|
import { parseTheme } from "@ax/helpers";
|
|
6
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -39,7 +40,7 @@ describe("HourInput component rendering", () => {
|
|
|
39
40
|
|
|
40
41
|
describe("onChange events", () => {
|
|
41
42
|
it("should call onChange on change with valid time", () => {
|
|
42
|
-
const onChangeMock = defaultProps.onChange as
|
|
43
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
43
44
|
defaultProps.value = "12:30";
|
|
44
45
|
defaultProps.disabled = false;
|
|
45
46
|
|
|
@@ -59,7 +60,7 @@ describe("onChange events", () => {
|
|
|
59
60
|
});
|
|
60
61
|
|
|
61
62
|
it("should call onChange on change with 24 hours time", () => {
|
|
62
|
-
const onChangeMock = defaultProps.onChange as
|
|
63
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
63
64
|
defaultProps.value = "12:00";
|
|
64
65
|
|
|
65
66
|
render(
|
|
@@ -78,7 +79,7 @@ describe("onChange events", () => {
|
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
it("should call onChange on change with 24 hours time", () => {
|
|
81
|
-
const onChangeMock = defaultProps.onChange as
|
|
82
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
82
83
|
defaultProps.value = "12:00";
|
|
83
84
|
|
|
84
85
|
render(
|
|
@@ -97,7 +98,7 @@ describe("onChange events", () => {
|
|
|
97
98
|
});
|
|
98
99
|
|
|
99
100
|
it("should call onChange on change with more than 12 hours", () => {
|
|
100
|
-
const onChangeMock = defaultProps.onChange as
|
|
101
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
101
102
|
defaultProps.value = "12:00";
|
|
102
103
|
|
|
103
104
|
render(
|
|
@@ -116,7 +117,7 @@ describe("onChange events", () => {
|
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
it("should call onChange on change with more than 59 minutes", () => {
|
|
119
|
-
const onChangeMock = defaultProps.onChange as
|
|
120
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
120
121
|
defaultProps.value = "12:30";
|
|
121
122
|
|
|
122
123
|
render(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { MockedFunction } from "vitest";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { render, screen, cleanup, fireEvent } from "@testing-library/react";
|
|
3
|
-
import { mock } from "
|
|
4
|
+
import { mock } from "vitest-mock-extended";
|
|
4
5
|
import { ThemeProvider } from "styled-components";
|
|
5
6
|
import { parseTheme } from "@ax/helpers";
|
|
6
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -62,7 +63,7 @@ describe("TimeField component rendering", () => {
|
|
|
62
63
|
|
|
63
64
|
describe("onChange events", () => {
|
|
64
65
|
it("should call onChange on change", () => {
|
|
65
|
-
const onChangeMock = defaultProps.onChange as
|
|
66
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
66
67
|
defaultProps.value = "12:30 am";
|
|
67
68
|
|
|
68
69
|
render(
|
|
@@ -77,7 +78,7 @@ describe("onChange events", () => {
|
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
it("should call onChange on change with no value", () => {
|
|
80
|
-
const onChangeMock = defaultProps.onChange as
|
|
81
|
+
const onChangeMock = defaultProps.onChange as MockedFunction<(value: string) => void>;
|
|
81
82
|
defaultProps.value = undefined;
|
|
82
83
|
|
|
83
84
|
render(
|
|
@@ -3,7 +3,7 @@ import ToggleField, { IToggleFieldProps } from "@ax/components/Fields/ToggleFiel
|
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import { render, screen, cleanup, fireEvent } from "@testing-library/react";
|
|
5
5
|
import "@testing-library/jest-dom";
|
|
6
|
-
import { mock } from "
|
|
6
|
+
import { mock } from "vitest-mock-extended";
|
|
7
7
|
|
|
8
8
|
import { parseTheme } from "@ax/helpers";
|
|
9
9
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -99,7 +99,7 @@ describe("ToggleField component rendering", () => {
|
|
|
99
99
|
describe("onClick events", () => {
|
|
100
100
|
it("should call onChange function with value true", () => {
|
|
101
101
|
defaultProps.value = false;
|
|
102
|
-
defaultProps.onChange =
|
|
102
|
+
defaultProps.onChange = vi.fn();
|
|
103
103
|
|
|
104
104
|
render(
|
|
105
105
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import { render, screen, cleanup, fireEvent, act } from "@testing-library/react";
|
|
5
5
|
import "@testing-library/jest-dom";
|
|
6
|
-
import { mock } from "
|
|
6
|
+
import { mock } from "vitest-mock-extended";
|
|
7
7
|
|
|
8
8
|
import { parseTheme } from "@ax/helpers";
|
|
9
9
|
|
|
@@ -46,7 +46,7 @@ describe("Tooltip component rendering", () => {
|
|
|
46
46
|
|
|
47
47
|
describe("Tooltip events triggering", () => {
|
|
48
48
|
it("should render the component and Tip Component is still visible when doing click", () => {
|
|
49
|
-
|
|
49
|
+
vi.useFakeTimers();
|
|
50
50
|
defaultProps.content = "content";
|
|
51
51
|
defaultProps.children = <Icon name="modified" size="16px" />;
|
|
52
52
|
|
|
@@ -76,7 +76,7 @@ describe("Tooltip events triggering", () => {
|
|
|
76
76
|
<Tooltip {...defaultProps} />
|
|
77
77
|
</ThemeProvider>,
|
|
78
78
|
);
|
|
79
|
-
|
|
79
|
+
vi.runAllTimers();
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
expect(tipComponent).toBeVisible();
|
|
@@ -91,13 +91,13 @@ describe("Tooltip events triggering", () => {
|
|
|
91
91
|
</ThemeProvider>,
|
|
92
92
|
);
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
vi.runAllTimers();
|
|
95
95
|
});
|
|
96
96
|
expect(tipComponent).toBeVisible();
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it("should render the component and change visibility of Tip Component when click", () => {
|
|
100
|
-
|
|
100
|
+
vi.useFakeTimers();
|
|
101
101
|
defaultProps.content = "content";
|
|
102
102
|
defaultProps.children = <Icon name="modified" size="16px" />;
|
|
103
103
|
|
|
@@ -128,7 +128,7 @@ describe("Tooltip events triggering", () => {
|
|
|
128
128
|
</ThemeProvider>,
|
|
129
129
|
);
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
vi.runAllTimers();
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
expect(tipComponent).toBeVisible();
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { ThemeProvider } from "styled-components";
|
|
3
3
|
import { parseTheme } from "@ax/helpers";
|
|
4
4
|
import globalTheme from "@ax/themes/theme.json";
|
|
5
|
-
import { render, cleanup, screen } from "../../../../../config/
|
|
6
|
-
import { mock } from "
|
|
5
|
+
import { render, cleanup, screen } from "../../../../../config/tests/test-utils";
|
|
6
|
+
import { mock } from "vitest-mock-extended";
|
|
7
7
|
import configureStore from "redux-mock-store";
|
|
8
8
|
import thunk from "redux-thunk";
|
|
9
9
|
import TranslateButton, { ITranslateButtonProps } from "@ax/components/Fields/TranslateButton";
|
|
@@ -36,7 +36,7 @@ describe("Translate Button component rendering", () => {
|
|
|
36
36
|
|
|
37
37
|
const translateButtonWrapper = screen.getByTestId("translate-button-wrapper");
|
|
38
38
|
expect(translateButtonWrapper).toBeTruthy();
|
|
39
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
39
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
40
40
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -60,7 +60,7 @@ describe("Translate Button component rendering", () => {
|
|
|
60
60
|
|
|
61
61
|
const translateButtonWrapper = screen.getByTestId("translate-button-wrapper");
|
|
62
62
|
expect(translateButtonWrapper).toBeTruthy();
|
|
63
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
63
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
64
64
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -83,7 +83,7 @@ describe("Translate Button component rendering", () => {
|
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
const translateButtonWrapper = screen.queryByTestId("translate-button-wrapper");
|
|
86
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
86
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
87
87
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
88
88
|
expect(translateButtonWrapper).toBeFalsy();
|
|
89
89
|
});
|
|
@@ -107,7 +107,7 @@ describe("Translate Button component rendering", () => {
|
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
const translateButtonWrapper = screen.queryByTestId("translate-button-wrapper");
|
|
110
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
110
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
111
111
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
112
112
|
expect(translateButtonWrapper).toBeFalsy();
|
|
113
113
|
});
|
|
@@ -131,7 +131,7 @@ describe("Translate Button component rendering", () => {
|
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
const translateButtonWrapper = screen.queryByTestId("translate-button-wrapper");
|
|
134
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
134
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
135
135
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
136
136
|
expect(translateButtonWrapper).toBeFalsy();
|
|
137
137
|
});
|
|
@@ -139,7 +139,7 @@ describe("Translate Button component rendering", () => {
|
|
|
139
139
|
it("should render the notification if page is already translated", () => {
|
|
140
140
|
const initialStore = {
|
|
141
141
|
app: { globalSettings: { autoTranslation: true } },
|
|
142
|
-
pageEditor: { editorContent: { canBeTranslated: false }, isIATranslated: true },
|
|
142
|
+
pageEditor: { editorContent: { canBeTranslated: false, originalLanguage: 2 }, isIATranslated: true },
|
|
143
143
|
structuredData: { form: null, isIATranslated: false },
|
|
144
144
|
forms: { formContent: null },
|
|
145
145
|
};
|
|
@@ -155,7 +155,7 @@ describe("Translate Button component rendering", () => {
|
|
|
155
155
|
);
|
|
156
156
|
|
|
157
157
|
const translateButtonWrapper = screen.queryByTestId("translate-button-wrapper");
|
|
158
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
158
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
159
159
|
expect(translatedNotificationWrapper).toBeTruthy();
|
|
160
160
|
expect(translateButtonWrapper).toBeFalsy();
|
|
161
161
|
});
|
|
@@ -164,7 +164,7 @@ describe("Translate Button component rendering", () => {
|
|
|
164
164
|
const initialStore = {
|
|
165
165
|
app: { globalSettings: { autoTranslation: true } },
|
|
166
166
|
pageEditor: { editorContent: null, isIATranslated: false },
|
|
167
|
-
structuredData: { form: { canBeTranslated: false }, isIATranslated: true },
|
|
167
|
+
structuredData: { form: { canBeTranslated: false, originalLanguage: 2 }, isIATranslated: true },
|
|
168
168
|
forms: { formContent: null },
|
|
169
169
|
};
|
|
170
170
|
const store = mockStore(initialStore);
|
|
@@ -179,7 +179,7 @@ describe("Translate Button component rendering", () => {
|
|
|
179
179
|
);
|
|
180
180
|
|
|
181
181
|
const translateButtonWrapper = screen.queryByTestId("translate-button-wrapper");
|
|
182
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
182
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
183
183
|
expect(translatedNotificationWrapper).toBeTruthy();
|
|
184
184
|
expect(translateButtonWrapper).toBeFalsy();
|
|
185
185
|
});
|
|
@@ -204,7 +204,7 @@ describe("Translate Button component rendering", () => {
|
|
|
204
204
|
|
|
205
205
|
const translateButtonWrapper = screen.getByTestId("translate-button-wrapper");
|
|
206
206
|
expect(translateButtonWrapper).toBeTruthy();
|
|
207
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
207
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
208
208
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
209
209
|
});
|
|
210
210
|
|
|
@@ -228,7 +228,7 @@ describe("Translate Button component rendering", () => {
|
|
|
228
228
|
|
|
229
229
|
const translateButtonWrapper = screen.getByTestId("translate-button-wrapper");
|
|
230
230
|
expect(translateButtonWrapper).toBeTruthy();
|
|
231
|
-
const translatedNotificationWrapper = screen.queryByTestId("
|
|
231
|
+
const translatedNotificationWrapper = screen.queryByTestId("update-translation-button-wrapper");
|
|
232
232
|
expect(translatedNotificationWrapper).toBeFalsy();
|
|
233
233
|
});
|
|
234
234
|
});
|