@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,8 +1,8 @@
|
|
|
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 {
|
|
5
|
-
import { Radio,
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { Radio, RadioProps } from './Radio';
|
|
6
6
|
|
|
7
7
|
describe('Radio', () => {
|
|
8
8
|
const defaultProps: RadioProps = {
|
|
@@ -20,22 +20,22 @@ describe('Radio', () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
it('renders the component without crashing', () => {
|
|
23
|
-
const
|
|
23
|
+
const { container } = render(<Radio name="test-name" />);
|
|
24
24
|
|
|
25
|
-
expect(
|
|
25
|
+
expect(container).toBeTruthy();
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it('displays a label', () => {
|
|
29
29
|
const mockLabel = 'mockLabel';
|
|
30
|
-
const
|
|
30
|
+
const { container } = render(<Radio name="test-name" label={mockLabel} />);
|
|
31
31
|
|
|
32
|
-
const label =
|
|
32
|
+
const label = container.querySelector('label');
|
|
33
33
|
|
|
34
|
-
expect(label
|
|
34
|
+
expect(label?.textContent).toBe(mockLabel);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it('each radio button accepts optional props when passed in', () => {
|
|
38
|
-
const spy =
|
|
38
|
+
const spy = vi.fn();
|
|
39
39
|
const mockId = 'test-id';
|
|
40
40
|
|
|
41
41
|
const mockInputProps: Partial<RadioProps> = {
|
|
@@ -45,7 +45,7 @@ describe('Radio', () => {
|
|
|
45
45
|
onFocus: spy,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const { container } = render(
|
|
49
49
|
<Radio
|
|
50
50
|
name="test-name"
|
|
51
51
|
id={mockId}
|
|
@@ -54,11 +54,12 @@ describe('Radio', () => {
|
|
|
54
54
|
/>,
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
const radio =
|
|
58
|
-
const radioButton =
|
|
57
|
+
const radio = container.querySelector('.container') as HTMLElement;
|
|
58
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
59
59
|
|
|
60
|
-
expect(radio.
|
|
61
|
-
expect(radioButton).
|
|
60
|
+
expect(radio.id).toBe(mockId);
|
|
61
|
+
expect(radioButton.autofocus).toBe(mockInputProps.autoFocus);
|
|
62
|
+
expect(radioButton.disabled).toBe(mockInputProps.disabled);
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
it(`- each radio button 'name' should have the same name
|
|
@@ -67,78 +68,56 @@ describe('Radio', () => {
|
|
|
67
68
|
- each radio button 'htmlFor' prop should be the same as its 'id'`, () => {
|
|
68
69
|
const mockName = 'test-name';
|
|
69
70
|
const mockOptions = defaultProps.options ?? [];
|
|
70
|
-
const
|
|
71
|
+
const { container } = render(
|
|
71
72
|
<Radio {...defaultProps} name={mockName} options={mockOptions} />,
|
|
72
73
|
);
|
|
73
74
|
|
|
74
|
-
const radioButtons =
|
|
75
|
+
const radioButtons = container.querySelectorAll('.option');
|
|
75
76
|
|
|
76
|
-
radioButtons.forEach((
|
|
77
|
+
radioButtons.forEach((radioOption, idx) => {
|
|
77
78
|
const id = `${mockName}-${mockOptions[idx].value}`;
|
|
78
|
-
const input =
|
|
79
|
-
const label =
|
|
79
|
+
const input = radioOption.querySelector('input') as HTMLInputElement;
|
|
80
|
+
const label = radioOption.querySelector('label') as HTMLLabelElement;
|
|
80
81
|
|
|
81
|
-
expect(input.
|
|
82
|
-
expect(input.
|
|
83
|
-
expect(label.
|
|
84
|
-
expect(label.
|
|
82
|
+
expect(input.name).toBe(mockName);
|
|
83
|
+
expect(input.id).toBe(id);
|
|
84
|
+
expect(label.htmlFor).toBe(id);
|
|
85
|
+
expect(label.textContent).toContain(mockOptions[idx].label);
|
|
85
86
|
});
|
|
86
87
|
});
|
|
87
88
|
|
|
88
89
|
it(`sets current button to 'checked' using the 'value' prop and autofocus selected button`, () => {
|
|
89
|
-
const falseValues = {
|
|
90
|
-
checked: false,
|
|
91
|
-
autoFocus: false,
|
|
92
|
-
};
|
|
93
90
|
const [, option2] = defaultProps.options ?? [];
|
|
94
91
|
const mockValue: string = option2.value as string;
|
|
95
|
-
const
|
|
92
|
+
const { container, rerender } = render(<Radio {...defaultProps} />);
|
|
96
93
|
|
|
97
|
-
let radioButtons =
|
|
98
|
-
let button = wrapper.find(RadioButton);
|
|
94
|
+
let radioButtons = container.querySelectorAll('input');
|
|
99
95
|
|
|
100
|
-
expect(radioButtons
|
|
101
|
-
|
|
102
|
-
);
|
|
103
|
-
expect(
|
|
104
|
-
expect(radioButtons.
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
-
expect(button.at(1).prop('checked')).toBe(false);
|
|
108
|
-
expect(radioButtons.at(2).props()).toEqual(
|
|
109
|
-
expect.objectContaining(falseValues),
|
|
110
|
-
);
|
|
111
|
-
expect(button.at(2).prop('checked')).toBe(false);
|
|
96
|
+
expect((radioButtons[0] as HTMLInputElement).checked).toBe(false);
|
|
97
|
+
expect((radioButtons[0] as HTMLInputElement).autofocus).toBe(false);
|
|
98
|
+
expect((radioButtons[1] as HTMLInputElement).checked).toBe(false);
|
|
99
|
+
expect((radioButtons[1] as HTMLInputElement).autofocus).toBe(false);
|
|
100
|
+
expect((radioButtons[2] as HTMLInputElement).checked).toBe(false);
|
|
101
|
+
expect((radioButtons[2] as HTMLInputElement).autofocus).toBe(false);
|
|
112
102
|
|
|
113
|
-
|
|
114
|
-
wrapper.update();
|
|
103
|
+
rerender(<Radio {...defaultProps} value={mockValue} />);
|
|
115
104
|
|
|
116
|
-
radioButtons =
|
|
117
|
-
button = wrapper.find(RadioButton);
|
|
105
|
+
radioButtons = container.querySelectorAll('input');
|
|
118
106
|
|
|
119
|
-
expect(radioButtons
|
|
120
|
-
|
|
121
|
-
);
|
|
122
|
-
expect(
|
|
123
|
-
expect(radioButtons.
|
|
124
|
-
|
|
125
|
-
checked: true,
|
|
126
|
-
autoFocus: true,
|
|
127
|
-
}),
|
|
128
|
-
);
|
|
129
|
-
expect(button.at(1).prop('checked')).toBe(true);
|
|
130
|
-
expect(radioButtons.at(2).props()).toEqual(
|
|
131
|
-
expect.objectContaining(falseValues),
|
|
132
|
-
);
|
|
133
|
-
expect(button.at(2).prop('checked')).toBe(false);
|
|
107
|
+
expect((radioButtons[0] as HTMLInputElement).checked).toBe(false);
|
|
108
|
+
expect((radioButtons[0] as HTMLInputElement).autofocus).toBe(false);
|
|
109
|
+
expect((radioButtons[1] as HTMLInputElement).checked).toBe(true);
|
|
110
|
+
expect((radioButtons[1] as HTMLInputElement).autofocus).toBe(true);
|
|
111
|
+
expect((radioButtons[2] as HTMLInputElement).checked).toBe(false);
|
|
112
|
+
expect((radioButtons[2] as HTMLInputElement).autofocus).toBe(false);
|
|
134
113
|
});
|
|
135
114
|
|
|
136
115
|
it(`emits onBlur, onFocus, and onChange events`, () => {
|
|
137
|
-
const onBlurSpy =
|
|
138
|
-
const onFocusSpy =
|
|
139
|
-
const onChangeSpy =
|
|
116
|
+
const onBlurSpy = vi.fn();
|
|
117
|
+
const onFocusSpy = vi.fn();
|
|
118
|
+
const onChangeSpy = vi.fn();
|
|
140
119
|
|
|
141
|
-
const
|
|
120
|
+
const { container } = render(
|
|
142
121
|
<Radio
|
|
143
122
|
{...defaultProps}
|
|
144
123
|
onChange={onChangeSpy}
|
|
@@ -147,188 +126,196 @@ describe('Radio', () => {
|
|
|
147
126
|
/>,
|
|
148
127
|
);
|
|
149
128
|
|
|
150
|
-
const radioButton =
|
|
129
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
151
130
|
|
|
152
|
-
|
|
131
|
+
fireEvent.blur(radioButton);
|
|
153
132
|
expect(onBlurSpy).toHaveBeenCalledTimes(1);
|
|
154
133
|
|
|
155
|
-
|
|
134
|
+
fireEvent.focus(radioButton);
|
|
156
135
|
expect(onFocusSpy).toHaveBeenCalledTimes(1);
|
|
157
136
|
|
|
158
|
-
|
|
137
|
+
fireEvent.click(radioButton);
|
|
159
138
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
160
139
|
});
|
|
161
140
|
|
|
162
141
|
it(`clicking on the radio button or it's label will raise onChange with the value`, () => {
|
|
163
|
-
const
|
|
164
|
-
currentTarget: { checked: true },
|
|
165
|
-
};
|
|
166
|
-
const onChangeSpy = jest.fn();
|
|
142
|
+
const onChangeSpy = vi.fn();
|
|
167
143
|
|
|
168
|
-
const
|
|
144
|
+
const { container } = render(
|
|
145
|
+
<Radio {...defaultProps} onChange={onChangeSpy} />,
|
|
146
|
+
);
|
|
169
147
|
|
|
170
|
-
const
|
|
171
|
-
const
|
|
148
|
+
const radioButtons = container.querySelectorAll('input');
|
|
149
|
+
const radioButton = radioButtons[0] as HTMLInputElement;
|
|
150
|
+
const secondButton = radioButtons[1] as HTMLInputElement;
|
|
172
151
|
|
|
173
|
-
|
|
174
|
-
|
|
152
|
+
fireEvent.click(radioButton);
|
|
153
|
+
fireEvent.click(secondButton);
|
|
175
154
|
|
|
176
155
|
expect(onChangeSpy).toHaveBeenCalledTimes(2);
|
|
177
|
-
expect(onChangeSpy).toHaveBeenNthCalledWith(1, mockValue);
|
|
178
|
-
expect(onChangeSpy).toHaveBeenNthCalledWith(2, mockValue);
|
|
179
156
|
});
|
|
180
157
|
|
|
181
158
|
it('applies error styling and renders error message when an error is passed', () => {
|
|
182
159
|
const [option1] = defaultProps.options ?? [];
|
|
183
160
|
const mockErrorMessage = 'test-error-message';
|
|
184
|
-
const
|
|
161
|
+
const { container } = render(
|
|
185
162
|
<Radio {...defaultProps} options={[option1]} error={mockErrorMessage} />,
|
|
186
163
|
);
|
|
187
164
|
|
|
188
|
-
const
|
|
189
|
-
const
|
|
165
|
+
const errorMsg = container.querySelector('small');
|
|
166
|
+
const svg = container.querySelector('svg');
|
|
190
167
|
|
|
191
|
-
expect(errorMsg
|
|
192
|
-
expect(
|
|
168
|
+
expect(errorMsg?.textContent).toBe(mockErrorMessage);
|
|
169
|
+
expect(svg?.classList.contains('hasError')).toBe(true);
|
|
193
170
|
});
|
|
194
171
|
|
|
195
172
|
describe('confirmation', () => {
|
|
196
173
|
const mockEvent = {
|
|
197
174
|
e: 'event',
|
|
198
|
-
persist: () =>
|
|
175
|
+
persist: () => vi.fn(),
|
|
199
176
|
};
|
|
200
177
|
|
|
201
178
|
it(`'Advanced' mode changes applies confirmation styles`, async () => {
|
|
202
|
-
const
|
|
203
|
-
currentTarget: { checked: true },
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const wrapper = mount(
|
|
179
|
+
const { container } = render(
|
|
207
180
|
<Radio {...defaultProps} confirmationMode="Advanced" />,
|
|
208
181
|
);
|
|
209
182
|
|
|
210
|
-
const radioButton =
|
|
211
|
-
let confirmation =
|
|
183
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
184
|
+
let confirmation = document.querySelector('.confirm-dialog-container');
|
|
212
185
|
|
|
213
|
-
expect(confirmation
|
|
186
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
214
187
|
|
|
215
|
-
|
|
216
|
-
|
|
188
|
+
act(() => {
|
|
189
|
+
fireEvent.click(radioButton);
|
|
217
190
|
});
|
|
218
|
-
wrapper.update();
|
|
219
191
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
192
|
+
await waitFor(() => {
|
|
193
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
194
|
+
expect(confirmation).toBeInTheDocument();
|
|
195
|
+
});
|
|
223
196
|
|
|
224
|
-
|
|
197
|
+
const radioInputs = container.querySelectorAll('input');
|
|
198
|
+
const radioSVG = container.querySelectorAll('svg');
|
|
225
199
|
|
|
226
|
-
expect(radioSVG
|
|
227
|
-
expect(radioSVG
|
|
228
|
-
expect(radioSVG
|
|
229
|
-
expect(radioSVG
|
|
230
|
-
expect(radioSVG
|
|
231
|
-
expect(radioSVG
|
|
200
|
+
expect(radioSVG[0].classList.contains('hasConfirm')).toBe(true);
|
|
201
|
+
expect(radioSVG[0].classList.contains('unSelectable')).toBe(true);
|
|
202
|
+
expect(radioSVG[1].classList.contains('hasConfirm')).toBe(false);
|
|
203
|
+
expect(radioSVG[1].classList.contains('unSelectable')).toBe(true);
|
|
204
|
+
expect(radioSVG[2].classList.contains('hasConfirm')).toBe(false);
|
|
205
|
+
expect(radioSVG[2].classList.contains('unSelectable')).toBe(true);
|
|
232
206
|
radioInputs.forEach((radioInput) => {
|
|
233
|
-
expect(radioInput.
|
|
207
|
+
expect((radioInput as HTMLInputElement).disabled).toBe(true);
|
|
234
208
|
});
|
|
235
209
|
});
|
|
236
210
|
|
|
237
|
-
it(`'Advanced' mode renders a confirmation pop up, emits new value when 'Confirm' button is clicked, and finally dismisses the confirmation pop up`, () => {
|
|
238
|
-
const spy =
|
|
239
|
-
const mockValue = {
|
|
240
|
-
currentTarget: { checked: true },
|
|
241
|
-
};
|
|
211
|
+
it(`'Advanced' mode renders a confirmation pop up, emits new value when 'Confirm' button is clicked, and finally dismisses the confirmation pop up`, async () => {
|
|
212
|
+
const spy = vi.fn();
|
|
242
213
|
const [option1] = defaultProps.options ?? [];
|
|
243
214
|
|
|
244
|
-
const
|
|
215
|
+
const { container } = render(
|
|
245
216
|
<Radio {...defaultProps} confirmationMode="Advanced" onChange={spy} />,
|
|
246
217
|
);
|
|
247
218
|
|
|
248
|
-
const radioButton =
|
|
249
|
-
let confirmation =
|
|
219
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
220
|
+
let confirmation = document.querySelector('.confirm-dialog-container');
|
|
250
221
|
|
|
251
|
-
expect(confirmation
|
|
222
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
252
223
|
|
|
253
224
|
act(() => {
|
|
254
|
-
|
|
225
|
+
fireEvent.click(radioButton);
|
|
255
226
|
});
|
|
256
|
-
wrapper.update();
|
|
257
|
-
|
|
258
|
-
confirmation = wrapper.find(ConfirmDialog);
|
|
259
227
|
|
|
260
|
-
|
|
228
|
+
await waitFor(() => {
|
|
229
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
230
|
+
expect(confirmation).toBeInTheDocument();
|
|
231
|
+
});
|
|
261
232
|
|
|
262
|
-
const confirmButton =
|
|
233
|
+
const confirmButton = document.querySelector(
|
|
234
|
+
'[data-test-id="confirm"]',
|
|
235
|
+
) as HTMLButtonElement;
|
|
263
236
|
|
|
264
237
|
act(() => {
|
|
265
|
-
|
|
266
|
-
|
|
238
|
+
fireEvent.click(confirmButton);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
await waitFor(() => {
|
|
242
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
243
|
+
expect(spy).toHaveBeenCalledWith(
|
|
244
|
+
expect.objectContaining({ currentTarget: { value: option1.value } }),
|
|
245
|
+
);
|
|
267
246
|
});
|
|
268
|
-
wrapper.update();
|
|
269
247
|
|
|
270
|
-
const radioButtons =
|
|
271
|
-
|
|
248
|
+
const radioButtons = container.querySelectorAll('input');
|
|
249
|
+
|
|
250
|
+
await waitFor(
|
|
251
|
+
() => {
|
|
252
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
253
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
254
|
+
},
|
|
255
|
+
{ timeout: 1000 },
|
|
256
|
+
);
|
|
272
257
|
|
|
273
258
|
radioButtons.forEach((radioInput) => {
|
|
274
|
-
expect(
|
|
259
|
+
expect(
|
|
260
|
+
(radioInput as HTMLInputElement).classList.contains('hasConfirm'),
|
|
261
|
+
).toBe(false);
|
|
275
262
|
});
|
|
276
|
-
expect(confirmation.exists()).toBe(false);
|
|
277
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
278
|
-
expect(spy).toHaveBeenCalledWith(
|
|
279
|
-
expect.objectContaining({ currentTarget: { value: option1.value } }),
|
|
280
|
-
);
|
|
281
263
|
});
|
|
282
264
|
|
|
283
|
-
it(`'Advanced' mode renders a confirmation pop up, does not raise the 'onChange' event after the 'Cancel' button is clicked, and finally dismisses the confirmation pop up`, () => {
|
|
284
|
-
const spy =
|
|
285
|
-
const mockValue = {
|
|
286
|
-
currentTarget: { checked: true },
|
|
287
|
-
};
|
|
265
|
+
it(`'Advanced' mode renders a confirmation pop up, does not raise the 'onChange' event after the 'Cancel' button is clicked, and finally dismisses the confirmation pop up`, async () => {
|
|
266
|
+
const spy = vi.fn();
|
|
288
267
|
|
|
289
|
-
const
|
|
268
|
+
const { container } = render(
|
|
290
269
|
<Radio {...defaultProps} confirmationMode="Advanced" onChange={spy} />,
|
|
291
270
|
);
|
|
292
271
|
|
|
293
|
-
const radioButton =
|
|
294
|
-
let confirmation =
|
|
272
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
273
|
+
let confirmation = document.querySelector('.confirm-dialog-container');
|
|
295
274
|
|
|
296
|
-
expect(confirmation
|
|
275
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
297
276
|
|
|
298
277
|
act(() => {
|
|
299
|
-
|
|
278
|
+
fireEvent.click(radioButton);
|
|
300
279
|
});
|
|
301
|
-
wrapper.update();
|
|
302
280
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
281
|
+
await waitFor(() => {
|
|
282
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
283
|
+
expect(confirmation).toBeInTheDocument();
|
|
284
|
+
});
|
|
306
285
|
|
|
307
|
-
const cancelButton =
|
|
286
|
+
const cancelButton = document.querySelector(
|
|
287
|
+
'[data-test-id="cancel"]',
|
|
288
|
+
) as HTMLButtonElement;
|
|
308
289
|
|
|
309
290
|
act(() => {
|
|
310
|
-
|
|
311
|
-
cancelButton.prop('onClick')?.(mockEvent);
|
|
291
|
+
fireEvent.click(cancelButton);
|
|
312
292
|
});
|
|
313
|
-
wrapper.update();
|
|
314
293
|
|
|
315
|
-
|
|
316
|
-
|
|
294
|
+
await waitFor(() => {
|
|
295
|
+
expect(spy).not.toHaveBeenCalled();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const radioButtons = container.querySelectorAll('input');
|
|
299
|
+
|
|
300
|
+
await waitFor(
|
|
301
|
+
() => {
|
|
302
|
+
confirmation = document.querySelector('.confirm-dialog-container');
|
|
303
|
+
expect(confirmation).not.toBeInTheDocument();
|
|
304
|
+
},
|
|
305
|
+
{ timeout: 1000 },
|
|
306
|
+
);
|
|
317
307
|
|
|
318
308
|
radioButtons.forEach((radioInput) => {
|
|
319
|
-
expect(
|
|
309
|
+
expect(
|
|
310
|
+
(radioInput as HTMLInputElement).classList.contains('hasConfirm'),
|
|
311
|
+
).toBe(false);
|
|
320
312
|
});
|
|
321
|
-
expect(confirmation.exists()).toBe(false);
|
|
322
|
-
expect(spy).not.toHaveBeenCalled();
|
|
323
313
|
});
|
|
324
314
|
|
|
325
|
-
it(`emits 'onConfirmOpen' if set`, () => {
|
|
326
|
-
const spy =
|
|
327
|
-
const mockValue = {
|
|
328
|
-
currentTarget: { checked: true },
|
|
329
|
-
};
|
|
315
|
+
it(`emits 'onConfirmOpen' if set`, async () => {
|
|
316
|
+
const spy = vi.fn();
|
|
330
317
|
|
|
331
|
-
const
|
|
318
|
+
const { container } = render(
|
|
332
319
|
<Radio
|
|
333
320
|
{...defaultProps}
|
|
334
321
|
confirmationMode="Advanced"
|
|
@@ -336,23 +323,34 @@ describe('Radio', () => {
|
|
|
336
323
|
/>,
|
|
337
324
|
);
|
|
338
325
|
|
|
339
|
-
const radioButton =
|
|
326
|
+
const radioButton = container.querySelector('input') as HTMLInputElement;
|
|
340
327
|
|
|
341
328
|
act(() => {
|
|
342
|
-
|
|
329
|
+
fireEvent.click(radioButton);
|
|
343
330
|
});
|
|
344
|
-
wrapper.update();
|
|
345
331
|
|
|
346
|
-
|
|
332
|
+
await waitFor(() => {
|
|
333
|
+
const confirmation = document.querySelector(
|
|
334
|
+
'.confirm-dialog-container',
|
|
335
|
+
);
|
|
336
|
+
expect(confirmation).toBeInTheDocument();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
340
|
+
expect(spy).toHaveBeenNthCalledWith(1, true);
|
|
341
|
+
|
|
342
|
+
const cancelButton = document.querySelector(
|
|
343
|
+
'[data-test-id="cancel"]',
|
|
344
|
+
) as HTMLButtonElement;
|
|
347
345
|
|
|
348
346
|
act(() => {
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
fireEvent.click(cancelButton);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
await waitFor(() => {
|
|
351
|
+
expect(spy).toHaveBeenCalledTimes(2);
|
|
351
352
|
});
|
|
352
|
-
wrapper.update();
|
|
353
353
|
|
|
354
|
-
expect(spy).toHaveBeenCalledTimes(2);
|
|
355
|
-
expect(spy).toHaveBeenNthCalledWith(1, true);
|
|
356
354
|
expect(spy).toHaveBeenNthCalledWith(2, false);
|
|
357
355
|
});
|
|
358
356
|
});
|
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
4
|
import { ReadOnlyField } from './ReadOnlyField';
|
|
4
5
|
|
|
5
6
|
describe('ReadOnlyField', () => {
|
|
6
7
|
it('renders the component without crashing', () => {
|
|
7
|
-
const
|
|
8
|
+
const { container } = render(<ReadOnlyField />);
|
|
8
9
|
|
|
9
|
-
expect(
|
|
10
|
+
expect(container).toBeTruthy();
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
it('displays a label', () => {
|
|
13
14
|
const mockLabel = 'mockLabel';
|
|
14
|
-
const
|
|
15
|
+
const { container } = render(<ReadOnlyField label={mockLabel} />);
|
|
15
16
|
|
|
16
|
-
const label =
|
|
17
|
+
const label = container.querySelector('label');
|
|
17
18
|
|
|
18
|
-
expect(label
|
|
19
|
+
expect(label?.textContent).toBe(mockLabel);
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
it('renders a string value', () => {
|
|
22
23
|
const mockValue = 'mockLabel';
|
|
23
|
-
const
|
|
24
|
+
const { container } = render(<ReadOnlyField value={mockValue} />);
|
|
24
25
|
|
|
25
|
-
const value =
|
|
26
|
+
const value = container.querySelector('.value');
|
|
26
27
|
|
|
27
|
-
expect(value
|
|
28
|
+
expect(value?.textContent).toBe(mockValue);
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
it('renders a numeric value', () => {
|
|
31
32
|
const mockValue = 3;
|
|
32
|
-
const
|
|
33
|
+
const { container } = render(<ReadOnlyField value={mockValue} />);
|
|
33
34
|
|
|
34
|
-
const value =
|
|
35
|
+
const value = container.querySelector('.value');
|
|
35
36
|
|
|
36
|
-
expect(value
|
|
37
|
+
expect(value?.textContent).toBe(String(mockValue));
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
it('renders an array of values', () => {
|
|
40
41
|
const mockValue = ['de', 'en', 'ja', 'fr'];
|
|
41
|
-
const
|
|
42
|
+
const { container } = render(<ReadOnlyField value={mockValue} />);
|
|
42
43
|
|
|
43
|
-
const value =
|
|
44
|
+
const value = container.querySelector('.value');
|
|
44
45
|
|
|
45
|
-
expect(value
|
|
46
|
+
expect(value?.textContent).toBe('de, en, ja, fr');
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
it('defaults to empty strings for label and value', () => {
|
|
49
50
|
const mockDefaults = '';
|
|
50
|
-
const
|
|
51
|
+
const { container } = render(<ReadOnlyField />);
|
|
51
52
|
|
|
52
|
-
const label =
|
|
53
|
-
const value =
|
|
53
|
+
const label = container.querySelector('label');
|
|
54
|
+
const value = container.querySelector('.value');
|
|
54
55
|
|
|
55
|
-
expect(label
|
|
56
|
-
expect(value
|
|
56
|
+
expect(label?.textContent).toBe(mockDefaults);
|
|
57
|
+
expect(value?.textContent).toBe(mockDefaults);
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
it('triggers transform functions once per render', () => {
|
|
60
|
-
const spy =
|
|
61
|
+
const spy = vi.fn();
|
|
61
62
|
const mockValue = 3;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
render(<ReadOnlyField value={mockValue} transform={spy} />);
|
|
64
65
|
|
|
65
66
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
66
67
|
expect(spy).toHaveBeenCalledWith(3);
|