@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,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import {
|
|
4
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
6
|
import { noop } from '../../../helpers/utils';
|
|
6
|
-
import {
|
|
7
|
-
import { ConfirmDialog, ConfirmationConfig } from '../../ConfirmDialog';
|
|
7
|
+
import { ConfirmationConfig } from '../../ConfirmDialog';
|
|
8
8
|
import { IconName } from '../../Icons';
|
|
9
9
|
import {
|
|
10
10
|
PageHeaderAction,
|
|
@@ -24,25 +24,25 @@ const defaultProps: PageHeaderActionProps = {
|
|
|
24
24
|
describe('PageHeaderAction', () => {
|
|
25
25
|
describe('PageHeaderJSAction', () => {
|
|
26
26
|
it('renders the component without crashing', () => {
|
|
27
|
-
const
|
|
27
|
+
const { container } = render(<PageHeaderAction {...defaultProps} />);
|
|
28
28
|
|
|
29
|
-
expect(
|
|
29
|
+
expect(container).toBeTruthy();
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it('renders a label', () => {
|
|
33
33
|
const mockLabel = 'test-label';
|
|
34
|
-
const
|
|
34
|
+
const { container } = render(
|
|
35
35
|
<PageHeaderAction {...defaultProps} label={mockLabel} />,
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
const label =
|
|
38
|
+
const label = container.querySelector('span');
|
|
39
39
|
|
|
40
|
-
expect(label
|
|
40
|
+
expect(label?.textContent).toBe(mockLabel);
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it('renders a Icon, if set', () => {
|
|
44
44
|
const mockLabel = 'test-label';
|
|
45
|
-
const
|
|
45
|
+
const { container } = render(
|
|
46
46
|
<PageHeaderAction
|
|
47
47
|
{...defaultProps}
|
|
48
48
|
label={mockLabel}
|
|
@@ -50,14 +50,14 @@ describe('PageHeaderAction', () => {
|
|
|
50
50
|
/>,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
const Icon =
|
|
53
|
+
const Icon = container.querySelector('.icons');
|
|
54
54
|
|
|
55
|
-
expect(Icon
|
|
55
|
+
expect(Icon).toBeInTheDocument();
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('image is used instead of icon if icon prop is a string', () => {
|
|
59
59
|
const mockLabel = 'test-label';
|
|
60
|
-
const
|
|
60
|
+
const { container } = render(
|
|
61
61
|
<PageHeaderAction
|
|
62
62
|
{...defaultProps}
|
|
63
63
|
label={mockLabel}
|
|
@@ -66,27 +66,29 @@ describe('PageHeaderAction', () => {
|
|
|
66
66
|
/>,
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
const Icon =
|
|
69
|
+
const Icon = container.querySelector('.icons');
|
|
70
70
|
|
|
71
|
-
expect(Icon
|
|
71
|
+
expect(Icon).not.toBeInTheDocument();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it('raises onActionSelected', () => {
|
|
75
|
-
const spy =
|
|
76
|
-
const
|
|
75
|
+
const spy = vi.fn();
|
|
76
|
+
const { container } = render(
|
|
77
77
|
<PageHeaderAction {...defaultProps} onClick={spy} />,
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const actionContainer = container.querySelector(
|
|
81
|
+
'.container',
|
|
82
|
+
) as HTMLElement;
|
|
83
|
+
fireEvent.click(actionContainer);
|
|
82
84
|
|
|
83
85
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
describe('confirmation', () => {
|
|
87
89
|
it(`'Simple' mode changes the background color when clicked for the first time`, () => {
|
|
88
|
-
const spy =
|
|
89
|
-
const
|
|
90
|
+
const spy = vi.fn();
|
|
91
|
+
const { container } = render(
|
|
90
92
|
<PageHeaderAction
|
|
91
93
|
{...defaultProps}
|
|
92
94
|
label={'test-label'}
|
|
@@ -94,22 +96,23 @@ describe('PageHeaderAction', () => {
|
|
|
94
96
|
onClick={spy}
|
|
95
97
|
/>,
|
|
96
98
|
);
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
+
let actionContainer = container.querySelector(
|
|
100
|
+
'.container',
|
|
101
|
+
) as HTMLElement;
|
|
102
|
+
expect(actionContainer.classList.contains('hasConfirm')).toBe(false);
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
wrapper.update();
|
|
104
|
+
fireEvent.click(actionContainer);
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
actionContainer = container.querySelector('.container') as HTMLElement;
|
|
104
107
|
|
|
105
|
-
expect(
|
|
108
|
+
expect(actionContainer.classList.contains('hasConfirm')).toBe(true);
|
|
106
109
|
});
|
|
107
110
|
|
|
108
111
|
it(`'Simple' mode renders a confirmation message, raises the 'onClick' event after confirmation, and resets the action label`, () => {
|
|
109
112
|
const mockLabel = 'test-label';
|
|
110
113
|
const confirmationMsg = 'Click again to confirm';
|
|
111
|
-
const spy =
|
|
112
|
-
const
|
|
114
|
+
const spy = vi.fn();
|
|
115
|
+
const { container } = render(
|
|
113
116
|
<PageHeaderAction
|
|
114
117
|
{...defaultProps}
|
|
115
118
|
label={mockLabel}
|
|
@@ -118,31 +121,34 @@ describe('PageHeaderAction', () => {
|
|
|
118
121
|
/>,
|
|
119
122
|
);
|
|
120
123
|
|
|
121
|
-
let span =
|
|
124
|
+
let span = container.querySelector('span') as HTMLElement;
|
|
122
125
|
|
|
123
|
-
expect(span.
|
|
126
|
+
expect(span.textContent).toBe(mockLabel);
|
|
124
127
|
|
|
125
|
-
|
|
128
|
+
const actionContainer = container.querySelector(
|
|
129
|
+
'.container',
|
|
130
|
+
) as HTMLElement;
|
|
131
|
+
fireEvent.click(actionContainer);
|
|
126
132
|
|
|
127
|
-
span =
|
|
133
|
+
span = container.querySelector('span') as HTMLElement;
|
|
128
134
|
|
|
129
|
-
expect(span.
|
|
135
|
+
expect(span.textContent).toBe(confirmationMsg);
|
|
130
136
|
|
|
131
|
-
|
|
137
|
+
fireEvent.click(actionContainer);
|
|
132
138
|
|
|
133
|
-
span =
|
|
139
|
+
span = container.querySelector('span') as HTMLElement;
|
|
134
140
|
|
|
135
141
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
136
|
-
expect(span.
|
|
142
|
+
expect(span.textContent).toBe(mockLabel);
|
|
137
143
|
});
|
|
138
144
|
|
|
139
145
|
it(`'Simple' mode renders a confirmation message, and doesn't raise the 'onClick' event on 'mouseleave' when confirmation is required`, async () => {
|
|
140
146
|
const mockLabel = 'test-label';
|
|
141
147
|
const confirmationMsg = 'Click again to confirm';
|
|
142
|
-
const spy =
|
|
143
|
-
|
|
148
|
+
const spy = vi.fn();
|
|
149
|
+
vi.useFakeTimers();
|
|
144
150
|
|
|
145
|
-
const
|
|
151
|
+
const { container } = render(
|
|
146
152
|
<PageHeaderAction
|
|
147
153
|
{...defaultProps}
|
|
148
154
|
label={mockLabel}
|
|
@@ -151,39 +157,42 @@ describe('PageHeaderAction', () => {
|
|
|
151
157
|
/>,
|
|
152
158
|
);
|
|
153
159
|
|
|
160
|
+
const actionContainer = container.querySelector(
|
|
161
|
+
'.container',
|
|
162
|
+
) as HTMLElement;
|
|
163
|
+
|
|
154
164
|
await act(async () => {
|
|
155
|
-
|
|
165
|
+
fireEvent.click(actionContainer);
|
|
156
166
|
});
|
|
157
|
-
wrapper.update();
|
|
158
167
|
|
|
159
|
-
let span =
|
|
160
|
-
let
|
|
168
|
+
let span = container.querySelector('span') as HTMLElement;
|
|
169
|
+
let containerElement = container.querySelector(
|
|
170
|
+
'.container',
|
|
171
|
+
) as HTMLElement;
|
|
161
172
|
|
|
162
|
-
expect(
|
|
163
|
-
expect(span.
|
|
173
|
+
expect(containerElement.classList.contains('hasConfirm')).toBe(true);
|
|
174
|
+
expect(span.textContent).toBe(confirmationMsg);
|
|
164
175
|
expect(spy).not.toHaveBeenCalled();
|
|
165
176
|
|
|
166
177
|
await act(async () => {
|
|
167
|
-
|
|
178
|
+
fireEvent.mouseLeave(actionContainer);
|
|
168
179
|
});
|
|
169
|
-
wrapper.update();
|
|
170
180
|
|
|
171
181
|
await act(async () => {
|
|
172
|
-
|
|
182
|
+
vi.runAllTimers();
|
|
173
183
|
});
|
|
174
|
-
wrapper.update();
|
|
175
184
|
|
|
176
|
-
span =
|
|
177
|
-
|
|
185
|
+
span = container.querySelector('span') as HTMLElement;
|
|
186
|
+
containerElement = container.querySelector('.container') as HTMLElement;
|
|
178
187
|
|
|
179
|
-
expect(span.
|
|
188
|
+
expect(span.textContent).toBe(mockLabel);
|
|
180
189
|
expect(spy).not.toHaveBeenCalled();
|
|
181
|
-
expect(
|
|
190
|
+
expect(containerElement.classList.contains('hasConfirm')).toBe(false);
|
|
182
191
|
});
|
|
183
192
|
|
|
184
193
|
it(`'Advanced' mode changes the background color when clicked for the first time`, async () => {
|
|
185
|
-
const spy =
|
|
186
|
-
const
|
|
194
|
+
const spy = vi.fn();
|
|
195
|
+
const { container } = render(
|
|
187
196
|
<PageHeaderAction
|
|
188
197
|
{...defaultProps}
|
|
189
198
|
label={'test-label'}
|
|
@@ -191,22 +200,23 @@ describe('PageHeaderAction', () => {
|
|
|
191
200
|
onClick={spy}
|
|
192
201
|
/>,
|
|
193
202
|
);
|
|
194
|
-
let
|
|
195
|
-
|
|
203
|
+
let actionContainer = container.querySelector(
|
|
204
|
+
'.container',
|
|
205
|
+
) as HTMLElement;
|
|
206
|
+
expect(actionContainer.classList.contains('hasConfirm')).toBe(false);
|
|
196
207
|
|
|
197
208
|
await act(async () => {
|
|
198
|
-
|
|
209
|
+
fireEvent.click(actionContainer);
|
|
199
210
|
});
|
|
200
|
-
wrapper.update();
|
|
201
211
|
|
|
202
|
-
|
|
212
|
+
actionContainer = container.querySelector('.container') as HTMLElement;
|
|
203
213
|
|
|
204
|
-
expect(
|
|
214
|
+
expect(actionContainer.classList.contains('hasConfirm')).toBe(true);
|
|
205
215
|
});
|
|
206
216
|
|
|
207
217
|
it(`'Advanced' mode confirmation pop up, raises the 'onClick' event after the 'Confirm' button is clicked, and finally dismisses the confirmation pop up`, async () => {
|
|
208
|
-
const spy =
|
|
209
|
-
const
|
|
218
|
+
const spy = vi.fn();
|
|
219
|
+
const { container } = render(
|
|
210
220
|
<PageHeaderAction
|
|
211
221
|
{...defaultProps}
|
|
212
222
|
label={'test-label'}
|
|
@@ -214,35 +224,45 @@ describe('PageHeaderAction', () => {
|
|
|
214
224
|
onClick={spy}
|
|
215
225
|
/>,
|
|
216
226
|
);
|
|
217
|
-
let confirmation =
|
|
227
|
+
let confirmation = container.querySelector('.confirmDialog');
|
|
228
|
+
|
|
229
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
218
230
|
|
|
219
|
-
|
|
231
|
+
const actionContainer = container.querySelector(
|
|
232
|
+
'.container',
|
|
233
|
+
) as HTMLElement;
|
|
220
234
|
|
|
221
235
|
await act(async () => {
|
|
222
|
-
|
|
236
|
+
fireEvent.click(actionContainer);
|
|
223
237
|
});
|
|
224
|
-
wrapper.update();
|
|
225
|
-
|
|
226
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
227
238
|
|
|
228
|
-
|
|
239
|
+
await waitFor(() => {
|
|
240
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
241
|
+
expect(confirmation).toBeInTheDocument();
|
|
242
|
+
});
|
|
229
243
|
|
|
230
|
-
const confirmButton =
|
|
244
|
+
const confirmButton = document.querySelector(
|
|
245
|
+
'[data-test-id="confirm"]',
|
|
246
|
+
) as HTMLButtonElement;
|
|
231
247
|
|
|
232
248
|
act(() => {
|
|
233
|
-
|
|
249
|
+
fireEvent.click(confirmButton);
|
|
234
250
|
});
|
|
235
|
-
wrapper.update();
|
|
236
251
|
|
|
237
|
-
|
|
252
|
+
await waitFor(
|
|
253
|
+
() => {
|
|
254
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
255
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
256
|
+
},
|
|
257
|
+
{ timeout: 1000 },
|
|
258
|
+
);
|
|
238
259
|
|
|
239
|
-
expect(confirmation.exists()).toBe(false);
|
|
240
260
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
241
261
|
});
|
|
242
262
|
|
|
243
263
|
it(`'Advanced' mode confirmation pop up, does not raise the 'onClick' event after the 'Cancel' button is clicked, and finally dismisses the confirmation pop up`, async () => {
|
|
244
|
-
const spy =
|
|
245
|
-
const
|
|
264
|
+
const spy = vi.fn();
|
|
265
|
+
const { container } = render(
|
|
246
266
|
<PageHeaderAction
|
|
247
267
|
{...defaultProps}
|
|
248
268
|
label={'test-label'}
|
|
@@ -250,37 +270,47 @@ describe('PageHeaderAction', () => {
|
|
|
250
270
|
onClick={spy}
|
|
251
271
|
/>,
|
|
252
272
|
);
|
|
253
|
-
let confirmation =
|
|
273
|
+
let confirmation = container.querySelector('.confirmDialog');
|
|
274
|
+
|
|
275
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
254
276
|
|
|
255
|
-
|
|
277
|
+
const actionContainer = container.querySelector(
|
|
278
|
+
'.container',
|
|
279
|
+
) as HTMLElement;
|
|
256
280
|
|
|
257
281
|
await act(async () => {
|
|
258
|
-
|
|
282
|
+
fireEvent.click(actionContainer);
|
|
259
283
|
});
|
|
260
|
-
wrapper.update();
|
|
261
284
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
285
|
+
await waitFor(() => {
|
|
286
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
287
|
+
expect(confirmation).toBeInTheDocument();
|
|
288
|
+
});
|
|
265
289
|
|
|
266
|
-
const
|
|
290
|
+
const cancelButton = document.querySelector(
|
|
291
|
+
'[data-test-id="cancel"]',
|
|
292
|
+
) as HTMLButtonElement;
|
|
267
293
|
|
|
268
294
|
act(() => {
|
|
269
|
-
|
|
295
|
+
fireEvent.click(cancelButton);
|
|
270
296
|
});
|
|
271
|
-
wrapper.update();
|
|
272
297
|
|
|
273
|
-
|
|
298
|
+
await waitFor(
|
|
299
|
+
() => {
|
|
300
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
301
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
302
|
+
},
|
|
303
|
+
{ timeout: 1000 },
|
|
304
|
+
);
|
|
274
305
|
|
|
275
|
-
expect(confirmation.exists()).toBe(false);
|
|
276
306
|
expect(spy).not.toHaveBeenCalled();
|
|
277
307
|
});
|
|
278
308
|
|
|
279
309
|
it(`'Advanced' mode renders a confirmation pop up, does not raise the 'onClick' event when the mouse leaves component, and finally dismisses the confirmation pop up`, async () => {
|
|
280
|
-
const spy =
|
|
281
|
-
|
|
310
|
+
const spy = vi.fn();
|
|
311
|
+
vi.useFakeTimers();
|
|
282
312
|
|
|
283
|
-
const
|
|
313
|
+
const { container } = render(
|
|
284
314
|
<PageHeaderAction
|
|
285
315
|
{...defaultProps}
|
|
286
316
|
label={'test-label'}
|
|
@@ -288,33 +318,35 @@ describe('PageHeaderAction', () => {
|
|
|
288
318
|
onClick={spy}
|
|
289
319
|
/>,
|
|
290
320
|
);
|
|
291
|
-
let confirmation =
|
|
321
|
+
let confirmation = container.querySelector('.confirmDialog');
|
|
292
322
|
|
|
293
|
-
expect(confirmation
|
|
323
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
324
|
+
|
|
325
|
+
const actionContainer = container.querySelector(
|
|
326
|
+
'.container',
|
|
327
|
+
) as HTMLElement;
|
|
294
328
|
|
|
295
329
|
await act(async () => {
|
|
296
|
-
|
|
330
|
+
fireEvent.click(actionContainer);
|
|
297
331
|
});
|
|
298
|
-
wrapper.update();
|
|
299
|
-
|
|
300
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
301
332
|
|
|
302
|
-
|
|
333
|
+
await waitFor(() => {
|
|
334
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
335
|
+
expect(confirmation).toBeInTheDocument();
|
|
336
|
+
});
|
|
303
337
|
|
|
304
338
|
await act(async () => {
|
|
305
|
-
|
|
339
|
+
fireEvent.mouseLeave(actionContainer);
|
|
306
340
|
});
|
|
307
|
-
wrapper.update();
|
|
308
341
|
|
|
309
342
|
await act(async () => {
|
|
310
|
-
|
|
343
|
+
vi.runAllTimers();
|
|
311
344
|
});
|
|
312
|
-
wrapper.update();
|
|
313
345
|
|
|
314
|
-
confirmation =
|
|
346
|
+
confirmation = container.querySelector('.confirmDialog');
|
|
315
347
|
|
|
316
348
|
// TODO: Debug why this isn't passing
|
|
317
|
-
// expect(confirmation
|
|
349
|
+
// expect(confirmation).not.toBeInTheDocument();
|
|
318
350
|
expect(spy).not.toHaveBeenCalled();
|
|
319
351
|
});
|
|
320
352
|
|
|
@@ -326,7 +358,7 @@ describe('PageHeaderAction', () => {
|
|
|
326
358
|
confirmButtonText: 'test-confirm',
|
|
327
359
|
};
|
|
328
360
|
|
|
329
|
-
const
|
|
361
|
+
const { container } = render(
|
|
330
362
|
<PageHeaderAction
|
|
331
363
|
{...defaultProps}
|
|
332
364
|
label={'test-label'}
|
|
@@ -335,27 +367,31 @@ describe('PageHeaderAction', () => {
|
|
|
335
367
|
/>,
|
|
336
368
|
);
|
|
337
369
|
|
|
370
|
+
const actionContainer = container.querySelector(
|
|
371
|
+
'.container',
|
|
372
|
+
) as HTMLElement;
|
|
373
|
+
|
|
338
374
|
await act(async () => {
|
|
339
|
-
|
|
375
|
+
fireEvent.click(actionContainer);
|
|
340
376
|
});
|
|
341
|
-
wrapper.update();
|
|
342
|
-
|
|
343
|
-
const confirmation = wrapper.find(ConfirmDialog);
|
|
344
377
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
mockConfig.
|
|
352
|
-
|
|
378
|
+
await waitFor(() => {
|
|
379
|
+
const confirmation = document.querySelector(
|
|
380
|
+
'.confirm-dialog-container',
|
|
381
|
+
);
|
|
382
|
+
expect(confirmation).toBeInTheDocument();
|
|
383
|
+
// Check rendered content instead of props
|
|
384
|
+
expect(container.textContent).toContain(mockConfig.title);
|
|
385
|
+
expect(container.textContent).toContain(mockConfig.body);
|
|
386
|
+
expect(container.textContent).toContain(mockConfig.cancelButtonText);
|
|
387
|
+
expect(container.textContent).toContain(mockConfig.confirmButtonText);
|
|
388
|
+
});
|
|
353
389
|
});
|
|
354
390
|
|
|
355
391
|
it(`'Simple' raises onConfirmOpen if set`, () => {
|
|
356
|
-
const confirmToggleSpy =
|
|
392
|
+
const confirmToggleSpy = vi.fn();
|
|
357
393
|
|
|
358
|
-
const
|
|
394
|
+
const { container } = render(
|
|
359
395
|
<PageHeaderAction
|
|
360
396
|
{...defaultProps}
|
|
361
397
|
label={'test-label'}
|
|
@@ -364,16 +400,20 @@ describe('PageHeaderAction', () => {
|
|
|
364
400
|
/>,
|
|
365
401
|
);
|
|
366
402
|
|
|
403
|
+
const actionContainer = container.querySelector(
|
|
404
|
+
'.container',
|
|
405
|
+
) as HTMLElement;
|
|
406
|
+
|
|
367
407
|
// toggle confirmation on
|
|
368
408
|
act(() => {
|
|
369
|
-
|
|
409
|
+
fireEvent.click(actionContainer);
|
|
370
410
|
});
|
|
371
411
|
|
|
372
412
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(1);
|
|
373
413
|
|
|
374
414
|
// toggle confirmation off
|
|
375
415
|
act(() => {
|
|
376
|
-
|
|
416
|
+
fireEvent.click(actionContainer);
|
|
377
417
|
});
|
|
378
418
|
|
|
379
419
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
@@ -386,11 +426,11 @@ describe('PageHeaderAction', () => {
|
|
|
386
426
|
});
|
|
387
427
|
|
|
388
428
|
it(`'Simple' raises onConfirmOpen when 'mouseleave' if set`, async () => {
|
|
389
|
-
const confirmToggleSpy =
|
|
429
|
+
const confirmToggleSpy = vi.fn();
|
|
390
430
|
|
|
391
|
-
|
|
431
|
+
vi.useFakeTimers();
|
|
392
432
|
|
|
393
|
-
const
|
|
433
|
+
const { container } = render(
|
|
394
434
|
<PageHeaderAction
|
|
395
435
|
{...defaultProps}
|
|
396
436
|
label={'test-label'}
|
|
@@ -399,20 +439,21 @@ describe('PageHeaderAction', () => {
|
|
|
399
439
|
/>,
|
|
400
440
|
);
|
|
401
441
|
|
|
442
|
+
const actionContainer = container.querySelector(
|
|
443
|
+
'.container',
|
|
444
|
+
) as HTMLElement;
|
|
445
|
+
|
|
402
446
|
await act(async () => {
|
|
403
|
-
|
|
447
|
+
fireEvent.click(actionContainer);
|
|
404
448
|
});
|
|
405
|
-
wrapper.update();
|
|
406
449
|
|
|
407
450
|
await act(async () => {
|
|
408
|
-
|
|
451
|
+
fireEvent.mouseLeave(actionContainer);
|
|
409
452
|
});
|
|
410
|
-
wrapper.update();
|
|
411
453
|
|
|
412
454
|
await act(async () => {
|
|
413
|
-
|
|
455
|
+
vi.runAllTimers();
|
|
414
456
|
});
|
|
415
|
-
wrapper.update();
|
|
416
457
|
|
|
417
458
|
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
418
459
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true, {
|
|
@@ -423,10 +464,10 @@ describe('PageHeaderAction', () => {
|
|
|
423
464
|
});
|
|
424
465
|
});
|
|
425
466
|
|
|
426
|
-
it(`'Advanced' raises onConfirmOpen when 'Cancel' is clicked, if set`, () => {
|
|
427
|
-
const confirmToggleSpy =
|
|
467
|
+
it(`'Advanced' raises onConfirmOpen when 'Cancel' is clicked, if set`, async () => {
|
|
468
|
+
const confirmToggleSpy = vi.fn();
|
|
428
469
|
|
|
429
|
-
const
|
|
470
|
+
const { container } = render(
|
|
430
471
|
<PageHeaderAction
|
|
431
472
|
{...defaultProps}
|
|
432
473
|
label={'test-label'}
|
|
@@ -435,32 +476,48 @@ describe('PageHeaderAction', () => {
|
|
|
435
476
|
/>,
|
|
436
477
|
);
|
|
437
478
|
|
|
479
|
+
const actionContainer = container.querySelector(
|
|
480
|
+
'.container',
|
|
481
|
+
) as HTMLElement;
|
|
482
|
+
|
|
438
483
|
// toggle confirmation on
|
|
439
484
|
act(() => {
|
|
440
|
-
|
|
485
|
+
fireEvent.click(actionContainer);
|
|
441
486
|
});
|
|
442
|
-
wrapper.update();
|
|
443
|
-
|
|
444
|
-
const cancelButton = wrapper.find(TextButton).first();
|
|
445
487
|
|
|
446
|
-
|
|
447
|
-
|
|
488
|
+
await waitFor(() => {
|
|
489
|
+
const confirmation = document.querySelector(
|
|
490
|
+
'.confirm-dialog-container',
|
|
491
|
+
);
|
|
492
|
+
expect(confirmation).toBeInTheDocument();
|
|
448
493
|
});
|
|
449
|
-
wrapper.update();
|
|
450
494
|
|
|
451
|
-
expect(confirmToggleSpy).toHaveBeenCalledTimes(
|
|
495
|
+
expect(confirmToggleSpy).toHaveBeenCalledTimes(1);
|
|
452
496
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true, {
|
|
453
497
|
mode: 'Advanced',
|
|
454
498
|
});
|
|
499
|
+
|
|
500
|
+
const cancelButton = document.querySelector(
|
|
501
|
+
'[data-test-id="cancel"]',
|
|
502
|
+
) as HTMLButtonElement;
|
|
503
|
+
|
|
504
|
+
act(() => {
|
|
505
|
+
fireEvent.click(cancelButton);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
await waitFor(() => {
|
|
509
|
+
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
510
|
+
});
|
|
511
|
+
|
|
455
512
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(2, false, {
|
|
456
513
|
mode: 'Advanced',
|
|
457
514
|
});
|
|
458
515
|
});
|
|
459
516
|
|
|
460
|
-
it(`'Advanced' raises onConfirmOpen when 'Confirm' is clicked, if set`, () => {
|
|
461
|
-
const confirmToggleSpy =
|
|
517
|
+
it(`'Advanced' raises onConfirmOpen when 'Confirm' is clicked, if set`, async () => {
|
|
518
|
+
const confirmToggleSpy = vi.fn();
|
|
462
519
|
|
|
463
|
-
const
|
|
520
|
+
const { container } = render(
|
|
464
521
|
<PageHeaderAction
|
|
465
522
|
{...defaultProps}
|
|
466
523
|
label={'test-label'}
|
|
@@ -469,23 +526,39 @@ describe('PageHeaderAction', () => {
|
|
|
469
526
|
/>,
|
|
470
527
|
);
|
|
471
528
|
|
|
529
|
+
const actionContainer = container.querySelector(
|
|
530
|
+
'.container',
|
|
531
|
+
) as HTMLElement;
|
|
532
|
+
|
|
472
533
|
// toggle confirmation on
|
|
473
534
|
act(() => {
|
|
474
|
-
|
|
535
|
+
fireEvent.click(actionContainer);
|
|
475
536
|
});
|
|
476
|
-
wrapper.update();
|
|
477
537
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
538
|
+
await waitFor(() => {
|
|
539
|
+
const confirmation = document.querySelector(
|
|
540
|
+
'.confirm-dialog-container',
|
|
541
|
+
);
|
|
542
|
+
expect(confirmation).toBeInTheDocument();
|
|
482
543
|
});
|
|
483
|
-
wrapper.update();
|
|
484
544
|
|
|
485
|
-
expect(confirmToggleSpy).toHaveBeenCalledTimes(
|
|
545
|
+
expect(confirmToggleSpy).toHaveBeenCalledTimes(1);
|
|
486
546
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(1, true, {
|
|
487
547
|
mode: 'Advanced',
|
|
488
548
|
});
|
|
549
|
+
|
|
550
|
+
const confirmButton = document.querySelector(
|
|
551
|
+
'[data-test-id="confirm"]',
|
|
552
|
+
) as HTMLButtonElement;
|
|
553
|
+
|
|
554
|
+
act(() => {
|
|
555
|
+
fireEvent.click(confirmButton);
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
await waitFor(() => {
|
|
559
|
+
expect(confirmToggleSpy).toHaveBeenCalledTimes(2);
|
|
560
|
+
});
|
|
561
|
+
|
|
489
562
|
expect(confirmToggleSpy).toHaveBeenNthCalledWith(2, false, {
|
|
490
563
|
mode: 'Advanced',
|
|
491
564
|
});
|
|
@@ -493,8 +566,8 @@ describe('PageHeaderAction', () => {
|
|
|
493
566
|
});
|
|
494
567
|
|
|
495
568
|
it(`sets background color when actionType is 'Context'`, () => {
|
|
496
|
-
const spy =
|
|
497
|
-
const
|
|
569
|
+
const spy = vi.fn();
|
|
570
|
+
const { container } = render(
|
|
498
571
|
<PageHeaderAction
|
|
499
572
|
label={'action-label'}
|
|
500
573
|
actionType={PageHeaderActionType.Context}
|
|
@@ -502,14 +575,16 @@ describe('PageHeaderAction', () => {
|
|
|
502
575
|
/>,
|
|
503
576
|
);
|
|
504
577
|
|
|
505
|
-
const
|
|
578
|
+
const actionContainer = container.querySelector(
|
|
579
|
+
'.container',
|
|
580
|
+
) as HTMLElement;
|
|
506
581
|
|
|
507
|
-
expect(
|
|
582
|
+
expect(actionContainer.classList.contains('context')).toBe(true);
|
|
508
583
|
});
|
|
509
584
|
|
|
510
585
|
it(`sets background color when actionType is 'Active'`, () => {
|
|
511
|
-
const spy =
|
|
512
|
-
const
|
|
586
|
+
const spy = vi.fn();
|
|
587
|
+
const { container } = render(
|
|
513
588
|
<PageHeaderAction
|
|
514
589
|
label={'action-label'}
|
|
515
590
|
actionType={PageHeaderActionType.Active}
|
|
@@ -517,14 +592,16 @@ describe('PageHeaderAction', () => {
|
|
|
517
592
|
/>,
|
|
518
593
|
);
|
|
519
594
|
|
|
520
|
-
const
|
|
595
|
+
const actionContainer = container.querySelector(
|
|
596
|
+
'.container',
|
|
597
|
+
) as HTMLElement;
|
|
521
598
|
|
|
522
|
-
expect(
|
|
599
|
+
expect(actionContainer.classList.contains('active')).toBe(true);
|
|
523
600
|
});
|
|
524
601
|
|
|
525
602
|
it(`disallows interactions when action is set to disabled`, () => {
|
|
526
|
-
const spy =
|
|
527
|
-
const
|
|
603
|
+
const spy = vi.fn();
|
|
604
|
+
const { container } = render(
|
|
528
605
|
<PageHeaderAction
|
|
529
606
|
label={'action-label'}
|
|
530
607
|
disabled={true}
|
|
@@ -532,11 +609,14 @@ describe('PageHeaderAction', () => {
|
|
|
532
609
|
/>,
|
|
533
610
|
);
|
|
534
611
|
|
|
535
|
-
const
|
|
612
|
+
const actionContainer = container.querySelector(
|
|
613
|
+
'.container',
|
|
614
|
+
) as HTMLElement;
|
|
615
|
+
const disabledAttribute = actionContainer.getAttribute('disabled');
|
|
536
616
|
|
|
537
|
-
|
|
617
|
+
fireEvent.click(actionContainer);
|
|
538
618
|
|
|
539
|
-
expect(disabledAttribute).
|
|
619
|
+
expect(disabledAttribute).not.toBeNull();
|
|
540
620
|
expect(spy).not.toHaveBeenCalled();
|
|
541
621
|
});
|
|
542
622
|
});
|
|
@@ -548,38 +628,40 @@ describe('PageHeaderAction', () => {
|
|
|
548
628
|
};
|
|
549
629
|
|
|
550
630
|
it('renders the component without crashing', () => {
|
|
551
|
-
const
|
|
552
|
-
<
|
|
631
|
+
const { container } = render(
|
|
632
|
+
<Router>
|
|
633
|
+
<PageHeaderAction {...defaultProps} path="/test" />
|
|
634
|
+
</Router>,
|
|
553
635
|
);
|
|
554
|
-
expect(
|
|
636
|
+
expect(container).toBeTruthy();
|
|
555
637
|
});
|
|
556
638
|
|
|
557
639
|
it('renders a Link when path is provided', () => {
|
|
558
|
-
const
|
|
640
|
+
const { container } = render(
|
|
559
641
|
<Router>
|
|
560
642
|
<PageHeaderAction {...defaultProps} />
|
|
561
643
|
</Router>,
|
|
562
644
|
);
|
|
563
645
|
|
|
564
|
-
|
|
646
|
+
const link = container.querySelector('a');
|
|
647
|
+
expect(link).toBeInTheDocument();
|
|
565
648
|
});
|
|
566
649
|
|
|
567
650
|
it('renders a label', () => {
|
|
568
651
|
const mockLabel = 'test-label';
|
|
569
|
-
const
|
|
652
|
+
const { container } = render(
|
|
570
653
|
<Router>
|
|
571
654
|
<PageHeaderAction {...defaultProps} label={mockLabel} path="/test" />
|
|
572
655
|
</Router>,
|
|
573
656
|
);
|
|
574
|
-
const label =
|
|
575
|
-
expect(label
|
|
657
|
+
const label = container.querySelector('span');
|
|
658
|
+
expect(label?.textContent).toBe(mockLabel);
|
|
576
659
|
});
|
|
577
660
|
|
|
578
661
|
it('renders an icon, if set', () => {
|
|
579
662
|
const mockLabel = 'test-label';
|
|
580
|
-
const
|
|
663
|
+
const { container } = render(
|
|
581
664
|
<Router>
|
|
582
|
-
{' '}
|
|
583
665
|
<PageHeaderAction
|
|
584
666
|
{...defaultProps}
|
|
585
667
|
label={mockLabel}
|
|
@@ -588,13 +670,13 @@ describe('PageHeaderAction', () => {
|
|
|
588
670
|
/>
|
|
589
671
|
</Router>,
|
|
590
672
|
);
|
|
591
|
-
const icon =
|
|
592
|
-
expect(icon
|
|
673
|
+
const icon = container.querySelector('.icons');
|
|
674
|
+
expect(icon).toBeInTheDocument();
|
|
593
675
|
});
|
|
594
676
|
|
|
595
677
|
it('renders an image instead of icon if icon prop is a string', () => {
|
|
596
678
|
const mockLabel = 'test-label';
|
|
597
|
-
const
|
|
679
|
+
const { container } = render(
|
|
598
680
|
<Router>
|
|
599
681
|
<PageHeaderAction
|
|
600
682
|
{...defaultProps}
|
|
@@ -605,35 +687,35 @@ describe('PageHeaderAction', () => {
|
|
|
605
687
|
/>
|
|
606
688
|
</Router>,
|
|
607
689
|
);
|
|
608
|
-
const icon =
|
|
609
|
-
expect(icon
|
|
610
|
-
const image =
|
|
611
|
-
expect(image
|
|
690
|
+
const icon = container.querySelector('.icons');
|
|
691
|
+
expect(icon).not.toBeInTheDocument();
|
|
692
|
+
const image = container.querySelector('img');
|
|
693
|
+
expect(image).toBeInTheDocument();
|
|
612
694
|
});
|
|
613
695
|
|
|
614
696
|
it('renders a link with correct path', () => {
|
|
615
697
|
const mockPath = '/test-path';
|
|
616
|
-
const
|
|
698
|
+
const { container } = render(
|
|
617
699
|
<Router>
|
|
618
700
|
<PageHeaderAction {...defaultProps} path={mockPath} />
|
|
619
701
|
</Router>,
|
|
620
702
|
);
|
|
621
|
-
const link =
|
|
622
|
-
expect(link.
|
|
703
|
+
const link = container.querySelector('a') as HTMLAnchorElement;
|
|
704
|
+
expect(link.getAttribute('href')).toBe(mockPath);
|
|
623
705
|
});
|
|
624
706
|
|
|
625
707
|
it('opens link in a new tab if openInNewTab is true', () => {
|
|
626
|
-
const
|
|
708
|
+
const { container } = render(
|
|
627
709
|
<Router>
|
|
628
710
|
<PageHeaderAction {...defaultProps} path="/test" openInNewTab />
|
|
629
711
|
</Router>,
|
|
630
712
|
);
|
|
631
|
-
const link =
|
|
632
|
-
expect(link.
|
|
713
|
+
const link = container.querySelector('a') as HTMLAnchorElement;
|
|
714
|
+
expect(link.target).toBe('_blank');
|
|
633
715
|
});
|
|
634
716
|
|
|
635
717
|
it('does not open link in a new tab if openInNewTab is false', () => {
|
|
636
|
-
const
|
|
718
|
+
const { container } = render(
|
|
637
719
|
<Router>
|
|
638
720
|
<PageHeaderAction
|
|
639
721
|
{...defaultProps}
|
|
@@ -642,8 +724,8 @@ describe('PageHeaderAction', () => {
|
|
|
642
724
|
/>
|
|
643
725
|
</Router>,
|
|
644
726
|
);
|
|
645
|
-
const link =
|
|
646
|
-
expect(link.
|
|
727
|
+
const link = container.querySelector('a') as HTMLAnchorElement;
|
|
728
|
+
expect(link.target).toBe('');
|
|
647
729
|
});
|
|
648
730
|
});
|
|
649
731
|
});
|