@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,16 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import type { Mock } from 'vitest';
|
|
4
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { useBusy } from '../../hooks/useBusy/useBusy';
|
|
4
6
|
import { IconName } from '../Icons';
|
|
5
|
-
import { Action } from './Action/Action';
|
|
6
7
|
import { Actions } from './Actions';
|
|
7
8
|
import { ActionData } from './Actions.models';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
vi.mock('../../initialize');
|
|
11
|
+
vi.mock('../../hooks/useBusy/useBusy', () => ({
|
|
12
|
+
useBusy: vi.fn(() => ({ isBusy: false })),
|
|
13
|
+
}));
|
|
10
14
|
|
|
11
|
-
const spy1 =
|
|
12
|
-
const spy2 =
|
|
13
|
-
const spy3 =
|
|
15
|
+
const spy1 = vi.fn();
|
|
16
|
+
const spy2 = vi.fn();
|
|
17
|
+
const spy3 = vi.fn();
|
|
14
18
|
const mockActions: ActionData[] = [
|
|
15
19
|
{ label: 'action-label', onActionSelected: spy1 },
|
|
16
20
|
{ label: 'action-label', onActionSelected: spy2 },
|
|
@@ -18,52 +22,58 @@ const mockActions: ActionData[] = [
|
|
|
18
22
|
];
|
|
19
23
|
|
|
20
24
|
describe('Actions', () => {
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
vi.clearAllMocks();
|
|
27
|
+
});
|
|
28
|
+
|
|
21
29
|
it('renders the component without crashing', () => {
|
|
22
|
-
const
|
|
30
|
+
const { container } = render(<Actions actions={[]} />);
|
|
23
31
|
|
|
24
|
-
expect(
|
|
32
|
+
expect(container).toBeTruthy();
|
|
25
33
|
});
|
|
26
34
|
|
|
27
35
|
it('renders an Action for each action', () => {
|
|
28
|
-
const
|
|
36
|
+
const { container } = render(<Actions actions={mockActions} />);
|
|
29
37
|
|
|
30
|
-
const actions =
|
|
38
|
+
const actions = container.querySelectorAll('[data-test-id="action"]');
|
|
31
39
|
|
|
32
40
|
expect(actions).toHaveLength(mockActions.length);
|
|
33
41
|
});
|
|
34
42
|
|
|
35
43
|
it('raises the click event', () => {
|
|
36
|
-
const
|
|
44
|
+
const { container } = render(<Actions actions={mockActions} />);
|
|
37
45
|
|
|
38
|
-
const action =
|
|
46
|
+
const action = container.querySelector('[data-test-id="action"]');
|
|
39
47
|
|
|
40
|
-
action
|
|
48
|
+
if (action) {
|
|
49
|
+
fireEvent.click(action);
|
|
50
|
+
}
|
|
41
51
|
|
|
42
52
|
expect(spy1).toHaveBeenCalledTimes(1);
|
|
43
53
|
});
|
|
44
54
|
|
|
45
55
|
it('renders Actions with the passed in width prop', () => {
|
|
46
56
|
const mockWidth = '150px';
|
|
47
|
-
const
|
|
57
|
+
const { container } = render(<Actions actions={[]} width={mockWidth} />);
|
|
48
58
|
|
|
49
|
-
const
|
|
59
|
+
const actionsContainer = container.querySelector('.actions-container');
|
|
50
60
|
|
|
51
|
-
expect(
|
|
61
|
+
expect(actionsContainer).toHaveStyle({ width: mockWidth });
|
|
52
62
|
});
|
|
53
63
|
|
|
54
64
|
it('displays an empty Actions container if no actions are passed in', () => {
|
|
55
|
-
const
|
|
65
|
+
const { container } = render(<Actions actions={[]} />);
|
|
56
66
|
|
|
57
|
-
const
|
|
58
|
-
const actions =
|
|
67
|
+
const actionsContainer = container.querySelector('.actions-container');
|
|
68
|
+
const actions = container.querySelectorAll('[data-test-id="action"]');
|
|
59
69
|
|
|
60
|
-
expect(
|
|
70
|
+
expect(actionsContainer).toBeInTheDocument();
|
|
61
71
|
expect(actions).toHaveLength(0);
|
|
62
72
|
});
|
|
63
73
|
|
|
64
74
|
it('allows the icon to be changed', () => {
|
|
65
75
|
const iconProp: IconName = IconName.Delete;
|
|
66
|
-
const
|
|
76
|
+
const { container } = render(
|
|
67
77
|
<Actions
|
|
68
78
|
actions={[
|
|
69
79
|
{
|
|
@@ -75,24 +85,24 @@ describe('Actions', () => {
|
|
|
75
85
|
/>,
|
|
76
86
|
);
|
|
77
87
|
|
|
78
|
-
const action =
|
|
88
|
+
const action = container.querySelector('[data-test-id="action"]');
|
|
79
89
|
|
|
80
|
-
expect(action
|
|
90
|
+
expect(action).toBeInTheDocument();
|
|
91
|
+
// Icon is rendered inside the action
|
|
92
|
+
const icon = action?.querySelector('svg');
|
|
93
|
+
expect(icon).toBeInTheDocument();
|
|
81
94
|
});
|
|
82
95
|
|
|
83
96
|
it('disables all actions when busy', () => {
|
|
84
|
-
(
|
|
85
|
-
cb(true);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const wrapper = shallow(<Actions actions={mockActions} />);
|
|
97
|
+
(useBusy as Mock).mockImplementation(() => ({ isBusy: true }));
|
|
89
98
|
|
|
90
|
-
|
|
99
|
+
const { container } = render(<Actions actions={mockActions} />);
|
|
91
100
|
|
|
92
|
-
const actions =
|
|
101
|
+
const actions = container.querySelectorAll('[data-test-id="action"]');
|
|
93
102
|
|
|
94
103
|
actions.forEach((action) => {
|
|
95
|
-
|
|
104
|
+
// When disabled, the action gets the isDisabled class
|
|
105
|
+
expect(action.classList.contains('isDisabled')).toBe(true);
|
|
96
106
|
});
|
|
97
107
|
});
|
|
98
108
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { IconName } from '../../Icons';
|
|
5
6
|
import { ButtonContext } from '../Button.model';
|
|
6
7
|
import { Button } from './Button';
|
|
7
8
|
|
|
@@ -20,35 +21,36 @@ const CustomIcon: React.FC = () => (
|
|
|
20
21
|
describe('Button (with icon)', () => {
|
|
21
22
|
describe('ContextButtonElement', () => {
|
|
22
23
|
it('renders the component without crashing', () => {
|
|
23
|
-
const
|
|
24
|
+
const { container } = render(<Button />);
|
|
24
25
|
|
|
25
|
-
expect(
|
|
26
|
+
expect(container.querySelector('button')).toBeInTheDocument();
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
it('raises the onButtonClicked event', () => {
|
|
29
|
-
const spy =
|
|
30
|
-
const
|
|
30
|
+
const spy = vi.fn();
|
|
31
|
+
const { container } = render(<Button onButtonClicked={spy} />);
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
const button = container.querySelector('button')!;
|
|
34
|
+
fireEvent.click(button);
|
|
33
35
|
|
|
34
36
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
35
37
|
});
|
|
36
38
|
|
|
37
39
|
it('creates a class based off of the className prop', () => {
|
|
38
40
|
const mockClassName = 'test-class';
|
|
39
|
-
const
|
|
41
|
+
const { container } = render(<Button className={mockClassName} />);
|
|
40
42
|
|
|
41
|
-
const button =
|
|
43
|
+
const button = container.querySelector('button')!;
|
|
42
44
|
|
|
43
|
-
expect(button.
|
|
45
|
+
expect(button.classList.contains(mockClassName)).toBe(true);
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
it(`button 'type' must be 'button' by default`, () => {
|
|
47
|
-
const
|
|
49
|
+
const { container } = render(<Button />);
|
|
48
50
|
|
|
49
|
-
const
|
|
51
|
+
const button = container.querySelector('button')!;
|
|
50
52
|
|
|
51
|
-
expect(
|
|
53
|
+
expect(button.type).toBe('button');
|
|
52
54
|
});
|
|
53
55
|
|
|
54
56
|
it('accepts type html attribute and width/height styles', () => {
|
|
@@ -56,160 +58,157 @@ describe('Button (with icon)', () => {
|
|
|
56
58
|
const mockHeight = '75px';
|
|
57
59
|
const mockWidth = '80px';
|
|
58
60
|
|
|
59
|
-
const
|
|
61
|
+
const { container, rerender } = render(<Button />);
|
|
60
62
|
|
|
61
|
-
let
|
|
62
|
-
let buttonStyles = wrapper
|
|
63
|
-
.find('button')
|
|
64
|
-
.prop('style') as React.CSSProperties;
|
|
63
|
+
let button = container.querySelector('button')!;
|
|
65
64
|
|
|
66
|
-
expect(
|
|
67
|
-
expect(
|
|
68
|
-
expect(
|
|
65
|
+
expect(button.type).toBe('button');
|
|
66
|
+
expect(button.style.height).toBe('');
|
|
67
|
+
expect(button.style.width).toBe('');
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
type
|
|
72
|
-
|
|
73
|
-
width: mockWidth,
|
|
74
|
-
});
|
|
75
|
-
wrapper.update();
|
|
69
|
+
rerender(
|
|
70
|
+
<Button type={mockType} height={mockHeight} width={mockWidth} />,
|
|
71
|
+
);
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
buttonStyles = wrapper
|
|
79
|
-
.find('button')
|
|
80
|
-
.prop('style') as React.CSSProperties;
|
|
73
|
+
button = container.querySelector('button')!;
|
|
81
74
|
|
|
82
|
-
expect(
|
|
83
|
-
expect(
|
|
84
|
-
expect(
|
|
75
|
+
expect(button.type).toBe(mockType);
|
|
76
|
+
expect(button.style.height).toBe(mockHeight);
|
|
77
|
+
expect(button.style.width).toBe(mockWidth);
|
|
85
78
|
});
|
|
86
79
|
|
|
87
80
|
it('allows the button to be enabled by default', () => {
|
|
88
|
-
const spy =
|
|
89
|
-
const
|
|
81
|
+
const spy = vi.fn();
|
|
82
|
+
const { container } = render(<Button onButtonClicked={spy} />);
|
|
90
83
|
|
|
91
|
-
const button =
|
|
84
|
+
const button = container.querySelector('button')!;
|
|
92
85
|
|
|
93
|
-
|
|
86
|
+
fireEvent.click(button);
|
|
94
87
|
|
|
95
|
-
expect(button.
|
|
88
|
+
expect(button.disabled).toBe(false);
|
|
96
89
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
97
90
|
});
|
|
98
91
|
|
|
99
92
|
it('allows button to be disabled', () => {
|
|
100
|
-
const spy =
|
|
101
|
-
const
|
|
93
|
+
const spy = vi.fn();
|
|
94
|
+
const { container } = render(
|
|
95
|
+
<Button disabled={true} onButtonClicked={spy} />,
|
|
96
|
+
);
|
|
102
97
|
|
|
103
|
-
const button =
|
|
98
|
+
const button = container.querySelector('button')!;
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
fireEvent.click(button);
|
|
106
101
|
|
|
107
|
-
expect(button.
|
|
102
|
+
expect(button.disabled).toBe(true);
|
|
108
103
|
expect(spy).not.toHaveBeenCalled();
|
|
109
104
|
});
|
|
110
105
|
|
|
111
106
|
it('default should have a active class', () => {
|
|
112
|
-
const
|
|
107
|
+
const { container } = render(<Button />);
|
|
113
108
|
|
|
114
|
-
const button =
|
|
109
|
+
const button = container.querySelector('button')!;
|
|
115
110
|
|
|
116
|
-
expect(button.
|
|
111
|
+
expect(button.classList.contains('active')).toBe(true);
|
|
117
112
|
});
|
|
118
113
|
|
|
119
114
|
it('context button type should have a context class', () => {
|
|
120
|
-
const
|
|
115
|
+
const { container } = render(
|
|
116
|
+
<Button buttonContext={ButtonContext.Context} />,
|
|
117
|
+
);
|
|
121
118
|
|
|
122
|
-
const button =
|
|
119
|
+
const button = container.querySelector('button')!;
|
|
123
120
|
|
|
124
|
-
expect(button.
|
|
121
|
+
expect(button.classList.contains('context')).toBe(true);
|
|
125
122
|
});
|
|
126
123
|
|
|
127
124
|
it('context button type should have a icon class', () => {
|
|
128
|
-
const
|
|
125
|
+
const { container } = render(
|
|
126
|
+
<Button buttonContext={ButtonContext.Icon} />,
|
|
127
|
+
);
|
|
129
128
|
|
|
130
|
-
const button =
|
|
129
|
+
const button = container.querySelector('button')!;
|
|
131
130
|
|
|
132
|
-
expect(button.
|
|
131
|
+
expect(button.classList.contains('icon')).toBe(true);
|
|
133
132
|
});
|
|
134
133
|
|
|
135
134
|
it('active button type should have a active class', () => {
|
|
136
|
-
const
|
|
135
|
+
const { container } = render(
|
|
136
|
+
<Button buttonContext={ButtonContext.Active} />,
|
|
137
|
+
);
|
|
137
138
|
|
|
138
|
-
const button =
|
|
139
|
+
const button = container.querySelector('button')!;
|
|
139
140
|
|
|
140
|
-
expect(button.
|
|
141
|
+
expect(button.classList.contains('active')).toBe(true);
|
|
141
142
|
});
|
|
142
143
|
|
|
143
144
|
it(`renders an icon as it's image from the Icons component`, () => {
|
|
144
|
-
const
|
|
145
|
+
const { container } = render(<Button icon={IconName.ChevronRight} />);
|
|
145
146
|
|
|
146
|
-
const icon =
|
|
147
|
+
const icon = container.querySelector('svg');
|
|
147
148
|
|
|
148
|
-
expect(icon
|
|
149
|
+
expect(icon).toBeInTheDocument();
|
|
149
150
|
});
|
|
150
151
|
|
|
151
152
|
it('renders `customIcon` when provided', () => {
|
|
152
|
-
const
|
|
153
|
-
const customIcon =
|
|
153
|
+
const { container } = render(<Button customIcon={<CustomIcon />} />);
|
|
154
|
+
const customIcon = container.querySelector('svg');
|
|
154
155
|
|
|
155
|
-
expect(customIcon
|
|
156
|
+
expect(customIcon).toBeInTheDocument();
|
|
156
157
|
});
|
|
157
158
|
|
|
158
159
|
it('renders `customIcon` instead of `icon` when both are provided', () => {
|
|
159
|
-
const
|
|
160
|
+
const { container } = render(
|
|
160
161
|
<Button icon={IconName.ChevronRight} customIcon={<CustomIcon />} />,
|
|
161
162
|
);
|
|
162
163
|
|
|
163
|
-
const
|
|
164
|
-
const icon = wrapper.find(Icons);
|
|
164
|
+
const svgs = container.querySelectorAll('svg');
|
|
165
165
|
|
|
166
|
-
expect(
|
|
167
|
-
expect(icon.exists()).toBe(false);
|
|
166
|
+
expect(svgs).toHaveLength(1);
|
|
168
167
|
});
|
|
169
168
|
});
|
|
170
169
|
|
|
171
170
|
describe('NavigationButtonElement', () => {
|
|
172
171
|
it('renders the component without crashing', () => {
|
|
173
|
-
const
|
|
172
|
+
const { container } = render(
|
|
174
173
|
<Router>
|
|
175
174
|
<Button {...navigationButtonProps} />
|
|
176
175
|
</Router>,
|
|
177
176
|
);
|
|
178
177
|
|
|
179
|
-
expect(
|
|
178
|
+
expect(container.querySelector('a')).toBeInTheDocument();
|
|
180
179
|
});
|
|
181
180
|
|
|
182
181
|
it('creates a class based on the className prop', () => {
|
|
183
182
|
const mockClassName = 'test-class';
|
|
184
|
-
const
|
|
183
|
+
const { container } = render(
|
|
185
184
|
<Router>
|
|
186
|
-
<Button {...navigationButtonProps} className={mockClassName}
|
|
185
|
+
<Button {...navigationButtonProps} className={mockClassName} />
|
|
187
186
|
</Router>,
|
|
188
187
|
);
|
|
189
188
|
|
|
190
|
-
const link =
|
|
189
|
+
const link = container.querySelector('a')!;
|
|
191
190
|
|
|
192
|
-
expect(link.
|
|
191
|
+
expect(link.classList.contains(mockClassName)).toBe(true);
|
|
193
192
|
});
|
|
194
193
|
|
|
195
194
|
it('renders the correct path in the Link component', () => {
|
|
196
195
|
const mockPath = '/test';
|
|
197
|
-
const
|
|
196
|
+
const { container } = render(
|
|
198
197
|
<Router>
|
|
199
198
|
<Button path={mockPath} />
|
|
200
199
|
</Router>,
|
|
201
200
|
);
|
|
202
201
|
|
|
203
|
-
const link =
|
|
202
|
+
const link = container.querySelector('a')!;
|
|
204
203
|
|
|
205
|
-
expect(link.
|
|
204
|
+
expect(link.getAttribute('href')).toBe(mockPath);
|
|
206
205
|
});
|
|
207
206
|
|
|
208
207
|
it('accepts width/height styles', () => {
|
|
209
208
|
const mockHeight = '75px';
|
|
210
209
|
const mockWidth = '80px';
|
|
211
210
|
|
|
212
|
-
const
|
|
211
|
+
const { container } = render(
|
|
213
212
|
<Router>
|
|
214
213
|
<Button
|
|
215
214
|
{...navigationButtonProps}
|
|
@@ -219,125 +218,123 @@ describe('Button (with icon)', () => {
|
|
|
219
218
|
</Router>,
|
|
220
219
|
);
|
|
221
220
|
|
|
222
|
-
const
|
|
223
|
-
.find('Link')
|
|
224
|
-
.prop('style') as React.CSSProperties;
|
|
221
|
+
const link = container.querySelector('a')!;
|
|
225
222
|
|
|
226
|
-
expect(
|
|
227
|
-
expect(
|
|
223
|
+
expect(link.style.height).toBe(mockHeight);
|
|
224
|
+
expect(link.style.width).toBe(mockWidth);
|
|
228
225
|
});
|
|
229
226
|
|
|
230
227
|
it('allows the button to be enabled by default', () => {
|
|
231
|
-
const
|
|
228
|
+
const { container } = render(
|
|
232
229
|
<Router>
|
|
233
230
|
<Button {...navigationButtonProps} />
|
|
234
231
|
</Router>,
|
|
235
232
|
);
|
|
236
233
|
|
|
237
|
-
const link =
|
|
234
|
+
const link = container.querySelector('a')!;
|
|
238
235
|
|
|
239
|
-
expect(link.
|
|
236
|
+
expect(link.classList.contains('disabled')).toBe(false);
|
|
240
237
|
});
|
|
241
238
|
|
|
242
239
|
it('allows button to be disabled', () => {
|
|
243
|
-
const
|
|
240
|
+
const { container } = render(
|
|
244
241
|
<Router>
|
|
245
242
|
<Button {...navigationButtonProps} disabled={true} />
|
|
246
243
|
</Router>,
|
|
247
244
|
);
|
|
248
245
|
|
|
249
|
-
const link =
|
|
246
|
+
const link = container.querySelector('a')!;
|
|
250
247
|
|
|
251
|
-
expect(link.
|
|
248
|
+
expect(link.classList.contains('disabled')).toBe(true);
|
|
252
249
|
});
|
|
253
250
|
|
|
254
251
|
it('renders the correct data-test-id attribute', () => {
|
|
255
252
|
const mockTestId = 'test-button';
|
|
256
|
-
const
|
|
253
|
+
const { container } = render(
|
|
257
254
|
<Router>
|
|
258
255
|
<Button {...navigationButtonProps} dataTestId={mockTestId} />
|
|
259
256
|
</Router>,
|
|
260
257
|
);
|
|
261
258
|
|
|
262
|
-
const link =
|
|
259
|
+
const link = container.querySelector('a')!;
|
|
263
260
|
|
|
264
|
-
expect(link.
|
|
261
|
+
expect(link.getAttribute('data-test-id')).toBe(mockTestId);
|
|
265
262
|
});
|
|
266
263
|
|
|
267
264
|
it('renders the Icons component with the correct default icon', () => {
|
|
268
|
-
const
|
|
265
|
+
const { container } = render(
|
|
269
266
|
<Router>
|
|
270
267
|
<Button {...navigationButtonProps} />
|
|
271
268
|
</Router>,
|
|
272
269
|
);
|
|
273
270
|
|
|
274
|
-
const
|
|
271
|
+
const svg = container.querySelector('svg');
|
|
275
272
|
|
|
276
|
-
expect(
|
|
273
|
+
expect(svg).toBeInTheDocument();
|
|
277
274
|
});
|
|
278
275
|
|
|
279
276
|
it('renders the Icons component with the correct default icon when `openInNewTab` is set to `true`', () => {
|
|
280
|
-
const
|
|
277
|
+
const { container } = render(
|
|
281
278
|
<Router>
|
|
282
279
|
<Button {...navigationButtonProps} openInNewTab={true} />
|
|
283
280
|
</Router>,
|
|
284
281
|
);
|
|
285
282
|
|
|
286
|
-
const
|
|
283
|
+
const svg = container.querySelector('svg');
|
|
287
284
|
|
|
288
|
-
expect(
|
|
285
|
+
expect(svg).toBeInTheDocument();
|
|
289
286
|
});
|
|
290
287
|
|
|
291
288
|
it('opens link in new tab when `openInNewTab` is set to `true`', () => {
|
|
292
|
-
const
|
|
289
|
+
const { container } = render(
|
|
293
290
|
<Router>
|
|
294
291
|
<Button {...navigationButtonProps} openInNewTab={true} />
|
|
295
292
|
</Router>,
|
|
296
293
|
);
|
|
297
294
|
|
|
298
|
-
const link =
|
|
295
|
+
const link = container.querySelector('a')!;
|
|
299
296
|
|
|
300
|
-
expect(link.
|
|
297
|
+
expect(link.getAttribute('target')).toBe('_blank');
|
|
301
298
|
});
|
|
302
299
|
|
|
303
300
|
it('does not open link in new tab by default', () => {
|
|
304
|
-
const
|
|
301
|
+
const { container } = render(
|
|
305
302
|
<Router>
|
|
306
303
|
<Button {...navigationButtonProps} />
|
|
307
304
|
</Router>,
|
|
308
305
|
);
|
|
309
306
|
|
|
310
|
-
const link =
|
|
307
|
+
const link = container.querySelector('a')!;
|
|
311
308
|
|
|
312
|
-
expect(link.
|
|
309
|
+
expect(link.getAttribute('target')).toBeNull();
|
|
313
310
|
});
|
|
314
311
|
|
|
315
312
|
it('renders the Icons component with the correct icon', () => {
|
|
316
313
|
const mockIcon = IconName.Copy;
|
|
317
|
-
const
|
|
314
|
+
const { container } = render(
|
|
318
315
|
<Router>
|
|
319
316
|
<Button {...navigationButtonProps} icon={mockIcon} />
|
|
320
317
|
</Router>,
|
|
321
318
|
);
|
|
322
319
|
|
|
323
|
-
const
|
|
320
|
+
const svg = container.querySelector('svg');
|
|
324
321
|
|
|
325
|
-
expect(
|
|
322
|
+
expect(svg).toBeInTheDocument();
|
|
326
323
|
});
|
|
327
324
|
|
|
328
325
|
it('renders `customIcon` when provided', () => {
|
|
329
|
-
const
|
|
326
|
+
const { container } = render(
|
|
330
327
|
<Router>
|
|
331
328
|
<Button {...navigationButtonProps} customIcon={<CustomIcon />} />
|
|
332
329
|
</Router>,
|
|
333
330
|
);
|
|
334
|
-
const customIcon =
|
|
331
|
+
const customIcon = container.querySelector('svg');
|
|
335
332
|
|
|
336
|
-
expect(customIcon
|
|
333
|
+
expect(customIcon).toBeInTheDocument();
|
|
337
334
|
});
|
|
338
335
|
|
|
339
336
|
it('renders `customIcon` instead of `icon` when both are provided', () => {
|
|
340
|
-
const
|
|
337
|
+
const { container } = render(
|
|
341
338
|
<Router>
|
|
342
339
|
<Button
|
|
343
340
|
{...navigationButtonProps}
|
|
@@ -347,11 +344,9 @@ describe('Button (with icon)', () => {
|
|
|
347
344
|
</Router>,
|
|
348
345
|
);
|
|
349
346
|
|
|
350
|
-
const
|
|
351
|
-
const icon = wrapper.find(Icons);
|
|
347
|
+
const svgs = container.querySelectorAll('svg');
|
|
352
348
|
|
|
353
|
-
expect(
|
|
354
|
-
expect(icon.exists()).toBe(false);
|
|
349
|
+
expect(svgs).toHaveLength(1);
|
|
355
350
|
});
|
|
356
351
|
});
|
|
357
352
|
});
|
|
@@ -69,6 +69,7 @@ const ContextButtonElement = React.forwardRef<
|
|
|
69
69
|
className = '',
|
|
70
70
|
customIcon,
|
|
71
71
|
dataTestId,
|
|
72
|
+
title,
|
|
72
73
|
onButtonClicked = noop,
|
|
73
74
|
onBlur,
|
|
74
75
|
}: ContextButtonProps,
|
|
@@ -93,6 +94,7 @@ const ContextButtonElement = React.forwardRef<
|
|
|
93
94
|
disabled={disabled}
|
|
94
95
|
onBlur={onBlur}
|
|
95
96
|
data-test-id={dataTestId ?? 'button'}
|
|
97
|
+
title={title}
|
|
96
98
|
>
|
|
97
99
|
{customIcon ? customIcon : <Icons icon={icon} />}
|
|
98
100
|
</button>
|
|
@@ -113,6 +115,7 @@ const NavigationButtonElement = React.forwardRef<
|
|
|
113
115
|
dataTestId = undefined,
|
|
114
116
|
disabled = false,
|
|
115
117
|
openInNewTab = false,
|
|
118
|
+
title,
|
|
116
119
|
}: NavigationButtonProps,
|
|
117
120
|
ref: ForwardedRef<HTMLAnchorElement>,
|
|
118
121
|
) {
|
|
@@ -132,6 +135,7 @@ const NavigationButtonElement = React.forwardRef<
|
|
|
132
135
|
style={{ height, width }}
|
|
133
136
|
data-test-id={dataTestId ?? 'button'}
|
|
134
137
|
target={openInNewTab ? '_blank' : undefined}
|
|
138
|
+
title={title}
|
|
135
139
|
>
|
|
136
140
|
{customIcon ? customIcon : <Icons icon={icon ? icon : defaultIcon} />}
|
|
137
141
|
</Link>
|