@axinom/mosaic-ui 0.69.0-rc.2 → 0.69.0-rc.21
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/dist/components/Buttons/Button/Button.d.ts +3 -3
- package/dist/components/Buttons/Button/Button.d.ts.map +1 -1
- package/dist/components/Buttons/Button.model.d.ts +2 -1
- package/dist/components/Buttons/Button.model.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.models.d.ts +0 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.models.d.ts.map +1 -1
- package/dist/components/DateTime/TimePicker/ScrollColumn/ScrollColumn.d.ts +2 -2
- package/dist/components/DateTime/TimePicker/ScrollColumn/ScrollColumn.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicDataList.d.ts +1 -1
- package/dist/components/DynamicDataList/DynamicDataList.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicDataList.model.d.ts +0 -1
- package/dist/components/DynamicDataList/DynamicDataList.model.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.d.ts +2 -2
- package/dist/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.d.ts +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.d.ts +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/renderers.model.d.ts +2 -0
- package/dist/components/DynamicDataList/DynamicListDataEntry/Renderers/renderers.model.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListHeader/DynamicListHeader.d.ts +2 -2
- package/dist/components/DynamicDataList/DynamicListHeader/DynamicListHeader.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts +2 -2
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.d.ts +2 -2
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/useColumnDefs.d.ts +1 -1
- package/dist/components/DynamicDataList/helpers/useColumnDefs.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/useDataHandler.d.ts +1 -1
- package/dist/components/DynamicDataList/helpers/useDataHandler.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/useRowAnimation.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/useRowEditing.d.ts.map +1 -1
- package/dist/components/EmptyStation/EmptyStation.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/GenerateMutation.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/helpers/FieldWrapper.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +1 -1
- package/dist/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts +0 -1
- package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
- package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts +1 -1
- package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts.map +1 -1
- package/dist/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -1
- package/dist/components/Explorer/SelectionExplorer/SelectionExplorer.d.ts +1 -1
- package/dist/components/Explorer/SelectionExplorer/SelectionExplorer.d.ts.map +1 -1
- package/dist/components/Explorer/helpers/useActions.d.ts +0 -1
- package/dist/components/Explorer/helpers/useActions.d.ts.map +1 -1
- package/dist/components/Explorer/helpers/useDataProvider.d.ts +0 -1
- package/dist/components/Explorer/helpers/useDataProvider.d.ts.map +1 -1
- package/dist/components/Explorer/helpers/useFilters.d.ts +0 -1
- package/dist/components/Explorer/helpers/useFilters.d.ts.map +1 -1
- package/dist/components/FieldSelection/FieldSelection.d.ts +1 -0
- package/dist/components/FieldSelection/FieldSelection.d.ts.map +1 -1
- package/dist/components/Filters/Filter/Filter.d.ts +2 -2
- package/dist/components/Filters/Filter/Filter.d.ts.map +1 -1
- package/dist/components/Filters/Filters.d.ts +2 -2
- package/dist/components/Filters/Filters.d.ts.map +1 -1
- package/dist/components/Filters/Filters.model.d.ts +0 -1
- package/dist/components/Filters/Filters.model.d.ts.map +1 -1
- package/dist/components/Filters/Validators/DateRangeFilterValidator.d.ts.map +1 -1
- package/dist/components/Filters/Validators/NumberRangeFilterValidator.d.ts.map +1 -1
- package/dist/components/FormElements/DynamicDataListControl/DynamicDataListControl.d.ts +0 -1
- package/dist/components/FormElements/DynamicDataListControl/DynamicDataListControl.d.ts.map +1 -1
- package/dist/components/FormElements/DynamicDataListControl/DynamicDataListField.d.ts +2 -2
- package/dist/components/FormElements/DynamicDataListControl/DynamicDataListField.d.ts.map +1 -1
- package/dist/components/FormElements/FormGroup/FormGroup.d.ts +12 -0
- package/dist/components/FormElements/FormGroup/FormGroup.d.ts.map +1 -0
- package/dist/components/FormElements/FormGroupTitle/FormGroupTitle.d.ts +5 -0
- package/dist/components/FormElements/FormGroupTitle/FormGroupTitle.d.ts.map +1 -1
- package/dist/components/FormElements/FormikDebug/FormikDebug.d.ts +0 -1
- package/dist/components/FormElements/FormikDebug/FormikDebug.d.ts.map +1 -1
- package/dist/components/FormElements/ReadOnly/ReadOnlyField.d.ts +2 -2
- package/dist/components/FormElements/ReadOnly/ReadOnlyField.d.ts.map +1 -1
- package/dist/components/FormElements/ReadOnlyText/ReadOnlyTextField.d.ts +2 -2
- package/dist/components/FormElements/ReadOnlyText/ReadOnlyTextField.d.ts.map +1 -1
- package/dist/components/FormElements/Tags/Tags.d.ts +2 -2
- package/dist/components/FormElements/Tags/Tags.d.ts.map +1 -1
- package/dist/components/FormElements/Tags/TagsField.d.ts +2 -2
- package/dist/components/FormElements/Tags/TagsField.d.ts.map +1 -1
- package/dist/components/FormElements/formStoryHelper.d.ts.map +1 -1
- package/dist/components/FormElements/index.d.ts +1 -0
- package/dist/components/FormElements/index.d.ts.map +1 -1
- package/dist/components/FormElements/useFormikError.d.ts.map +1 -1
- package/dist/components/FormStation/Create/Create.d.ts +2 -2
- package/dist/components/FormStation/Create/Create.d.ts.map +1 -1
- package/dist/components/FormStation/Details/Details.d.ts +2 -2
- package/dist/components/FormStation/Details/Details.d.ts.map +1 -1
- package/dist/components/FormStation/FormStation.d.ts +2 -2
- package/dist/components/FormStation/FormStation.d.ts.map +1 -1
- package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts +1 -1
- package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts.map +1 -1
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -1
- package/dist/components/FormStation/SaveOnDemand/SaveOnDemand.d.ts +0 -1
- package/dist/components/FormStation/SaveOnDemand/SaveOnDemand.d.ts.map +1 -1
- package/dist/components/FormStation/SaveOnNavigate/handleNavigationAttempt.d.ts.map +1 -1
- package/dist/components/FormStation/helpers/useTitle.d.ts.map +1 -1
- package/dist/components/InfoPanel/hooks/useCollapse.d.ts +0 -1
- package/dist/components/InfoPanel/hooks/useCollapse.d.ts.map +1 -1
- package/dist/components/InlineMenu/InlineMenu.d.ts.map +1 -1
- package/dist/components/List/List.d.ts +2 -2
- package/dist/components/List/List.d.ts.map +1 -1
- package/dist/components/List/List.model.d.ts +0 -1
- package/dist/components/List/List.model.d.ts.map +1 -1
- package/dist/components/List/List.stories.helper.d.ts.map +1 -1
- package/dist/components/List/ListHeader/ColumnLabel/ColumnLabel.d.ts +2 -2
- package/dist/components/List/ListHeader/ColumnLabel/ColumnLabel.d.ts.map +1 -1
- package/dist/components/List/ListHeader/ListHeader.d.ts +2 -2
- package/dist/components/List/ListHeader/ListHeader.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRow.d.ts +2 -4
- package/dist/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRowCell/ListRowCell.d.ts +0 -1
- package/dist/components/List/ListRow/ListRowCell/ListRowCell.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRowCell/renderData.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRowLoader.d.ts +2 -2
- package/dist/components/List/ListRow/ListRowLoader.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/BooleanDotRenderer/BooleanDotRenderer.d.ts +0 -1
- package/dist/components/List/ListRow/Renderers/BooleanDotRenderer/BooleanDotRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/DateRenderer/DateRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/ExternalLinkRenderer/ExternalLinkRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/StateRenderer/StateRenderer.d.ts +1 -1
- package/dist/components/List/ListRow/Renderers/StateRenderer/StateRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.d.ts +0 -1
- package/dist/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRow/Renderers/TimestampRenderer/TimestampRenderer.d.ts.map +1 -1
- package/dist/components/List/ListRowRenderer/ListRowRenderer.d.ts.map +1 -1
- package/dist/components/List/helpers.d.ts.map +1 -1
- package/dist/components/List/useColumnsSize.d.ts +0 -2
- package/dist/components/List/useColumnsSize.d.ts.map +1 -1
- package/dist/components/Loaders/skeletons.d.ts +0 -1
- package/dist/components/Loaders/skeletons.d.ts.map +1 -1
- package/dist/components/Modal/useModal.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +0 -1
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +1 -1
- package/dist/components/PageHeader/helpers/useElementWidthObserver.d.ts +1 -2
- package/dist/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +1 -1
- package/dist/components/Tabs/TabList/ScrollContainer/useScroll.d.ts.map +1 -1
- package/dist/components/Utils/Postgraphile/FilterTransformer.d.ts.map +1 -1
- package/dist/components/Utils/Postgraphile/SortTransformer.d.ts.map +1 -1
- package/dist/components/Utils/State/GlobalState.d.ts.map +1 -1
- package/dist/helpers/idleCallbackHelpers.d.ts +0 -1
- package/dist/helpers/idleCallbackHelpers.d.ts.map +1 -1
- package/dist/helpers/storybook.d.ts.map +1 -1
- package/dist/helpers/testing.d.ts +6 -21
- package/dist/helpers/testing.d.ts.map +1 -1
- package/dist/helpers/utils.d.ts +1 -2
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/hooks/useDEBUGDetectChanges/useDEBUGDetectChanges.d.ts.map +1 -1
- package/dist/hooks/useDEBUGRenderCount/useDEBUGRenderCount.d.ts.map +1 -1
- package/dist/hooks/useDebounce/useDebounce.d.ts +1 -2
- package/dist/hooks/useDebounce/useDebounce.d.ts.map +1 -1
- package/dist/hooks/useExpand/useExpand.d.ts.map +1 -1
- package/dist/hooks/useReactRouterPause/utils.d.ts.map +1 -1
- package/dist/hooks/useResize/useResize.d.ts +0 -1
- package/dist/hooks/useResize/useResize.d.ts.map +1 -1
- package/dist/hooks/useTabTitle/useTabTitle.d.ts.map +1 -1
- package/dist/hooks/useValueOrOnDemand/useValueOrOnDemand.d.ts +1 -1
- package/dist/hooks/useValueOrOnDemand/useValueOrOnDemand.d.ts.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/ErrorMapper/ErrorMapper.d.ts.map +1 -1
- package/dist/utils/ErrorTypeToStationError.d.ts.map +1 -1
- package/dist/utils/ToolTipHelpers.d.ts.map +1 -1
- package/dist/validators/timestamp/timestamp.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/components/Accordion/Accordion.spec.tsx +1 -1
- package/src/components/Accordion/AccordionItem/AccordionItem.spec.tsx +2 -2
- package/src/components/Actions/Action/Action.spec.tsx +189 -228
- package/src/components/Actions/Actions.spec.tsx +42 -32
- package/src/components/Buttons/Button/Button.spec.tsx +110 -115
- package/src/components/Buttons/Button/Button.tsx +4 -0
- package/src/components/Buttons/Button.model.ts +2 -0
- package/src/components/Buttons/CompositeButton/CompositeButton.spec.tsx +122 -121
- package/src/components/Buttons/TextButton/TextButton.spec.tsx +85 -90
- package/src/components/ConfirmDialog/ConfirmDialog.spec.tsx +75 -79
- package/src/components/DateTime/DatePicker/DatePicker.spec.tsx +8 -7
- package/src/components/DateTime/DateTimePicker.spec.tsx +43 -62
- package/src/components/DateTime/TimePicker/ScrollColumn/ScrollColumn.spec.tsx +19 -16
- package/src/components/DateTime/TimePicker/TimePicker.spec.tsx +44 -73
- package/src/components/DynamicDataList/DynamicDataList.spec.tsx +112 -107
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.spec.tsx +91 -144
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.tsx +38 -20
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.spec.tsx +18 -15
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.tsx +2 -0
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.spec.tsx +53 -28
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.tsx +2 -0
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/renderers.model.ts +2 -0
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.scss +19 -5
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.spec.tsx +72 -76
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.scss +9 -2
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.spec.tsx +86 -113
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.spec.ts +1 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.spec.ts +1 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.spec.ts +6 -5
- package/src/components/EmptyStation/EmptyStation.spec.tsx +41 -37
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.spec.tsx +29 -28
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +1 -0
- package/src/components/Explorer/BulkEdit/GenerateMutation.spec.tsx +1 -0
- package/src/components/Explorer/BulkEdit/helpers/FieldWrapper.scss +1 -0
- package/src/components/Explorer/BulkEdit/helpers/FieldWrapper.tsx +1 -0
- package/src/components/Explorer/Explorer.spec.tsx +513 -825
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.spec.tsx +90 -131
- package/src/components/Explorer/QuickEdit/useQuickEdit.spec.tsx +36 -56
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +59 -65
- package/src/components/Explorer/helpers/InMemoryDataProvider.spec.ts +1 -0
- package/src/components/Explorer/helpers/useFilters.spec.tsx +13 -11
- package/src/components/Explorer/helpers/useStationMessage.spec.tsx +4 -3
- package/src/components/Explorer/helpers/useSubtitle.spec.tsx +1 -0
- package/src/components/FieldSelection/FieldSelection.scss +1 -1
- package/src/components/FieldSelection/FieldSelection.spec.tsx +1 -1
- package/src/components/FieldSelection/FieldSelection.tsx +6 -2
- package/src/components/Filters/Filter/Filter.spec.tsx +78 -47
- package/src/components/Filters/Filters.spec.tsx +56 -58
- package/src/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.spec.tsx +45 -46
- package/src/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.spec.tsx +23 -23
- package/src/components/Filters/SelectionTypes/NumericTextFilter/NumericTextFilter.spec.tsx +37 -28
- package/src/components/Filters/SelectionTypes/OptionsFilter/OptionsFilter.spec.tsx +14 -12
- package/src/components/Filters/Validators/DateRangeFilterValidator.spec.ts +1 -0
- package/src/components/Filters/Validators/NumberRangeFilterValidator.spec.ts +1 -0
- package/src/components/FormElements/BooleanView/BooleanViewField.spec.tsx +34 -31
- package/src/components/FormElements/Checkbox/Checkbox.spec.tsx +129 -128
- package/src/components/FormElements/CustomTags/CustomTags.spec.tsx +312 -446
- package/src/components/FormElements/DateTimeField/DateTimeText.spec.tsx +61 -52
- package/src/components/FormElements/DynamicDataListControl/DynamicDataListControl.spec.tsx +19 -24
- package/src/components/FormElements/FileUploadControl/FileUploadControl.spec.tsx +67 -60
- package/src/components/FormElements/FormElementContainer/FormElementContainer.spec.tsx +13 -12
- package/src/components/FormElements/FormGroup/FormGroup.scss +62 -0
- package/src/components/FormElements/FormGroup/FormGroup.stories.tsx +25 -0
- package/src/components/FormElements/FormGroup/FormGroup.tsx +60 -0
- package/src/components/FormElements/FormGroupTitle/FormGroupTitle.tsx +5 -0
- package/src/components/FormElements/Link/LinkField.spec.tsx +24 -23
- package/src/components/FormElements/MaskedSingleLineText/MaskedSingleLineText.spec.tsx +4 -3
- package/src/components/FormElements/Radio/Radio.spec.tsx +170 -172
- package/src/components/FormElements/ReadOnly/ReadOnlyField.spec.tsx +23 -22
- package/src/components/FormElements/ReadOnlyText/ReadOnlyTextField.spec.tsx +23 -22
- package/src/components/FormElements/Select/Select.spec.tsx +30 -29
- package/src/components/FormElements/SingleLineText/SingleLineText.spec.tsx +46 -42
- package/src/components/FormElements/Tags/Tags.spec.tsx +59 -53
- package/src/components/FormElements/TextArea/TextArea.spec.tsx +44 -29
- package/src/components/FormElements/ToggleButton/ToggleButton.spec.tsx +188 -165
- package/src/components/FormElements/index.ts +1 -0
- package/src/components/FormStation/FormStation.spec.tsx +273 -198
- package/src/components/FormStation/FormStation.stories.tsx +15 -13
- package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +5 -3
- package/src/components/FormStation/SaveOnNavigate/SaveOnNavigate.spec.tsx +23 -20
- package/src/components/FormStation/SaveOnNavigate/handleNavigationAttempt.spec.ts +25 -24
- package/src/components/FormStation/helpers/useTitle.spec.ts +9 -7
- package/src/components/Hub/Hub.spec.tsx +13 -10
- package/src/components/Hub/Tile/Tile.spec.tsx +29 -25
- package/src/components/Icons/Icons.spec.tsx +25 -27
- package/src/components/Icons/Icons.tsx +1 -1
- package/src/components/InfoPanel/InfoImage/InfoImage.spec.tsx +4 -3
- package/src/components/InfoPanel/InfoPanel.scss +2 -0
- package/src/components/InfoPanel/InfoPanel.spec.tsx +4 -3
- package/src/components/InfoPanel/Paragraph/Paragraph.spec.tsx +4 -3
- package/src/components/InfoPanel/Section/Section.spec.tsx +39 -46
- package/src/components/InfoPanel/hooks/useCollapse.ts +9 -7
- package/src/components/InlineMenu/InlineMenu.spec.tsx +24 -23
- package/src/components/InlineMenu/InlineMenu.tsx +3 -0
- package/src/components/LandingPageHeader/LandingPageHeader.spec.tsx +9 -8
- package/src/components/LandingPageTiles/LandingPageTiles.spec.tsx +29 -28
- package/src/components/LandingPageTiles/TileLarge/TileLarge.spec.tsx +68 -61
- package/src/components/LandingPageTiles/TileSmall/TileSmall.spec.tsx +50 -32
- package/src/components/List/List.spec.tsx +337 -241
- package/src/components/List/ListCheckBox/ListCheckBox.spec.tsx +54 -48
- package/src/components/List/ListHeader/ColumnLabel/ColumnLabel.scss +4 -1
- package/src/components/List/ListHeader/ColumnLabel/ColumnLabel.spec.tsx +46 -43
- package/src/components/List/ListHeader/ListHeader.spec.tsx +82 -66
- package/src/components/List/ListRow/ListRow.spec.tsx +125 -130
- package/src/components/List/ListRow/ListRowCell/ListRowCell.spec.tsx +57 -100
- package/src/components/List/ListRow/ListRowLoader.spec.tsx +16 -12
- package/src/components/List/ListRow/Renderers/BooleanDotRenderer/BooleanDotRenderer.spec.tsx +12 -9
- package/src/components/List/ListRow/Renderers/ExternalLinkRenderer/ExternalLinkRenderer.spec.tsx +40 -35
- package/src/components/List/ListRow/Renderers/StateRenderer/StateRenderer.spec.tsx +14 -17
- package/src/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.spec.tsx +18 -17
- package/src/components/List/ListRow/Renderers/TagsRenderer/TagsRenderer.tsx +2 -2
- package/src/components/List/ListRowRenderer/ListRowRenderer.spec.tsx +82 -68
- package/src/components/Loaders/ImageLoader/ImageLoader.spec.tsx +88 -96
- package/src/components/Loaders/Loader/Loader.spec.tsx +51 -24
- package/src/components/Message/Message.spec.tsx +56 -44
- package/src/components/MessageBar/MessageBar.scss +3 -0
- package/src/components/MessageBar/MessageBar.spec.tsx +88 -85
- package/src/components/Modal/Modal.spec.tsx +92 -87
- package/src/components/NavigationAwareStation/NavigationAwareStation.spec.tsx +23 -22
- package/src/components/PageHeader/PageHeader.spec.tsx +22 -21
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +275 -193
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +39 -34
- package/src/components/ProgressBar/ProgressBar.spec.tsx +18 -15
- package/src/components/Utils/Postgraphile/CreateConnectionRenderer.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/FilterTransformer.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/RangeTransformer.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/SortTransformer.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/UpdateGQLFragmentGenerator.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/generateArrayMutations.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/getArrayDiff.spec.ts +1 -0
- package/src/components/Utils/Postgraphile/getFormDiff.spec.ts +1 -0
- package/src/components/Utils/State/GlobalState.spec.ts +4 -2
- package/src/components/Utils/Transformers/Boolean.spec.ts +1 -0
- package/src/components/Utils/Transformers/DateTime.spec.ts +2 -1
- package/src/components/Utils/Transformers/FileSize.spec.ts +1 -0
- package/src/components/Utils/Transformers/SortArray.spec.ts +1 -0
- package/src/components/Utils/Transformers/Timestamp.spec.ts +3 -2
- package/src/components/Utils/Transformers/TitleCase.spec.ts +1 -0
- package/src/components/VisualElements/ImgElement.spec.tsx +34 -35
- package/src/components/VisualElements/SvgElement.spec.tsx +72 -69
- package/src/helpers/testing.ts +9 -76
- package/src/hooks/useBusy/useBusy.spec.tsx +8 -9
- package/src/hooks/useClickOutside/useClickOutside.spec.tsx +19 -51
- package/src/hooks/useDebounce/useDebounce.spec.tsx +31 -26
- package/src/hooks/useExpand/useExpand.spec.tsx +30 -21
- package/src/hooks/useTabTitle/useTabTitle.spec.tsx +18 -18
- package/src/hooks/useValueOrOnDemand/useValueOrOnDemand.spec.tsx +31 -52
- package/src/styles/variables.scss +3 -1
- package/src/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.spec.ts +1 -0
- package/src/utils/ErrorMapper/ErrorMapper.spec.ts +1 -0
- package/src/utils/ErrorTypeToStationError.spec.tsx +12 -11
- package/src/utils/ToolTipHelpers.spec.ts +1 -0
- package/src/validators/timestamp/timestamp.spec.ts +1 -0
- package/dist/helpers/hooksTestingHelpers.d.ts +0 -7
- package/dist/helpers/hooksTestingHelpers.d.ts.map +0 -1
- package/src/helpers/hooksTestingHelpers.tsx +0 -22
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
act,
|
|
3
|
+
cleanup,
|
|
4
|
+
fireEvent,
|
|
5
|
+
render,
|
|
6
|
+
waitFor,
|
|
7
|
+
} from '@testing-library/react';
|
|
2
8
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
9
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
10
|
+
import { afterEach, describe, expect, it, test, vi } from 'vitest';
|
|
5
11
|
import { noop } from '../../../helpers/utils';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { IconName, Icons } from '../../Icons';
|
|
12
|
+
import { ConfirmationConfig } from '../../ConfirmDialog';
|
|
13
|
+
import { IconName } from '../../Icons';
|
|
9
14
|
import {
|
|
10
15
|
Action,
|
|
11
16
|
ActionProps,
|
|
@@ -28,56 +33,60 @@ const defaultNavigationProps: ActionProps = {
|
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
describe('Action', () => {
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
cleanup();
|
|
38
|
+
});
|
|
39
|
+
|
|
31
40
|
it('renders the component without crashing', () => {
|
|
32
|
-
const
|
|
41
|
+
const { container } = render(<Action {...defaultContextProps} />);
|
|
33
42
|
|
|
34
|
-
expect(
|
|
43
|
+
expect(container).toBeTruthy();
|
|
35
44
|
});
|
|
36
45
|
|
|
37
46
|
describe('Navigation Action', () => {
|
|
38
47
|
it('renders a label', () => {
|
|
39
48
|
const mockLabel = defaultNavigationProps.action.label;
|
|
40
|
-
const
|
|
49
|
+
const { getByTestId } = render(
|
|
41
50
|
<Router>
|
|
42
51
|
<Action {...defaultNavigationProps} />
|
|
43
52
|
</Router>,
|
|
44
53
|
);
|
|
45
54
|
|
|
46
|
-
const label =
|
|
55
|
+
const label = getByTestId('label');
|
|
47
56
|
|
|
48
|
-
expect(label.
|
|
57
|
+
expect(label.textContent).toBe(mockLabel);
|
|
49
58
|
});
|
|
50
59
|
|
|
51
60
|
it(`displays a 'ChevronRight' as default icon`, () => {
|
|
52
|
-
const
|
|
61
|
+
const { container } = render(
|
|
53
62
|
<Router>
|
|
54
63
|
<Action {...defaultNavigationProps} />
|
|
55
64
|
</Router>,
|
|
56
65
|
);
|
|
57
66
|
|
|
58
|
-
const
|
|
59
|
-
const
|
|
67
|
+
const actionContainer = container.querySelector('.action-container');
|
|
68
|
+
const icon = container.querySelector('svg');
|
|
60
69
|
|
|
61
|
-
expect(icon
|
|
62
|
-
expect(
|
|
70
|
+
expect(icon).toBeInTheDocument();
|
|
71
|
+
expect(actionContainer?.classList.contains('hasIcon')).toBe(true);
|
|
63
72
|
});
|
|
64
73
|
|
|
65
74
|
it(`displays a 'External' as default icon when "openInNewTab: true"`, () => {
|
|
66
|
-
const
|
|
75
|
+
const { container } = render(
|
|
67
76
|
<Router>
|
|
68
77
|
<Action action={{ label: 'test', path: '/', openInNewTab: true }} />
|
|
69
78
|
</Router>,
|
|
70
79
|
);
|
|
71
80
|
|
|
72
|
-
const
|
|
73
|
-
const
|
|
81
|
+
const actionContainer = container.querySelector('.action-container');
|
|
82
|
+
const icon = container.querySelector('svg');
|
|
74
83
|
|
|
75
|
-
expect(icon
|
|
76
|
-
expect(
|
|
84
|
+
expect(icon).toBeInTheDocument();
|
|
85
|
+
expect(actionContainer?.classList.contains('hasIcon')).toBe(true);
|
|
77
86
|
});
|
|
78
87
|
|
|
79
88
|
it(`disables link when property isDisabled is 'true'`, () => {
|
|
80
|
-
const
|
|
89
|
+
const { container } = render(
|
|
81
90
|
<Router>
|
|
82
91
|
<Action
|
|
83
92
|
action={{ ...defaultNavigationProps.action, isDisabled: true }}
|
|
@@ -85,9 +94,9 @@ describe('Action', () => {
|
|
|
85
94
|
</Router>,
|
|
86
95
|
);
|
|
87
96
|
|
|
88
|
-
const
|
|
97
|
+
const actionContainer = container.querySelector('.action-container');
|
|
89
98
|
|
|
90
|
-
expect(
|
|
99
|
+
expect(actionContainer?.classList.contains('isDisabled')).toBe(true);
|
|
91
100
|
});
|
|
92
101
|
|
|
93
102
|
it(`changes the icon if one provided by props`, () => {
|
|
@@ -95,27 +104,27 @@ describe('Action', () => {
|
|
|
95
104
|
const props = {
|
|
96
105
|
action: { ...defaultNavigationProps.action, icon: iconName },
|
|
97
106
|
};
|
|
98
|
-
const
|
|
107
|
+
const { container } = render(
|
|
99
108
|
<Router>
|
|
100
109
|
<Action {...props} />
|
|
101
110
|
</Router>,
|
|
102
111
|
);
|
|
103
112
|
|
|
104
|
-
const icon =
|
|
113
|
+
const icon = container.querySelector('svg');
|
|
105
114
|
|
|
106
|
-
expect(icon
|
|
115
|
+
expect(icon).toBeInTheDocument();
|
|
107
116
|
});
|
|
108
117
|
|
|
109
118
|
it(`renders a link`, () => {
|
|
110
|
-
const
|
|
119
|
+
const { container } = render(
|
|
111
120
|
<Router>
|
|
112
121
|
<Action {...defaultNavigationProps} />
|
|
113
122
|
</Router>,
|
|
114
123
|
);
|
|
115
124
|
|
|
116
|
-
const link =
|
|
125
|
+
const link = container.querySelector('a');
|
|
117
126
|
|
|
118
|
-
expect(link).
|
|
127
|
+
expect(link).toBeInTheDocument();
|
|
119
128
|
});
|
|
120
129
|
});
|
|
121
130
|
|
|
@@ -123,17 +132,17 @@ describe('Action', () => {
|
|
|
123
132
|
describe('icon', () => {
|
|
124
133
|
it('allows icon to be changed', () => {
|
|
125
134
|
const iconProp: IconName = IconName.Delete;
|
|
126
|
-
const
|
|
135
|
+
const { container } = render(
|
|
127
136
|
<Action action={{ ...defaultContextProps.action, icon: iconProp }} />,
|
|
128
137
|
);
|
|
129
138
|
|
|
130
|
-
const icon =
|
|
139
|
+
const icon = container.querySelector('svg');
|
|
131
140
|
|
|
132
|
-
expect(icon
|
|
141
|
+
expect(icon).toBeInTheDocument();
|
|
133
142
|
});
|
|
134
143
|
|
|
135
144
|
it(`renders no icon by default`, () => {
|
|
136
|
-
const
|
|
145
|
+
const { container } = render(
|
|
137
146
|
<Action
|
|
138
147
|
action={{
|
|
139
148
|
...defaultContextProps.action,
|
|
@@ -141,13 +150,13 @@ describe('Action', () => {
|
|
|
141
150
|
/>,
|
|
142
151
|
);
|
|
143
152
|
|
|
144
|
-
const icon =
|
|
153
|
+
const icon = container.querySelector('svg');
|
|
145
154
|
|
|
146
|
-
expect(icon
|
|
155
|
+
expect(icon).not.toBeInTheDocument();
|
|
147
156
|
});
|
|
148
157
|
|
|
149
158
|
it(`allows an icon for context action`, () => {
|
|
150
|
-
const
|
|
159
|
+
const { container } = render(
|
|
151
160
|
<Action
|
|
152
161
|
action={{
|
|
153
162
|
...defaultContextProps.action,
|
|
@@ -156,15 +165,15 @@ describe('Action', () => {
|
|
|
156
165
|
/>,
|
|
157
166
|
);
|
|
158
167
|
|
|
159
|
-
const icon =
|
|
168
|
+
const icon = container.querySelector('svg');
|
|
160
169
|
|
|
161
|
-
expect(icon
|
|
170
|
+
expect(icon).toBeInTheDocument();
|
|
162
171
|
});
|
|
163
172
|
});
|
|
164
173
|
|
|
165
174
|
it('renders a label', () => {
|
|
166
175
|
const mockLabel = defaultContextProps.action.label;
|
|
167
|
-
const
|
|
176
|
+
const { getByTestId } = render(
|
|
168
177
|
<Action
|
|
169
178
|
{...defaultContextProps}
|
|
170
179
|
action={{
|
|
@@ -174,14 +183,14 @@ describe('Action', () => {
|
|
|
174
183
|
/>,
|
|
175
184
|
);
|
|
176
185
|
|
|
177
|
-
const label =
|
|
186
|
+
const label = getByTestId('label');
|
|
178
187
|
|
|
179
|
-
expect(label.
|
|
188
|
+
expect(label.textContent).toBe(mockLabel);
|
|
180
189
|
});
|
|
181
190
|
|
|
182
191
|
it('raises the onActionSelected event', () => {
|
|
183
|
-
const spy =
|
|
184
|
-
const
|
|
192
|
+
const spy = vi.fn();
|
|
193
|
+
const { getByTestId } = render(
|
|
185
194
|
<Action
|
|
186
195
|
{...defaultContextProps}
|
|
187
196
|
action={{
|
|
@@ -191,13 +200,14 @@ describe('Action', () => {
|
|
|
191
200
|
/>,
|
|
192
201
|
);
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
const action = getByTestId('action');
|
|
204
|
+
fireEvent.click(action);
|
|
195
205
|
|
|
196
206
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
197
207
|
});
|
|
198
208
|
|
|
199
209
|
it(`adds a context background color`, () => {
|
|
200
|
-
const
|
|
210
|
+
const { container } = render(
|
|
201
211
|
<Action
|
|
202
212
|
{...defaultContextProps}
|
|
203
213
|
action={{
|
|
@@ -207,18 +217,18 @@ describe('Action', () => {
|
|
|
207
217
|
/>,
|
|
208
218
|
);
|
|
209
219
|
|
|
210
|
-
const action =
|
|
220
|
+
const action = container.querySelector('.action-container');
|
|
211
221
|
|
|
212
|
-
expect(action.
|
|
222
|
+
expect(action?.classList.contains('context')).toBe(true);
|
|
213
223
|
});
|
|
214
224
|
|
|
215
225
|
describe('confirmation', () => {
|
|
216
226
|
const mockLabel = 'test-label';
|
|
217
227
|
|
|
218
228
|
it(`'Simple' mode changes the background color when clicked for the first time`, () => {
|
|
219
|
-
const spy =
|
|
229
|
+
const spy = vi.fn();
|
|
220
230
|
|
|
221
|
-
const
|
|
231
|
+
const { getByTestId } = render(
|
|
222
232
|
<Action
|
|
223
233
|
{...defaultContextProps}
|
|
224
234
|
action={{
|
|
@@ -228,19 +238,20 @@ describe('Action', () => {
|
|
|
228
238
|
}}
|
|
229
239
|
/>,
|
|
230
240
|
);
|
|
231
|
-
expect(wrapper.hasClass('hasConfirm')).toBe(false);
|
|
232
241
|
|
|
233
|
-
|
|
234
|
-
|
|
242
|
+
const action = getByTestId('action');
|
|
243
|
+
expect(action.classList.contains('hasConfirm')).toBe(false);
|
|
244
|
+
|
|
245
|
+
fireEvent.click(action);
|
|
235
246
|
|
|
236
|
-
expect(
|
|
247
|
+
expect(action.classList.contains('hasConfirm')).toBe(true);
|
|
237
248
|
});
|
|
238
249
|
|
|
239
250
|
it(`'Simple' mode renders a confirmation message, raises the onActionSelected event after confirmation, and resets the action label`, () => {
|
|
240
251
|
const confirmationMsg = 'Click again to confirm';
|
|
241
|
-
const spy =
|
|
252
|
+
const spy = vi.fn();
|
|
242
253
|
|
|
243
|
-
const
|
|
254
|
+
const { getByTestId } = render(
|
|
244
255
|
<Action
|
|
245
256
|
{...defaultContextProps}
|
|
246
257
|
action={{
|
|
@@ -251,30 +262,30 @@ describe('Action', () => {
|
|
|
251
262
|
/>,
|
|
252
263
|
);
|
|
253
264
|
|
|
254
|
-
|
|
265
|
+
const action = getByTestId('action');
|
|
266
|
+
let label = getByTestId('label');
|
|
255
267
|
|
|
256
|
-
expect(
|
|
268
|
+
expect(label.textContent).toBe(mockLabel);
|
|
257
269
|
|
|
258
|
-
|
|
270
|
+
fireEvent.click(action);
|
|
259
271
|
|
|
260
|
-
|
|
272
|
+
const confirmLabel = getByTestId('confirm');
|
|
273
|
+
expect(confirmLabel.textContent).toBe(confirmationMsg);
|
|
261
274
|
|
|
262
|
-
|
|
275
|
+
fireEvent.click(action);
|
|
263
276
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
span = wrapper.find('span');
|
|
277
|
+
label = getByTestId('label');
|
|
267
278
|
|
|
268
279
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
269
|
-
expect(
|
|
280
|
+
expect(label.textContent).toBe(mockLabel);
|
|
270
281
|
});
|
|
271
282
|
|
|
272
283
|
it(`'Simple' mode renders a confirmation message, and doesn't raise the 'onActionSelected' event on 'mouseleave' when confirmation is required`, async () => {
|
|
273
284
|
const confirmationMsg = 'Click again to confirm';
|
|
274
|
-
const spy =
|
|
275
|
-
|
|
285
|
+
const spy = vi.fn();
|
|
286
|
+
vi.useFakeTimers();
|
|
276
287
|
|
|
277
|
-
const
|
|
288
|
+
const { getByTestId } = render(
|
|
278
289
|
<Action
|
|
279
290
|
{...defaultContextProps}
|
|
280
291
|
action={{
|
|
@@ -285,43 +296,37 @@ describe('Action', () => {
|
|
|
285
296
|
/>,
|
|
286
297
|
);
|
|
287
298
|
|
|
288
|
-
|
|
299
|
+
const action = getByTestId('action');
|
|
300
|
+
let label = getByTestId('label');
|
|
289
301
|
|
|
290
|
-
expect(
|
|
302
|
+
expect(label.textContent).toBe(mockLabel);
|
|
291
303
|
|
|
292
|
-
|
|
293
|
-
wrapper.simulate('click');
|
|
294
|
-
});
|
|
295
|
-
wrapper.update();
|
|
304
|
+
fireEvent.click(action);
|
|
296
305
|
|
|
297
|
-
|
|
298
|
-
let container = wrapper.find('.container');
|
|
306
|
+
const confirmLabel = getByTestId('confirm');
|
|
299
307
|
|
|
300
|
-
expect(
|
|
301
|
-
expect(
|
|
308
|
+
expect(confirmLabel.textContent).toBe(confirmationMsg);
|
|
309
|
+
expect(action.classList.contains('hasConfirm')).toBe(true);
|
|
302
310
|
|
|
303
|
-
|
|
304
|
-
await wrapper.simulate('mouseleave');
|
|
305
|
-
});
|
|
306
|
-
wrapper.update();
|
|
311
|
+
fireEvent.mouseLeave(action);
|
|
307
312
|
|
|
308
|
-
|
|
309
|
-
jest.runAllTimers();
|
|
310
|
-
});
|
|
311
|
-
wrapper.update();
|
|
313
|
+
vi.runAllTimers();
|
|
312
314
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
+
await waitFor(() => {
|
|
316
|
+
label = getByTestId('label');
|
|
317
|
+
expect(label.textContent).toBe(mockLabel);
|
|
318
|
+
});
|
|
315
319
|
|
|
316
|
-
expect(span.text()).toBe(mockLabel);
|
|
317
320
|
expect(spy).not.toHaveBeenCalled();
|
|
318
|
-
expect(
|
|
321
|
+
expect(action.classList.contains('hasConfirm')).toBe(false);
|
|
322
|
+
|
|
323
|
+
vi.useRealTimers();
|
|
319
324
|
});
|
|
320
325
|
|
|
321
326
|
it(`'Advanced' mode changes the background color when clicked for the first time`, () => {
|
|
322
|
-
const spy =
|
|
327
|
+
const spy = vi.fn();
|
|
323
328
|
|
|
324
|
-
const
|
|
329
|
+
const { getByTestId } = render(
|
|
325
330
|
<Action
|
|
326
331
|
{...defaultContextProps}
|
|
327
332
|
action={{
|
|
@@ -331,20 +336,19 @@ describe('Action', () => {
|
|
|
331
336
|
}}
|
|
332
337
|
/>,
|
|
333
338
|
);
|
|
334
|
-
expect(wrapper.hasClass('hasConfirm')).toBe(false);
|
|
335
339
|
|
|
336
|
-
|
|
337
|
-
|
|
340
|
+
const action = getByTestId('action');
|
|
341
|
+
expect(action.classList.contains('hasConfirm')).toBe(false);
|
|
338
342
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
);
|
|
343
|
+
fireEvent.click(action);
|
|
344
|
+
|
|
345
|
+
expect(action.classList.contains('hasConfirm')).toBe(true);
|
|
342
346
|
});
|
|
343
347
|
|
|
344
348
|
it(`'Advanced' mode renders a confirmation pop up, raises the 'onActionSelected' event after the 'Confirm' button is clicked, and finally dismisses the confirmation pop up`, () => {
|
|
345
|
-
const spy =
|
|
349
|
+
const spy = vi.fn();
|
|
346
350
|
|
|
347
|
-
const
|
|
351
|
+
const { queryByText, getByText, getByTestId } = render(
|
|
348
352
|
<Action
|
|
349
353
|
{...defaultContextProps}
|
|
350
354
|
action={{
|
|
@@ -355,36 +359,26 @@ describe('Action', () => {
|
|
|
355
359
|
/>,
|
|
356
360
|
);
|
|
357
361
|
|
|
358
|
-
let
|
|
359
|
-
|
|
360
|
-
expect(confirmation.exists()).toBe(false);
|
|
361
|
-
|
|
362
|
-
act(() => {
|
|
363
|
-
wrapper.simulate('click');
|
|
364
|
-
});
|
|
365
|
-
wrapper.update();
|
|
366
|
-
|
|
367
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
368
|
-
|
|
369
|
-
expect(confirmation.exists()).toBe(true);
|
|
362
|
+
let confirmButton = queryByText('Confirm');
|
|
363
|
+
expect(confirmButton).not.toBeInTheDocument();
|
|
370
364
|
|
|
371
|
-
const
|
|
365
|
+
const action = getByTestId('action');
|
|
366
|
+
fireEvent.click(action);
|
|
372
367
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
});
|
|
376
|
-
wrapper.update();
|
|
368
|
+
confirmButton = getByText('Confirm');
|
|
369
|
+
expect(confirmButton).toBeInTheDocument();
|
|
377
370
|
|
|
378
|
-
|
|
371
|
+
fireEvent.click(confirmButton);
|
|
379
372
|
|
|
380
|
-
|
|
373
|
+
confirmButton = queryByText('Confirm');
|
|
374
|
+
expect(confirmButton).not.toBeInTheDocument();
|
|
381
375
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
382
376
|
});
|
|
383
377
|
|
|
384
378
|
it(`'Advanced' mode renders a confirmation pop up, does not raise the 'onActionSelected' event after the 'Cancel' button is clicked, and finally dismisses the confirmation pop up`, () => {
|
|
385
|
-
const spy =
|
|
379
|
+
const spy = vi.fn();
|
|
386
380
|
|
|
387
|
-
const
|
|
381
|
+
const { queryByText, getByText, getByTestId } = render(
|
|
388
382
|
<Action
|
|
389
383
|
{...defaultContextProps}
|
|
390
384
|
action={{
|
|
@@ -395,36 +389,26 @@ describe('Action', () => {
|
|
|
395
389
|
/>,
|
|
396
390
|
);
|
|
397
391
|
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
expect(confirmation.exists()).toBe(false);
|
|
401
|
-
|
|
402
|
-
act(() => {
|
|
403
|
-
wrapper.simulate('click');
|
|
404
|
-
});
|
|
405
|
-
wrapper.update();
|
|
406
|
-
|
|
407
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
408
|
-
|
|
409
|
-
expect(confirmation.exists()).toBe(true);
|
|
392
|
+
let cancelButton = queryByText('Cancel');
|
|
393
|
+
expect(cancelButton).not.toBeInTheDocument();
|
|
410
394
|
|
|
411
|
-
const
|
|
395
|
+
const action = getByTestId('action');
|
|
396
|
+
fireEvent.click(action);
|
|
412
397
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
});
|
|
416
|
-
wrapper.update();
|
|
398
|
+
cancelButton = getByText('Cancel');
|
|
399
|
+
expect(cancelButton).toBeInTheDocument();
|
|
417
400
|
|
|
418
|
-
|
|
401
|
+
fireEvent.click(cancelButton);
|
|
419
402
|
|
|
420
|
-
|
|
403
|
+
cancelButton = queryByText('Cancel');
|
|
404
|
+
expect(cancelButton).not.toBeInTheDocument();
|
|
421
405
|
});
|
|
422
406
|
|
|
423
407
|
it(`'Advanced' mode renders a confirmation pop up, does not raise the 'onActionSelected' event when the mouse leaves component, and finally dismisses the confirmation pop up`, async () => {
|
|
424
|
-
const spy =
|
|
425
|
-
|
|
408
|
+
const spy = vi.fn();
|
|
409
|
+
vi.useFakeTimers();
|
|
426
410
|
|
|
427
|
-
const
|
|
411
|
+
const { queryByText, getByText, getByTestId } = render(
|
|
428
412
|
<Action
|
|
429
413
|
{...defaultContextProps}
|
|
430
414
|
action={{
|
|
@@ -435,35 +419,27 @@ describe('Action', () => {
|
|
|
435
419
|
/>,
|
|
436
420
|
);
|
|
437
421
|
|
|
438
|
-
let
|
|
439
|
-
|
|
440
|
-
expect(confirmation.exists()).toBe(false);
|
|
441
|
-
|
|
442
|
-
await act(async () => {
|
|
443
|
-
wrapper.simulate('click');
|
|
444
|
-
});
|
|
445
|
-
wrapper.update();
|
|
446
|
-
|
|
447
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
422
|
+
let confirmButton = queryByText('Confirm');
|
|
423
|
+
expect(confirmButton).not.toBeInTheDocument();
|
|
448
424
|
|
|
449
|
-
|
|
425
|
+
const action = getByTestId('action');
|
|
426
|
+
fireEvent.click(action);
|
|
450
427
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
wrapper.update();
|
|
428
|
+
confirmButton = getByText('Confirm');
|
|
429
|
+
expect(confirmButton).toBeInTheDocument();
|
|
456
430
|
|
|
457
|
-
|
|
458
|
-
jest.runAllTimers();
|
|
459
|
-
});
|
|
460
|
-
wrapper.update();
|
|
431
|
+
fireEvent.mouseLeave(action);
|
|
461
432
|
|
|
462
|
-
|
|
433
|
+
vi.runAllTimers();
|
|
463
434
|
|
|
464
435
|
// TODO: Debug why this isn't passing
|
|
465
|
-
//
|
|
436
|
+
// await waitFor(() => {
|
|
437
|
+
// confirmButton = queryByText('Confirm');
|
|
438
|
+
// expect(confirmButton).not.toBeInTheDocument();
|
|
439
|
+
// });
|
|
466
440
|
expect(spy).not.toHaveBeenCalled();
|
|
441
|
+
|
|
442
|
+
vi.useRealTimers();
|
|
467
443
|
});
|
|
468
444
|
|
|
469
445
|
it(`'Advanced' mode accepts a 'confirmationConfig' object`, () => {
|
|
@@ -473,7 +449,7 @@ describe('Action', () => {
|
|
|
473
449
|
cancelButtonText: 'test-cancel',
|
|
474
450
|
confirmButtonText: 'test-confirm',
|
|
475
451
|
};
|
|
476
|
-
const
|
|
452
|
+
const { getByText, getByTestId } = render(
|
|
477
453
|
<Action
|
|
478
454
|
{...defaultContextProps}
|
|
479
455
|
action={{
|
|
@@ -485,27 +461,23 @@ describe('Action', () => {
|
|
|
485
461
|
/>,
|
|
486
462
|
);
|
|
487
463
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
expect(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
);
|
|
500
|
-
expect(confirmation.prop('confirmButtonText')).toBe(
|
|
501
|
-
mockConfig.confirmButtonText,
|
|
502
|
-
);
|
|
464
|
+
const action = getByTestId('action');
|
|
465
|
+
fireEvent.click(action);
|
|
466
|
+
|
|
467
|
+
expect(getByText(mockConfig.title as string)).toBeInTheDocument();
|
|
468
|
+
expect(getByText(mockConfig.body as string)).toBeInTheDocument();
|
|
469
|
+
expect(
|
|
470
|
+
getByText(mockConfig.cancelButtonText as string),
|
|
471
|
+
).toBeInTheDocument();
|
|
472
|
+
expect(
|
|
473
|
+
getByText(mockConfig.confirmButtonText as string),
|
|
474
|
+
).toBeInTheDocument();
|
|
503
475
|
});
|
|
504
476
|
|
|
505
477
|
it(`'Simple' raises onConfirmOpen if set`, () => {
|
|
506
|
-
const confirmToggleSpy =
|
|
478
|
+
const confirmToggleSpy = vi.fn();
|
|
507
479
|
|
|
508
|
-
const
|
|
480
|
+
const { getByTestId } = render(
|
|
509
481
|
<Action
|
|
510
482
|
{...defaultContextProps}
|
|
511
483
|
action={{
|
|
@@ -517,29 +489,27 @@ describe('Action', () => {
|
|
|
517
489
|
/>,
|
|
518
490
|
);
|
|
519
491
|
|
|
492
|
+
const action = getByTestId('action');
|
|
493
|
+
|
|
520
494
|
// toggle confirmation on
|
|
521
|
-
|
|
522
|
-
wrapper.simulate('click');
|
|
523
|
-
});
|
|
495
|
+
fireEvent.click(action);
|
|
524
496
|
|
|
525
497
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(1);
|
|
526
498
|
|
|
527
499
|
// toggle confirmation off
|
|
528
|
-
|
|
529
|
-
wrapper.simulate('click');
|
|
530
|
-
});
|
|
500
|
+
fireEvent.click(action);
|
|
531
501
|
|
|
532
502
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
533
503
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true);
|
|
534
504
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(2, false);
|
|
535
505
|
});
|
|
536
506
|
|
|
537
|
-
it(`'Simple' raises onConfirmOpen when 'mouseleave' if set`,
|
|
538
|
-
const confirmToggleSpy =
|
|
507
|
+
it(`'Simple' raises onConfirmOpen when 'mouseleave' if set`, () => {
|
|
508
|
+
const confirmToggleSpy = vi.fn();
|
|
539
509
|
|
|
540
|
-
|
|
510
|
+
vi.useFakeTimers();
|
|
541
511
|
|
|
542
|
-
const
|
|
512
|
+
const { getByTestId } = render(
|
|
543
513
|
<Action
|
|
544
514
|
{...defaultContextProps}
|
|
545
515
|
action={{
|
|
@@ -551,30 +521,31 @@ describe('Action', () => {
|
|
|
551
521
|
/>,
|
|
552
522
|
);
|
|
553
523
|
|
|
554
|
-
|
|
555
|
-
|
|
524
|
+
const action = getByTestId('action');
|
|
525
|
+
|
|
526
|
+
act(() => {
|
|
527
|
+
fireEvent.click(action);
|
|
556
528
|
});
|
|
557
|
-
wrapper.update();
|
|
558
529
|
|
|
559
|
-
|
|
560
|
-
|
|
530
|
+
act(() => {
|
|
531
|
+
fireEvent.mouseLeave(action);
|
|
561
532
|
});
|
|
562
|
-
wrapper.update();
|
|
563
533
|
|
|
564
|
-
|
|
565
|
-
|
|
534
|
+
act(() => {
|
|
535
|
+
vi.runAllTimers();
|
|
566
536
|
});
|
|
567
|
-
wrapper.update();
|
|
568
537
|
|
|
569
538
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
570
539
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true);
|
|
571
540
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(2, false);
|
|
541
|
+
|
|
542
|
+
vi.useRealTimers();
|
|
572
543
|
});
|
|
573
544
|
|
|
574
545
|
it(`'Advanced' raises onConfirmOpen when 'Cancel' is clicked, if set`, () => {
|
|
575
|
-
const confirmToggleSpy =
|
|
546
|
+
const confirmToggleSpy = vi.fn();
|
|
576
547
|
|
|
577
|
-
const
|
|
548
|
+
const { getByTestId, getByText } = render(
|
|
578
549
|
<Action
|
|
579
550
|
{...defaultContextProps}
|
|
580
551
|
action={{
|
|
@@ -586,18 +557,13 @@ describe('Action', () => {
|
|
|
586
557
|
/>,
|
|
587
558
|
);
|
|
588
559
|
|
|
589
|
-
|
|
590
|
-
act(() => {
|
|
591
|
-
wrapper.simulate('click');
|
|
592
|
-
});
|
|
593
|
-
wrapper.update();
|
|
560
|
+
const action = getByTestId('action');
|
|
594
561
|
|
|
595
|
-
|
|
562
|
+
// toggle confirmation on
|
|
563
|
+
fireEvent.click(action);
|
|
596
564
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
});
|
|
600
|
-
wrapper.update();
|
|
565
|
+
const cancelButton = getByText('Cancel');
|
|
566
|
+
fireEvent.click(cancelButton);
|
|
601
567
|
|
|
602
568
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
603
569
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true);
|
|
@@ -605,9 +571,9 @@ describe('Action', () => {
|
|
|
605
571
|
});
|
|
606
572
|
|
|
607
573
|
it(`'Advanced' raises onConfirmOpen when 'Confirm' is clicked, if set`, () => {
|
|
608
|
-
const confirmToggleSpy =
|
|
574
|
+
const confirmToggleSpy = vi.fn();
|
|
609
575
|
|
|
610
|
-
const
|
|
576
|
+
const { getByTestId, getByText } = render(
|
|
611
577
|
<Action
|
|
612
578
|
{...defaultContextProps}
|
|
613
579
|
action={{
|
|
@@ -619,18 +585,13 @@ describe('Action', () => {
|
|
|
619
585
|
/>,
|
|
620
586
|
);
|
|
621
587
|
|
|
622
|
-
|
|
623
|
-
act(() => {
|
|
624
|
-
wrapper.simulate('click');
|
|
625
|
-
});
|
|
626
|
-
wrapper.update();
|
|
588
|
+
const action = getByTestId('action');
|
|
627
589
|
|
|
628
|
-
|
|
590
|
+
// toggle confirmation on
|
|
591
|
+
fireEvent.click(action);
|
|
629
592
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
});
|
|
633
|
-
wrapper.update();
|
|
593
|
+
const confirmButton = getByText('Confirm');
|
|
594
|
+
fireEvent.click(confirmButton);
|
|
634
595
|
|
|
635
596
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
636
597
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true);
|
|
@@ -647,7 +608,7 @@ describe('isNavigationAction', () => {
|
|
|
647
608
|
});
|
|
648
609
|
|
|
649
610
|
test('returns false for a ContextActionData object', () => {
|
|
650
|
-
const action = { label: 'Context Action', onActionSelected:
|
|
611
|
+
const action = { label: 'Context Action', onActionSelected: vi.fn() };
|
|
651
612
|
expect(isNavigationAction(action)).toBe(false);
|
|
652
613
|
});
|
|
653
614
|
|
|
@@ -663,7 +624,7 @@ describe('isNavigationAction', () => {
|
|
|
663
624
|
|
|
664
625
|
describe('isContextAction', () => {
|
|
665
626
|
test('returns true for a ContextActionData object', () => {
|
|
666
|
-
const action = { label: 'Context Action', onActionSelected:
|
|
627
|
+
const action = { label: 'Context Action', onActionSelected: vi.fn() };
|
|
667
628
|
expect(isContextAction(action)).toBe(true);
|
|
668
629
|
});
|
|
669
630
|
|