@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,98 +1,91 @@
|
|
|
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
4
|
import { config } from 'react-transition-group';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
6
|
import { wait } from '../../../helpers/storybook';
|
|
6
|
-
import { Button } from '../../Buttons';
|
|
7
7
|
import { CustomTags } from './CustomTags';
|
|
8
8
|
|
|
9
9
|
describe('CustomTags', () => {
|
|
10
10
|
// Disable Animations for testing
|
|
11
11
|
config.disabled = true;
|
|
12
12
|
|
|
13
|
-
const getTagsFromDOM = (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const getTagsFromDOM = (container: HTMLElement): string[] => {
|
|
14
|
+
const tags = container.querySelectorAll('span > span');
|
|
15
|
+
return Array.from(tags).map((node) => node.textContent || '');
|
|
16
|
+
};
|
|
17
17
|
|
|
18
18
|
it('renders the component without crashing', () => {
|
|
19
|
-
const
|
|
19
|
+
const { container } = render(<CustomTags name={'test-name'} />);
|
|
20
20
|
|
|
21
|
-
expect(
|
|
21
|
+
expect(container).toBeTruthy();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('displays a label', () => {
|
|
25
25
|
const mockLabel = 'mockLabel';
|
|
26
|
-
const
|
|
26
|
+
const { container } = render(
|
|
27
27
|
<CustomTags name={'test-name'} label={mockLabel} />,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
const label =
|
|
30
|
+
const label = container.querySelector('label');
|
|
31
31
|
|
|
32
|
-
expect(label
|
|
32
|
+
expect(label?.textContent).toBe(mockLabel);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it(`each Button component should have type of 'button'`, () => {
|
|
36
36
|
const mockCurrentTags = ['1', '2', '3'];
|
|
37
|
-
const
|
|
37
|
+
const { container } = render(
|
|
38
38
|
<CustomTags name={'test-name'} value={mockCurrentTags} />,
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
-
const buttons =
|
|
41
|
+
const buttons = container.querySelectorAll('button');
|
|
42
42
|
|
|
43
43
|
buttons.forEach((button) => {
|
|
44
|
-
expect(button.
|
|
44
|
+
expect((button as HTMLButtonElement).type).toBe('button');
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
it('should render one plus button', () => {
|
|
49
|
-
const
|
|
50
|
-
const plusButton =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
type: 'button',
|
|
54
|
-
})
|
|
55
|
-
.first();
|
|
56
|
-
|
|
57
|
-
expect(plusButton).toHaveLength(1);
|
|
49
|
+
const { container } = render(<CustomTags name="test-name" />);
|
|
50
|
+
const plusButton = container.querySelector('.plusButton');
|
|
51
|
+
|
|
52
|
+
expect(plusButton).toBeInTheDocument();
|
|
58
53
|
});
|
|
59
54
|
|
|
60
55
|
it('should disable plus button if there is no value in input field', () => {
|
|
61
|
-
const
|
|
62
|
-
const plusButton =
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.first();
|
|
68
|
-
expect(plusButton.prop('disabled')).toBeTruthy();
|
|
56
|
+
const { container } = render(<CustomTags name="test-name" />);
|
|
57
|
+
const plusButton = container.querySelector(
|
|
58
|
+
'.plusButton',
|
|
59
|
+
) as HTMLButtonElement;
|
|
60
|
+
|
|
61
|
+
expect(plusButton.disabled).toBeTruthy();
|
|
69
62
|
});
|
|
70
63
|
|
|
71
64
|
it('displays a tag for each currently selected tag', () => {
|
|
72
65
|
const mockCurrentTags = ['1', '2', '3'];
|
|
73
|
-
const
|
|
66
|
+
const { container } = render(
|
|
74
67
|
<CustomTags name={'test-name'} value={mockCurrentTags} />,
|
|
75
68
|
);
|
|
76
69
|
|
|
77
|
-
const tags =
|
|
70
|
+
const tags = getTagsFromDOM(container);
|
|
78
71
|
|
|
79
72
|
expect(tags).toHaveLength(3);
|
|
80
73
|
expect(tags).toEqual(mockCurrentTags);
|
|
81
74
|
});
|
|
82
75
|
|
|
83
76
|
it(`input attribute 'autocomplete' should be set to 'off'`, () => {
|
|
84
|
-
const
|
|
77
|
+
const { container } = render(<CustomTags name={'test-name'} />);
|
|
85
78
|
|
|
86
|
-
const
|
|
79
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
87
80
|
|
|
88
|
-
expect(
|
|
81
|
+
expect(input.autocomplete).toBe('off');
|
|
89
82
|
});
|
|
90
83
|
|
|
91
84
|
it('raises onChange when the "Enter" key is pressed with the new value, updates custom tags with entered tag, and resets input value', async () => {
|
|
92
|
-
const onChangeSpy =
|
|
85
|
+
const onChangeSpy = vi.fn();
|
|
93
86
|
const mockCurrentTags = ['1', '2', '3'];
|
|
94
87
|
const mockTag = '4';
|
|
95
|
-
const
|
|
88
|
+
const { container } = render(
|
|
96
89
|
<CustomTags
|
|
97
90
|
name={'test-name'}
|
|
98
91
|
onChange={onChangeSpy}
|
|
@@ -100,42 +93,30 @@ describe('CustomTags', () => {
|
|
|
100
93
|
/>,
|
|
101
94
|
);
|
|
102
95
|
|
|
103
|
-
let tags = getTagsFromDOM(
|
|
96
|
+
let tags = getTagsFromDOM(container);
|
|
104
97
|
|
|
105
98
|
expect(tags).toHaveLength(3);
|
|
106
99
|
|
|
107
|
-
const input =
|
|
100
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
101
|
+
|
|
102
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
103
|
+
|
|
108
104
|
await act(async () => {
|
|
109
|
-
|
|
110
|
-
key: 'Enter',
|
|
111
|
-
//@ts-expect-error we're not passing the full EventTarget
|
|
112
|
-
currentTarget: { value: mockTag },
|
|
113
|
-
persist: () => jest.fn(),
|
|
114
|
-
preventDefault: () => jest.fn(),
|
|
115
|
-
});
|
|
116
|
-
wrapper.update();
|
|
105
|
+
fireEvent.keyDown(input, { key: 'Enter' });
|
|
117
106
|
});
|
|
118
107
|
|
|
119
|
-
tags = getTagsFromDOM(
|
|
108
|
+
tags = getTagsFromDOM(container);
|
|
120
109
|
expect(tags).toEqual([...mockCurrentTags, mockTag]);
|
|
121
110
|
expect(tags).toHaveLength(4);
|
|
122
111
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
123
|
-
expect(input.
|
|
124
|
-
// TODO refactor this when onChange is changed to emit value and not currentTarget object and look for other onChangeSpy
|
|
125
|
-
// Test is only failing due to a bug with jasmine: https://github.com/jasmine/jasmine/issues/652
|
|
126
|
-
// Objects do match, commenting it out for now.
|
|
127
|
-
// expect(spy).toHaveBeenCalledWith({
|
|
128
|
-
// currentTarget: { value: [...mockCurrentTags, mockTag] },
|
|
129
|
-
// key: 'Enter',
|
|
130
|
-
// persist: () => jest.fn(),
|
|
131
|
-
// });
|
|
112
|
+
expect(input.value).toBe('');
|
|
132
113
|
});
|
|
133
114
|
|
|
134
115
|
it('raises onChange when the "+" button is pressed with the new value, updates custom tags with entered tag, and resets input value', async () => {
|
|
135
|
-
const onChangeSpy =
|
|
116
|
+
const onChangeSpy = vi.fn();
|
|
136
117
|
const mockCurrentTags = ['1', '2', '3'];
|
|
137
118
|
const mockTag = '4';
|
|
138
|
-
const
|
|
119
|
+
const { container } = render(
|
|
139
120
|
<CustomTags
|
|
140
121
|
name={'test-name'}
|
|
141
122
|
onChange={onChangeSpy}
|
|
@@ -143,37 +124,30 @@ describe('CustomTags', () => {
|
|
|
143
124
|
/>,
|
|
144
125
|
);
|
|
145
126
|
|
|
146
|
-
let tags = getTagsFromDOM(
|
|
127
|
+
let tags = getTagsFromDOM(container);
|
|
147
128
|
|
|
148
129
|
expect(tags).toHaveLength(3);
|
|
149
130
|
|
|
150
|
-
const input =
|
|
131
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
151
132
|
|
|
152
|
-
|
|
153
|
-
attribute.value = mockTag;
|
|
154
|
-
input.getDOMNode().setAttributeNode(attribute);
|
|
155
|
-
input.simulate('change');
|
|
156
|
-
wrapper.update();
|
|
133
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
157
134
|
|
|
158
|
-
const plusButton =
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
})
|
|
163
|
-
.first();
|
|
164
|
-
plusButton.simulate('click');
|
|
135
|
+
const plusButton = container.querySelector(
|
|
136
|
+
'.plusButton',
|
|
137
|
+
) as HTMLButtonElement;
|
|
138
|
+
fireEvent.click(plusButton);
|
|
165
139
|
|
|
166
|
-
tags = getTagsFromDOM(
|
|
140
|
+
tags = getTagsFromDOM(container);
|
|
167
141
|
expect(tags).toEqual([...mockCurrentTags, mockTag]);
|
|
168
142
|
expect(tags).toHaveLength(4);
|
|
169
143
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
170
|
-
expect(input.
|
|
144
|
+
expect(input.value).toBe('');
|
|
171
145
|
});
|
|
172
146
|
|
|
173
147
|
it('raises onChange when removing a tag along with the new value', async () => {
|
|
174
|
-
const onChangeSpy =
|
|
148
|
+
const onChangeSpy = vi.fn();
|
|
175
149
|
const mockCurrentTags = ['1', '2', '3'];
|
|
176
|
-
const
|
|
150
|
+
const { container } = render(
|
|
177
151
|
<CustomTags
|
|
178
152
|
name={'test-name'}
|
|
179
153
|
onChange={onChangeSpy}
|
|
@@ -181,22 +155,22 @@ describe('CustomTags', () => {
|
|
|
181
155
|
/>,
|
|
182
156
|
);
|
|
183
157
|
|
|
184
|
-
const
|
|
158
|
+
const removeButtons = container.querySelectorAll('svg');
|
|
159
|
+
const lastRemoveButton = removeButtons[
|
|
160
|
+
removeButtons.length - 1
|
|
161
|
+
] as SVGElement;
|
|
185
162
|
|
|
186
163
|
await act(async () => {
|
|
187
|
-
|
|
188
|
-
persist: () => jest.fn(),
|
|
189
|
-
});
|
|
190
|
-
wrapper.update();
|
|
164
|
+
fireEvent.click(lastRemoveButton);
|
|
191
165
|
});
|
|
192
166
|
|
|
193
167
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
194
168
|
});
|
|
195
169
|
|
|
196
170
|
it('raises onChange and updates custom tags when removing a tag', async () => {
|
|
197
|
-
const onChangeSpy =
|
|
171
|
+
const onChangeSpy = vi.fn();
|
|
198
172
|
const mockCurrentTags = ['1', '2', '3'];
|
|
199
|
-
const
|
|
173
|
+
const { container } = render(
|
|
200
174
|
<CustomTags
|
|
201
175
|
name={'test-name'}
|
|
202
176
|
onChange={onChangeSpy}
|
|
@@ -204,56 +178,56 @@ describe('CustomTags', () => {
|
|
|
204
178
|
/>,
|
|
205
179
|
);
|
|
206
180
|
|
|
207
|
-
let tags = getTagsFromDOM(
|
|
181
|
+
let tags = getTagsFromDOM(container);
|
|
208
182
|
|
|
209
183
|
expect(tags).toHaveLength(3);
|
|
210
184
|
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
185
|
+
const removeButtons = container.querySelectorAll('svg');
|
|
186
|
+
const lastRemoveButton = removeButtons[
|
|
187
|
+
removeButtons.length - 1
|
|
188
|
+
] as SVGElement;
|
|
216
189
|
|
|
217
190
|
await act(async () => {
|
|
218
|
-
|
|
219
|
-
tags = getTagsFromDOM(wrapper);
|
|
191
|
+
fireEvent.click(lastRemoveButton);
|
|
220
192
|
});
|
|
221
193
|
|
|
194
|
+
tags = getTagsFromDOM(container);
|
|
195
|
+
|
|
222
196
|
expect(tags).toEqual(['1', '2']);
|
|
223
197
|
expect(tags).toHaveLength(2);
|
|
224
198
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
225
199
|
});
|
|
226
200
|
|
|
227
201
|
it('raises onFocus event', () => {
|
|
228
|
-
const focusSpy =
|
|
229
|
-
const
|
|
202
|
+
const focusSpy = vi.fn();
|
|
203
|
+
const { container } = render(
|
|
230
204
|
<CustomTags name={'test-name'} onFocus={focusSpy} />,
|
|
231
205
|
);
|
|
232
206
|
|
|
233
|
-
const input =
|
|
207
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
234
208
|
|
|
235
|
-
|
|
209
|
+
fireEvent.focus(input);
|
|
236
210
|
expect(focusSpy).toHaveBeenCalledTimes(1);
|
|
237
211
|
});
|
|
238
212
|
|
|
239
213
|
describe('onBlur', () => {
|
|
240
214
|
it('raises onBlur event', () => {
|
|
241
|
-
const blurSpy =
|
|
242
|
-
const
|
|
215
|
+
const blurSpy = vi.fn();
|
|
216
|
+
const { container } = render(
|
|
243
217
|
<CustomTags name={'test-name'} onBlur={blurSpy} />,
|
|
244
218
|
);
|
|
245
219
|
|
|
246
|
-
const input =
|
|
220
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
247
221
|
|
|
248
|
-
|
|
222
|
+
fireEvent.blur(input);
|
|
249
223
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
250
224
|
});
|
|
251
225
|
|
|
252
226
|
it('adds a valid value to current tags state', async () => {
|
|
253
|
-
const blurSpy =
|
|
227
|
+
const blurSpy = vi.fn();
|
|
254
228
|
const mockCurrentTags = ['1', '2', '3'];
|
|
255
229
|
const mockTag = '4';
|
|
256
|
-
const
|
|
230
|
+
const { container } = render(
|
|
257
231
|
<CustomTags
|
|
258
232
|
name={'test-name'}
|
|
259
233
|
onBlur={blurSpy}
|
|
@@ -261,30 +235,27 @@ describe('CustomTags', () => {
|
|
|
261
235
|
/>,
|
|
262
236
|
);
|
|
263
237
|
|
|
264
|
-
let tags = getTagsFromDOM(
|
|
238
|
+
let tags = getTagsFromDOM(container);
|
|
265
239
|
|
|
266
240
|
expect(tags).toHaveLength(3);
|
|
267
241
|
|
|
268
|
-
const input =
|
|
242
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
269
243
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
input.getDOMNode().setAttributeNode(attribute);
|
|
273
|
-
input.simulate('blur');
|
|
274
|
-
wrapper.update();
|
|
244
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
245
|
+
fireEvent.blur(input);
|
|
275
246
|
|
|
276
|
-
tags = getTagsFromDOM(
|
|
247
|
+
tags = getTagsFromDOM(container);
|
|
277
248
|
expect(tags).toEqual([...mockCurrentTags, mockTag]);
|
|
278
249
|
expect(tags).toHaveLength(4);
|
|
279
250
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
280
|
-
expect(input.
|
|
251
|
+
expect(input.value).toBe('');
|
|
281
252
|
});
|
|
282
253
|
|
|
283
254
|
it(`doesn't add value if value isn't valid`, async () => {
|
|
284
|
-
const blurSpy =
|
|
255
|
+
const blurSpy = vi.fn();
|
|
285
256
|
const mockCurrentTags = ['1', '2', '3'];
|
|
286
257
|
const mockInvalidTag = '';
|
|
287
|
-
const
|
|
258
|
+
const { container } = render(
|
|
288
259
|
<CustomTags
|
|
289
260
|
name={'test-name'}
|
|
290
261
|
onBlur={blurSpy}
|
|
@@ -292,30 +263,27 @@ describe('CustomTags', () => {
|
|
|
292
263
|
/>,
|
|
293
264
|
);
|
|
294
265
|
|
|
295
|
-
let tags = getTagsFromDOM(
|
|
266
|
+
let tags = getTagsFromDOM(container);
|
|
296
267
|
|
|
297
268
|
expect(tags).toHaveLength(3);
|
|
298
269
|
|
|
299
|
-
const input =
|
|
270
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
300
271
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
input.getDOMNode().setAttributeNode(attribute);
|
|
304
|
-
input.simulate('blur');
|
|
305
|
-
wrapper.update();
|
|
272
|
+
fireEvent.change(input, { target: { value: mockInvalidTag } });
|
|
273
|
+
fireEvent.blur(input);
|
|
306
274
|
|
|
307
|
-
tags = getTagsFromDOM(
|
|
275
|
+
tags = getTagsFromDOM(container);
|
|
308
276
|
expect(tags).toEqual([...mockCurrentTags]);
|
|
309
277
|
expect(tags).toHaveLength(3);
|
|
310
278
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
311
|
-
expect(input.
|
|
279
|
+
expect(input.value).toBe('');
|
|
312
280
|
});
|
|
313
281
|
|
|
314
282
|
it(`resets input and add button if value is an empty space(s)`, async () => {
|
|
315
|
-
const blurSpy =
|
|
283
|
+
const blurSpy = vi.fn();
|
|
316
284
|
const mockCurrentTags = ['1', '2', '3'];
|
|
317
285
|
const mockInvalidTag = ' ';
|
|
318
|
-
const
|
|
286
|
+
const { container } = render(
|
|
319
287
|
<CustomTags
|
|
320
288
|
name={'test-name'}
|
|
321
289
|
onBlur={blurSpy}
|
|
@@ -323,45 +291,42 @@ describe('CustomTags', () => {
|
|
|
323
291
|
/>,
|
|
324
292
|
);
|
|
325
293
|
|
|
326
|
-
let tags = getTagsFromDOM(
|
|
294
|
+
let tags = getTagsFromDOM(container);
|
|
327
295
|
|
|
328
296
|
expect(tags).toHaveLength(3);
|
|
329
297
|
|
|
330
|
-
const input =
|
|
298
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
331
299
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
input.getDOMNode().setAttributeNode(attribute);
|
|
335
|
-
input.simulate('blur');
|
|
336
|
-
wrapper.update();
|
|
300
|
+
fireEvent.change(input, { target: { value: mockInvalidTag } });
|
|
301
|
+
fireEvent.blur(input);
|
|
337
302
|
|
|
338
|
-
tags = getTagsFromDOM(
|
|
303
|
+
tags = getTagsFromDOM(container);
|
|
339
304
|
expect(tags).toEqual([...mockCurrentTags]);
|
|
340
305
|
expect(tags).toHaveLength(3);
|
|
341
306
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
342
|
-
expect(input.
|
|
307
|
+
expect(input.value).toBe('');
|
|
343
308
|
});
|
|
344
309
|
});
|
|
345
310
|
|
|
346
311
|
it('display tags inline', () => {
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
expect(
|
|
312
|
+
const { container } = render(<CustomTags name={'test-name'} />);
|
|
313
|
+
const tagsWrapper = container.querySelector('.tagsWrapper') as HTMLElement;
|
|
314
|
+
expect(tagsWrapper.style.flexDirection).toBe('row');
|
|
350
315
|
});
|
|
351
316
|
|
|
352
317
|
it('display tags as rows', () => {
|
|
353
|
-
const
|
|
318
|
+
const { container } = render(
|
|
354
319
|
<CustomTags name={'test-name'} displayAsRows={true} />,
|
|
355
320
|
);
|
|
356
|
-
const
|
|
357
|
-
expect(
|
|
321
|
+
const tagsWrapper = container.querySelector('.tagsWrapper') as HTMLElement;
|
|
322
|
+
expect(tagsWrapper.style.flexDirection).toBe('column');
|
|
358
323
|
});
|
|
359
324
|
|
|
360
325
|
it('should not raise onChange nor update current tags if the value is an empty string', () => {
|
|
361
|
-
const onChangeSpy =
|
|
326
|
+
const onChangeSpy = vi.fn();
|
|
362
327
|
const mockCurrentTags = ['1', '2', '3'];
|
|
363
328
|
const mockTag = '';
|
|
364
|
-
const
|
|
329
|
+
const { container } = render(
|
|
365
330
|
<CustomTags
|
|
366
331
|
name={'test-name'}
|
|
367
332
|
onChange={onChangeSpy}
|
|
@@ -369,21 +334,16 @@ describe('CustomTags', () => {
|
|
|
369
334
|
/>,
|
|
370
335
|
);
|
|
371
336
|
|
|
372
|
-
let tags =
|
|
337
|
+
let tags = getTagsFromDOM(container);
|
|
373
338
|
|
|
374
339
|
expect(tags).toHaveLength(3);
|
|
375
340
|
|
|
376
|
-
const input =
|
|
341
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
377
342
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
//@ts-expect-error we're not passing the full EventTarget
|
|
381
|
-
currentTarget: { value: mockTag },
|
|
382
|
-
persist: () => jest.fn(),
|
|
383
|
-
preventDefault: () => jest.fn(),
|
|
384
|
-
});
|
|
343
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
344
|
+
fireEvent.keyDown(input, { key: 'Enter' });
|
|
385
345
|
|
|
386
|
-
tags =
|
|
346
|
+
tags = getTagsFromDOM(container);
|
|
387
347
|
|
|
388
348
|
expect(tags).toEqual(mockCurrentTags);
|
|
389
349
|
expect(tags).toHaveLength(3);
|
|
@@ -391,10 +351,10 @@ describe('CustomTags', () => {
|
|
|
391
351
|
});
|
|
392
352
|
|
|
393
353
|
it('should not raise onChange nor update current tags if the value is a duplicate', () => {
|
|
394
|
-
const onChangeSpy =
|
|
354
|
+
const onChangeSpy = vi.fn();
|
|
395
355
|
const mockCurrentTags = ['1', '2', '3'];
|
|
396
356
|
const mockTag = '2';
|
|
397
|
-
const
|
|
357
|
+
const { container } = render(
|
|
398
358
|
<CustomTags
|
|
399
359
|
name={'test-name'}
|
|
400
360
|
onChange={onChangeSpy}
|
|
@@ -402,21 +362,16 @@ describe('CustomTags', () => {
|
|
|
402
362
|
/>,
|
|
403
363
|
);
|
|
404
364
|
|
|
405
|
-
let tags =
|
|
365
|
+
let tags = getTagsFromDOM(container);
|
|
406
366
|
|
|
407
367
|
expect(tags).toHaveLength(3);
|
|
408
368
|
|
|
409
|
-
const input =
|
|
369
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
410
370
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
//@ts-expect-error we're not passing the full EventTarget
|
|
414
|
-
currentTarget: { value: mockTag },
|
|
415
|
-
persist: () => jest.fn(),
|
|
416
|
-
preventDefault: () => jest.fn(),
|
|
417
|
-
});
|
|
371
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
372
|
+
fireEvent.keyDown(input, { key: 'Enter' });
|
|
418
373
|
|
|
419
|
-
tags =
|
|
374
|
+
tags = getTagsFromDOM(container);
|
|
420
375
|
|
|
421
376
|
expect(tags).toEqual(mockCurrentTags);
|
|
422
377
|
expect(tags).toHaveLength(3);
|
|
@@ -425,40 +380,35 @@ describe('CustomTags', () => {
|
|
|
425
380
|
|
|
426
381
|
it('trims the entered value', () => {
|
|
427
382
|
const mockTag = ' TagWithSpace';
|
|
428
|
-
const
|
|
383
|
+
const { container } = render(<CustomTags name={'test-name'} />);
|
|
429
384
|
|
|
430
|
-
const input =
|
|
385
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
431
386
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
//@ts-expect-error we're not passing the full EventTarget
|
|
435
|
-
currentTarget: { value: mockTag },
|
|
436
|
-
persist: () => jest.fn(),
|
|
437
|
-
preventDefault: () => jest.fn(),
|
|
438
|
-
});
|
|
387
|
+
fireEvent.change(input, { target: { value: mockTag } });
|
|
388
|
+
fireEvent.keyDown(input, { key: 'Enter' });
|
|
439
389
|
|
|
440
|
-
const tag =
|
|
390
|
+
const tag = container.querySelector('span > span');
|
|
441
391
|
|
|
442
|
-
expect(tag
|
|
392
|
+
expect(tag?.textContent).toEqual(mockTag.trim());
|
|
443
393
|
});
|
|
444
394
|
|
|
445
395
|
describe('Error handling', () => {
|
|
446
396
|
it('applies error styling and renders error message when an error is passed', () => {
|
|
447
397
|
const mockErrorMessage = 'test-error-message';
|
|
448
|
-
const
|
|
398
|
+
const { container } = render(
|
|
449
399
|
<CustomTags name={'test-name'} error={mockErrorMessage} />,
|
|
450
400
|
);
|
|
451
|
-
const errorMsg =
|
|
452
|
-
const errorStyling =
|
|
453
|
-
expect(errorMsg
|
|
454
|
-
expect(errorStyling.
|
|
401
|
+
const errorMsg = container.querySelector('small');
|
|
402
|
+
const errorStyling = container.querySelector('input');
|
|
403
|
+
expect(errorMsg?.textContent).toBe(mockErrorMessage);
|
|
404
|
+
expect(errorStyling?.classList.contains('hasError')).toBe(true);
|
|
455
405
|
});
|
|
456
406
|
|
|
457
407
|
it(`renders a 'Duplicate value' error message when the entered value already exists`, () => {
|
|
458
|
-
const onChangeSpy =
|
|
408
|
+
const onChangeSpy = vi.fn();
|
|
459
409
|
const mockCurrentTags = ['1', '2', '3', '4'];
|
|
460
410
|
const mockNewTag = '4';
|
|
461
|
-
const
|
|
411
|
+
const { container } = render(
|
|
462
412
|
<CustomTags
|
|
463
413
|
name={'test-name'}
|
|
464
414
|
onChange={onChangeSpy}
|
|
@@ -466,57 +416,52 @@ describe('CustomTags', () => {
|
|
|
466
416
|
/>,
|
|
467
417
|
);
|
|
468
418
|
|
|
469
|
-
let errorMsg =
|
|
470
|
-
let errorStyling =
|
|
471
|
-
expect(errorMsg
|
|
472
|
-
expect(errorStyling.
|
|
419
|
+
let errorMsg = container.querySelector('small');
|
|
420
|
+
let errorStyling = container.querySelector('input');
|
|
421
|
+
expect(errorMsg).not.toBeInTheDocument();
|
|
422
|
+
expect(errorStyling?.classList.contains('hasError')).toBe(false);
|
|
473
423
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
const input = wrapper.find('input');
|
|
424
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
477
425
|
|
|
478
426
|
act(() => {
|
|
479
|
-
|
|
480
|
-
input.simulate('change', {
|
|
427
|
+
fireEvent.change(input, {
|
|
481
428
|
target: { value: mockNewTag },
|
|
482
429
|
});
|
|
483
430
|
});
|
|
484
431
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
errorMsg = wrapper.find('small');
|
|
488
|
-
errorStyling = wrapper.find('input');
|
|
432
|
+
errorMsg = container.querySelector('small');
|
|
433
|
+
errorStyling = container.querySelector('input');
|
|
489
434
|
|
|
490
|
-
expect(errorMsg
|
|
491
|
-
expect(errorStyling.
|
|
435
|
+
expect(errorMsg?.textContent).toBe('Duplicate value');
|
|
436
|
+
expect(errorStyling?.classList.contains('hasError')).toBe(true);
|
|
492
437
|
expect(onChangeSpy).not.toHaveBeenCalled();
|
|
493
438
|
});
|
|
494
439
|
});
|
|
495
440
|
|
|
496
441
|
describe('Live Suggestions', () => {
|
|
497
442
|
it(`'liveSuggestionsResolver' is undefined by default`, () => {
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const tags = wrapper.find('.container');
|
|
443
|
+
const { container } = render(<CustomTags name={'test-name'} />);
|
|
501
444
|
|
|
502
|
-
|
|
445
|
+
// liveSuggestionsResolver is a prop, not a DOM attribute, so we just verify component renders
|
|
446
|
+
expect(container.querySelector('.container')).toBeInTheDocument();
|
|
503
447
|
});
|
|
504
448
|
|
|
505
449
|
it(`sets 'liveSuggestionsDelay'`, () => {
|
|
506
450
|
const mockDelay = 500;
|
|
507
|
-
const
|
|
451
|
+
const { container } = render(
|
|
508
452
|
<CustomTags name={'test-name'} liveSuggestionsDelay={mockDelay} />,
|
|
509
453
|
);
|
|
510
454
|
|
|
511
|
-
|
|
455
|
+
// liveSuggestionsDelay is a prop, not a DOM attribute, so we just verify component renders
|
|
456
|
+
expect(container.querySelector('.container')).toBeInTheDocument();
|
|
512
457
|
});
|
|
513
458
|
|
|
514
459
|
it(`emits 'liveSuggestionsResolver' with value`, async () => {
|
|
515
460
|
const mockTag = 'test-';
|
|
516
461
|
const mockSuggestions: string[] = ['test-value', 'test-value2'];
|
|
517
|
-
const suggestionSpy =
|
|
462
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
518
463
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
519
|
-
const
|
|
464
|
+
const { container } = render(
|
|
520
465
|
<CustomTags
|
|
521
466
|
name={'test-name'}
|
|
522
467
|
value={mockCurrentTags}
|
|
@@ -524,25 +469,20 @@ describe('CustomTags', () => {
|
|
|
524
469
|
/>,
|
|
525
470
|
);
|
|
526
471
|
|
|
527
|
-
|
|
472
|
+
vi.useFakeTimers();
|
|
528
473
|
|
|
529
|
-
const input =
|
|
474
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
530
475
|
|
|
531
476
|
await act(async () => {
|
|
532
|
-
|
|
533
|
-
await input.simulate('change', {
|
|
477
|
+
fireEvent.change(input, {
|
|
534
478
|
target: { value: mockTag },
|
|
535
479
|
});
|
|
536
480
|
});
|
|
537
481
|
|
|
538
|
-
wrapper.update();
|
|
539
|
-
|
|
540
482
|
await act(async () => {
|
|
541
|
-
|
|
483
|
+
vi.runAllTimers();
|
|
542
484
|
});
|
|
543
485
|
|
|
544
|
-
wrapper.update();
|
|
545
|
-
|
|
546
486
|
expect(suggestionSpy).toHaveBeenCalledTimes(1);
|
|
547
487
|
expect(suggestionSpy).toHaveBeenCalledWith(mockTag);
|
|
548
488
|
});
|
|
@@ -550,9 +490,9 @@ describe('CustomTags', () => {
|
|
|
550
490
|
it(`renders a list of suggestions if 'liveSuggestionsResolver' returns an array which contains values`, async () => {
|
|
551
491
|
const mockTag = 'test-';
|
|
552
492
|
const mockSuggestions: string[] = ['test-value', 'test-value2'];
|
|
553
|
-
const suggestionSpy =
|
|
493
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
554
494
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
555
|
-
const
|
|
495
|
+
const { container } = render(
|
|
556
496
|
<CustomTags
|
|
557
497
|
name={'test-name'}
|
|
558
498
|
value={mockCurrentTags}
|
|
@@ -560,37 +500,32 @@ describe('CustomTags', () => {
|
|
|
560
500
|
/>,
|
|
561
501
|
);
|
|
562
502
|
|
|
563
|
-
let suggestionsWrapper =
|
|
564
|
-
let suggestions =
|
|
503
|
+
let suggestionsWrapper = container.querySelector('ul');
|
|
504
|
+
let suggestions = container.querySelectorAll('li');
|
|
565
505
|
|
|
566
|
-
expect(suggestionsWrapper
|
|
506
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
567
507
|
expect(suggestions).toHaveLength(0);
|
|
568
508
|
|
|
569
|
-
|
|
509
|
+
vi.useFakeTimers();
|
|
570
510
|
|
|
571
|
-
const input =
|
|
511
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
572
512
|
|
|
573
513
|
await act(async () => {
|
|
574
|
-
|
|
575
|
-
await input.simulate('change', {
|
|
514
|
+
fireEvent.change(input, {
|
|
576
515
|
target: { value: mockTag },
|
|
577
516
|
});
|
|
578
517
|
});
|
|
579
518
|
|
|
580
|
-
wrapper.update();
|
|
581
|
-
|
|
582
519
|
await act(async () => {
|
|
583
|
-
|
|
520
|
+
vi.runAllTimers();
|
|
584
521
|
});
|
|
585
522
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
589
|
-
suggestions = wrapper.find('li');
|
|
523
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
524
|
+
suggestions = container.querySelectorAll('li');
|
|
590
525
|
|
|
591
526
|
expect(suggestionSpy).toHaveBeenCalledTimes(1);
|
|
592
527
|
expect(suggestionSpy).toHaveBeenCalledWith(mockTag);
|
|
593
|
-
expect(suggestionsWrapper
|
|
528
|
+
expect(suggestionsWrapper).toBeInTheDocument();
|
|
594
529
|
expect(suggestions).toHaveLength(mockSuggestions.length);
|
|
595
530
|
});
|
|
596
531
|
|
|
@@ -599,7 +534,7 @@ describe('CustomTags', () => {
|
|
|
599
534
|
const firstSuggestionHandlerWait = 1000;
|
|
600
535
|
const mockSuggestions1: string[] = ['test-value'];
|
|
601
536
|
const mockSuggestions2: string[] = ['test-value2', 'test-value3'];
|
|
602
|
-
const suggestionSpy =
|
|
537
|
+
const suggestionSpy = vi
|
|
603
538
|
.fn()
|
|
604
539
|
.mockImplementationOnce(async () => {
|
|
605
540
|
await wait(1000);
|
|
@@ -609,7 +544,7 @@ describe('CustomTags', () => {
|
|
|
609
544
|
await wait(2000);
|
|
610
545
|
return mockSuggestions2;
|
|
611
546
|
});
|
|
612
|
-
const
|
|
547
|
+
const { container } = render(
|
|
613
548
|
<CustomTags
|
|
614
549
|
name={'test-name'}
|
|
615
550
|
value={[]}
|
|
@@ -618,81 +553,69 @@ describe('CustomTags', () => {
|
|
|
618
553
|
/>,
|
|
619
554
|
);
|
|
620
555
|
|
|
621
|
-
let suggestionsWrapper =
|
|
622
|
-
let suggestions =
|
|
556
|
+
let suggestionsWrapper = container.querySelector('ul');
|
|
557
|
+
let suggestions = container.querySelectorAll('li');
|
|
623
558
|
|
|
624
|
-
expect(suggestionsWrapper
|
|
559
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
625
560
|
expect(suggestions).toHaveLength(0);
|
|
626
561
|
|
|
627
|
-
|
|
562
|
+
vi.useFakeTimers();
|
|
628
563
|
|
|
629
|
-
const input =
|
|
564
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
630
565
|
|
|
631
566
|
await act(async () => {
|
|
632
|
-
|
|
633
|
-
await input.simulate('change', {
|
|
567
|
+
fireEvent.change(input, {
|
|
634
568
|
target: { value: 'value' },
|
|
635
569
|
});
|
|
636
570
|
});
|
|
637
571
|
|
|
638
|
-
wrapper.update();
|
|
639
|
-
|
|
640
572
|
// Advance time for first debounce to happen and trigger the resolver
|
|
641
573
|
await act(async () => {
|
|
642
|
-
|
|
574
|
+
vi.advanceTimersByTime(suggestionDelay);
|
|
643
575
|
});
|
|
644
576
|
|
|
645
|
-
wrapper.update();
|
|
646
|
-
|
|
647
577
|
// Change the value, so first resolver should be rejected
|
|
648
578
|
await act(async () => {
|
|
649
|
-
|
|
650
|
-
await input.simulate('change', {
|
|
579
|
+
fireEvent.change(input, {
|
|
651
580
|
target: { value: 'changed' },
|
|
652
581
|
});
|
|
653
582
|
});
|
|
654
583
|
|
|
655
|
-
wrapper.update();
|
|
656
|
-
|
|
657
584
|
// Advance time for second debounce to happen as well as the first resolver call to resolve
|
|
658
585
|
await act(async () => {
|
|
659
|
-
|
|
586
|
+
vi.advanceTimersByTime(firstSuggestionHandlerWait);
|
|
660
587
|
});
|
|
661
588
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
665
|
-
suggestions = wrapper.find('li');
|
|
589
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
590
|
+
suggestions = container.querySelectorAll('li');
|
|
666
591
|
|
|
667
592
|
expect(suggestionSpy).toHaveBeenCalledTimes(2);
|
|
668
|
-
expect(suggestionsWrapper
|
|
669
|
-
expect(suggestions
|
|
593
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
594
|
+
expect(suggestions).toHaveLength(0);
|
|
670
595
|
|
|
671
596
|
// Advance time for the second resolver to resolve
|
|
672
597
|
await act(async () => {
|
|
673
|
-
|
|
598
|
+
vi.runAllTimers();
|
|
674
599
|
// It's so nice, we do it twice!
|
|
675
600
|
// (if we do it only once, the test randomly fails sometimes...)
|
|
676
|
-
|
|
601
|
+
vi.runAllTimers();
|
|
677
602
|
});
|
|
678
603
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
682
|
-
suggestions = wrapper.find('li');
|
|
604
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
605
|
+
suggestions = container.querySelectorAll('li');
|
|
683
606
|
|
|
684
607
|
expect(suggestionSpy).toHaveBeenCalledTimes(2);
|
|
685
|
-
expect(suggestionsWrapper
|
|
686
|
-
expect(suggestions.
|
|
608
|
+
expect(suggestionsWrapper).toBeInTheDocument();
|
|
609
|
+
expect(suggestions.length).toBeGreaterThan(0);
|
|
687
610
|
expect(suggestions).toHaveLength(mockSuggestions2.length);
|
|
688
611
|
});
|
|
689
612
|
|
|
690
613
|
it(`values that already exist are filtered out of suggestions`, async () => {
|
|
691
614
|
const mockTag = 'test-';
|
|
692
615
|
const mockSuggestions: string[] = ['1', '2', '3', '4', '5'];
|
|
693
|
-
const suggestionSpy =
|
|
616
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
694
617
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
695
|
-
const
|
|
618
|
+
const { container } = render(
|
|
696
619
|
<CustomTags
|
|
697
620
|
name={'test-name'}
|
|
698
621
|
value={mockCurrentTags}
|
|
@@ -700,26 +623,24 @@ describe('CustomTags', () => {
|
|
|
700
623
|
/>,
|
|
701
624
|
);
|
|
702
625
|
|
|
703
|
-
|
|
626
|
+
vi.useFakeTimers();
|
|
704
627
|
|
|
705
|
-
const input =
|
|
628
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
706
629
|
|
|
707
630
|
await act(async () => {
|
|
708
|
-
|
|
709
|
-
await input.simulate('change', {
|
|
631
|
+
fireEvent.change(input, {
|
|
710
632
|
target: { value: mockTag },
|
|
711
633
|
});
|
|
712
634
|
});
|
|
713
635
|
|
|
714
|
-
wrapper.update();
|
|
715
|
-
|
|
716
636
|
await act(async () => {
|
|
717
|
-
|
|
637
|
+
vi.runAllTimers();
|
|
718
638
|
});
|
|
719
639
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
640
|
+
const suggestionElements = container.querySelectorAll('li');
|
|
641
|
+
const suggestions = Array.from(suggestionElements).map(
|
|
642
|
+
(node) => node.textContent || '',
|
|
643
|
+
);
|
|
723
644
|
|
|
724
645
|
const expectedSuggestions: string[] = mockSuggestions.filter(
|
|
725
646
|
(item) => !mockCurrentTags.includes(item),
|
|
@@ -731,9 +652,9 @@ describe('CustomTags', () => {
|
|
|
731
652
|
it(`does not render suggestions if 'liveSuggestionsResolver' returns an empty array`, async () => {
|
|
732
653
|
const mockTag = 'test-';
|
|
733
654
|
const mockSuggestions: string[] = [];
|
|
734
|
-
const suggestionSpy =
|
|
655
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
735
656
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
736
|
-
const
|
|
657
|
+
const { container } = render(
|
|
737
658
|
<CustomTags
|
|
738
659
|
name={'test-name'}
|
|
739
660
|
value={mockCurrentTags}
|
|
@@ -741,46 +662,41 @@ describe('CustomTags', () => {
|
|
|
741
662
|
/>,
|
|
742
663
|
);
|
|
743
664
|
|
|
744
|
-
let suggestionsWrapper =
|
|
745
|
-
let suggestions =
|
|
665
|
+
let suggestionsWrapper = container.querySelector('ul');
|
|
666
|
+
let suggestions = container.querySelectorAll('li');
|
|
746
667
|
|
|
747
|
-
expect(suggestionsWrapper
|
|
668
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
748
669
|
expect(suggestions).toHaveLength(0);
|
|
749
670
|
|
|
750
|
-
|
|
671
|
+
vi.useFakeTimers();
|
|
751
672
|
|
|
752
|
-
const input =
|
|
673
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
753
674
|
|
|
754
675
|
await act(async () => {
|
|
755
|
-
|
|
756
|
-
await input.simulate('change', {
|
|
676
|
+
fireEvent.change(input, {
|
|
757
677
|
target: { value: mockTag },
|
|
758
678
|
});
|
|
759
679
|
});
|
|
760
680
|
|
|
761
|
-
wrapper.update();
|
|
762
|
-
|
|
763
681
|
await act(async () => {
|
|
764
|
-
|
|
682
|
+
vi.runAllTimers();
|
|
765
683
|
});
|
|
766
684
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
770
|
-
suggestions = wrapper.find('li');
|
|
685
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
686
|
+
suggestions = container.querySelectorAll('li');
|
|
771
687
|
|
|
772
688
|
expect(suggestionSpy).toHaveBeenCalledTimes(1);
|
|
773
689
|
expect(suggestionSpy).toHaveBeenCalledWith(mockTag);
|
|
774
|
-
expect(suggestionsWrapper
|
|
690
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
775
691
|
expect(suggestions).toHaveLength(0);
|
|
776
692
|
});
|
|
777
693
|
|
|
778
694
|
it(`does not render suggestions if 'input' value is an empty string`, async () => {
|
|
779
695
|
const mockTag = '';
|
|
780
696
|
const mockSuggestions: string[] = ['1', '2', '3', '4', '5'];
|
|
781
|
-
const suggestionSpy =
|
|
697
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
782
698
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
783
|
-
const
|
|
699
|
+
const { container } = render(
|
|
784
700
|
<CustomTags
|
|
785
701
|
name={'test-name'}
|
|
786
702
|
value={mockCurrentTags}
|
|
@@ -788,36 +704,31 @@ describe('CustomTags', () => {
|
|
|
788
704
|
/>,
|
|
789
705
|
);
|
|
790
706
|
|
|
791
|
-
let suggestionsWrapper =
|
|
792
|
-
let suggestions =
|
|
707
|
+
let suggestionsWrapper = container.querySelector('ul');
|
|
708
|
+
let suggestions = container.querySelectorAll('li');
|
|
793
709
|
|
|
794
|
-
expect(suggestionsWrapper
|
|
710
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
795
711
|
expect(suggestions).toHaveLength(0);
|
|
796
712
|
|
|
797
|
-
|
|
713
|
+
vi.useFakeTimers();
|
|
798
714
|
|
|
799
|
-
const input =
|
|
715
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
800
716
|
|
|
801
717
|
await act(async () => {
|
|
802
|
-
|
|
803
|
-
await input.simulate('change', {
|
|
718
|
+
fireEvent.change(input, {
|
|
804
719
|
target: { value: mockTag },
|
|
805
720
|
});
|
|
806
721
|
});
|
|
807
722
|
|
|
808
|
-
wrapper.update();
|
|
809
|
-
|
|
810
723
|
await act(async () => {
|
|
811
|
-
|
|
724
|
+
vi.runAllTimers();
|
|
812
725
|
});
|
|
813
726
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
817
|
-
suggestions = wrapper.find('li');
|
|
727
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
728
|
+
suggestions = container.querySelectorAll('li');
|
|
818
729
|
|
|
819
730
|
expect(suggestionSpy).not.toHaveBeenCalled();
|
|
820
|
-
expect(suggestionsWrapper
|
|
731
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
821
732
|
expect(suggestions).toHaveLength(0);
|
|
822
733
|
});
|
|
823
734
|
|
|
@@ -825,86 +736,71 @@ describe('CustomTags', () => {
|
|
|
825
736
|
const mockTag = 'test-';
|
|
826
737
|
|
|
827
738
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
828
|
-
const
|
|
739
|
+
const { container } = render(
|
|
829
740
|
<CustomTags name={'test-name'} value={mockCurrentTags} />,
|
|
830
741
|
);
|
|
831
742
|
|
|
832
|
-
let suggestionsWrapper =
|
|
833
|
-
let suggestions =
|
|
743
|
+
let suggestionsWrapper = container.querySelector('ul');
|
|
744
|
+
let suggestions = container.querySelectorAll('li');
|
|
834
745
|
|
|
835
|
-
expect(suggestionsWrapper
|
|
746
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
836
747
|
expect(suggestions).toHaveLength(0);
|
|
837
748
|
|
|
838
|
-
|
|
749
|
+
vi.useFakeTimers();
|
|
839
750
|
|
|
840
|
-
const input =
|
|
751
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
841
752
|
|
|
842
753
|
await act(async () => {
|
|
843
|
-
|
|
844
|
-
await input.simulate('change', {
|
|
754
|
+
fireEvent.change(input, {
|
|
845
755
|
target: { value: mockTag },
|
|
846
756
|
});
|
|
847
757
|
});
|
|
848
758
|
|
|
849
|
-
wrapper.update();
|
|
850
|
-
|
|
851
759
|
await act(async () => {
|
|
852
|
-
|
|
760
|
+
vi.runAllTimers();
|
|
853
761
|
});
|
|
854
762
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
suggestionsWrapper = wrapper.find('ul');
|
|
858
|
-
suggestions = wrapper.find('li');
|
|
763
|
+
suggestionsWrapper = container.querySelector('ul');
|
|
764
|
+
suggestions = container.querySelectorAll('li');
|
|
859
765
|
|
|
860
|
-
expect(suggestionsWrapper
|
|
766
|
+
expect(suggestionsWrapper).not.toBeInTheDocument();
|
|
861
767
|
expect(suggestions).toHaveLength(0);
|
|
862
768
|
});
|
|
863
769
|
|
|
864
770
|
it(`adds new tag when suggestion is clicked and sets focus on input`, async () => {
|
|
865
|
-
const onChangespy =
|
|
771
|
+
const onChangespy = vi.fn();
|
|
866
772
|
const mockTag = 'test-';
|
|
867
773
|
const mockSuggestions: string[] = ['test-value', 'test-value2'];
|
|
868
|
-
const suggestionSpy =
|
|
774
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
869
775
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
870
|
-
const
|
|
871
|
-
document.body.appendChild(holder);
|
|
872
|
-
const wrapper = mount(
|
|
776
|
+
const { container } = render(
|
|
873
777
|
<CustomTags
|
|
874
778
|
name={'test-name'}
|
|
875
779
|
onChange={onChangespy}
|
|
876
780
|
value={mockCurrentTags}
|
|
877
781
|
liveSuggestionsResolver={suggestionSpy}
|
|
878
782
|
/>,
|
|
879
|
-
{ attachTo: holder }, // See https://github.com/enzymejs/enzyme/issues/2337#issuecomment-609071803
|
|
880
783
|
);
|
|
881
784
|
|
|
882
|
-
|
|
785
|
+
vi.useFakeTimers();
|
|
883
786
|
|
|
884
|
-
const input =
|
|
787
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
885
788
|
|
|
886
789
|
await act(async () => {
|
|
887
|
-
|
|
888
|
-
await input.simulate('change', {
|
|
790
|
+
fireEvent.change(input, {
|
|
889
791
|
target: { value: mockTag },
|
|
890
792
|
});
|
|
891
793
|
});
|
|
892
794
|
|
|
893
|
-
wrapper.update();
|
|
894
|
-
|
|
895
795
|
await act(async () => {
|
|
896
|
-
|
|
796
|
+
vi.runAllTimers();
|
|
897
797
|
});
|
|
898
798
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
const suggestions = wrapper.find('li');
|
|
902
|
-
|
|
903
|
-
suggestions.first().simulate('mousedown');
|
|
799
|
+
const suggestions = container.querySelectorAll('li');
|
|
904
800
|
|
|
905
|
-
|
|
801
|
+
fireEvent.mouseDown(suggestions[0]);
|
|
906
802
|
|
|
907
|
-
const tags = getTagsFromDOM(
|
|
803
|
+
const tags = getTagsFromDOM(container);
|
|
908
804
|
|
|
909
805
|
const [firstSuggestion] = mockSuggestions;
|
|
910
806
|
|
|
@@ -912,16 +808,15 @@ describe('CustomTags', () => {
|
|
|
912
808
|
expect(suggestionSpy).toHaveBeenCalledTimes(1);
|
|
913
809
|
expect(suggestionSpy).toHaveBeenCalledWith(mockTag);
|
|
914
810
|
expect(onChangespy).toHaveBeenCalledTimes(1);
|
|
915
|
-
expect(document.activeElement).toBe(input
|
|
916
|
-
wrapper.unmount();
|
|
811
|
+
expect(document.activeElement).toBe(input);
|
|
917
812
|
});
|
|
918
813
|
|
|
919
814
|
it(`selects right item when up and down arrows are pressed`, async () => {
|
|
920
815
|
const mockTag = 'test-';
|
|
921
816
|
const mockSuggestions: string[] = ['test-value', 'test-value2'];
|
|
922
|
-
const suggestionSpy =
|
|
817
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
923
818
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
924
|
-
const
|
|
819
|
+
const { container } = render(
|
|
925
820
|
<CustomTags
|
|
926
821
|
name={'test-name'}
|
|
927
822
|
value={mockCurrentTags}
|
|
@@ -929,103 +824,88 @@ describe('CustomTags', () => {
|
|
|
929
824
|
/>,
|
|
930
825
|
);
|
|
931
826
|
|
|
932
|
-
|
|
827
|
+
vi.useFakeTimers();
|
|
933
828
|
|
|
934
|
-
|
|
829
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
935
830
|
|
|
936
831
|
await act(async () => {
|
|
937
|
-
|
|
938
|
-
await input.simulate('change', {
|
|
832
|
+
fireEvent.change(input, {
|
|
939
833
|
target: { value: mockTag },
|
|
940
834
|
});
|
|
941
835
|
});
|
|
942
836
|
|
|
943
|
-
wrapper.update();
|
|
944
|
-
|
|
945
837
|
await act(async () => {
|
|
946
|
-
|
|
838
|
+
vi.runAllTimers();
|
|
947
839
|
});
|
|
948
840
|
|
|
949
|
-
wrapper.update();
|
|
950
|
-
|
|
951
841
|
// select first element in suggestions with down key
|
|
952
|
-
input = wrapper.find('input');
|
|
953
842
|
act(() => {
|
|
954
|
-
|
|
955
|
-
input.prop('onKeyDown')?.({
|
|
843
|
+
fireEvent.keyDown(input, {
|
|
956
844
|
key: 'ArrowDown',
|
|
957
|
-
preventDefault: () => jest.fn(),
|
|
958
845
|
});
|
|
959
846
|
});
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
expect(
|
|
963
|
-
|
|
847
|
+
let suggestions = container.querySelectorAll('li');
|
|
848
|
+
expect(suggestions[0].classList.contains('selected')).toBe(true);
|
|
849
|
+
expect(
|
|
850
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
851
|
+
).toBe(false);
|
|
964
852
|
|
|
965
853
|
// select second element in suggestions with down key
|
|
966
|
-
input = wrapper.find('input');
|
|
967
854
|
act(() => {
|
|
968
|
-
|
|
969
|
-
input.prop('onKeyDown')?.({
|
|
855
|
+
fireEvent.keyDown(input, {
|
|
970
856
|
key: 'ArrowDown',
|
|
971
|
-
preventDefault: () => jest.fn(),
|
|
972
857
|
});
|
|
973
858
|
});
|
|
974
|
-
|
|
975
|
-
suggestions
|
|
976
|
-
expect(
|
|
977
|
-
|
|
859
|
+
suggestions = container.querySelectorAll('li');
|
|
860
|
+
expect(suggestions[0].classList.contains('selected')).toBe(false);
|
|
861
|
+
expect(
|
|
862
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
863
|
+
).toBe(true);
|
|
978
864
|
|
|
979
865
|
// attempt to select third element which doesn't exist and should leave the last element selected
|
|
980
|
-
input = wrapper.find('input');
|
|
981
866
|
act(() => {
|
|
982
|
-
|
|
983
|
-
input.prop('onKeyDown')?.({
|
|
867
|
+
fireEvent.keyDown(input, {
|
|
984
868
|
key: 'ArrowDown',
|
|
985
|
-
preventDefault: () => jest.fn(),
|
|
986
869
|
});
|
|
987
870
|
});
|
|
988
|
-
|
|
989
|
-
suggestions
|
|
990
|
-
expect(
|
|
991
|
-
|
|
871
|
+
suggestions = container.querySelectorAll('li');
|
|
872
|
+
expect(suggestions[0].classList.contains('selected')).toBe(false);
|
|
873
|
+
expect(
|
|
874
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
875
|
+
).toBe(true);
|
|
992
876
|
|
|
993
877
|
// select the first element again with the up key
|
|
994
|
-
input = wrapper.find('input');
|
|
995
878
|
act(() => {
|
|
996
|
-
|
|
997
|
-
input.prop('onKeyDown')?.({
|
|
879
|
+
fireEvent.keyDown(input, {
|
|
998
880
|
key: 'ArrowUp',
|
|
999
|
-
preventDefault: () => jest.fn(),
|
|
1000
881
|
});
|
|
1001
882
|
});
|
|
1002
|
-
|
|
1003
|
-
suggestions
|
|
1004
|
-
expect(
|
|
1005
|
-
|
|
883
|
+
suggestions = container.querySelectorAll('li');
|
|
884
|
+
expect(suggestions[0].classList.contains('selected')).toBe(true);
|
|
885
|
+
expect(
|
|
886
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
887
|
+
).toBe(false);
|
|
1006
888
|
|
|
1007
889
|
// pressing up key again when the first element is selected should deselect all
|
|
1008
|
-
input = wrapper.find('input');
|
|
1009
890
|
act(() => {
|
|
1010
|
-
|
|
1011
|
-
input.prop('onKeyDown')?.({
|
|
891
|
+
fireEvent.keyDown(input, {
|
|
1012
892
|
key: 'ArrowUp',
|
|
1013
|
-
preventDefault: () => jest.fn(),
|
|
1014
893
|
});
|
|
1015
894
|
});
|
|
1016
|
-
|
|
1017
|
-
suggestions
|
|
1018
|
-
expect(
|
|
1019
|
-
|
|
895
|
+
suggestions = container.querySelectorAll('li');
|
|
896
|
+
expect(suggestions[0].classList.contains('selected')).toBe(false);
|
|
897
|
+
expect(
|
|
898
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
899
|
+
).toBe(false);
|
|
1020
900
|
});
|
|
1021
901
|
|
|
1022
902
|
it(`adds item selected via arrow key when the 'Enter' key is pressed`, async () => {
|
|
1023
|
-
const onChangespy =
|
|
903
|
+
const onChangespy = vi.fn();
|
|
1024
904
|
const mockTag = 'test-';
|
|
1025
905
|
const mockSuggestions: string[] = ['test-value', 'test-value2'];
|
|
1026
|
-
const suggestionSpy =
|
|
906
|
+
const suggestionSpy = vi.fn().mockResolvedValue(mockSuggestions);
|
|
1027
907
|
const mockCurrentTags: string[] = ['1', '2', '3'];
|
|
1028
|
-
const
|
|
908
|
+
const { container } = render(
|
|
1029
909
|
<CustomTags
|
|
1030
910
|
name={'test-name'}
|
|
1031
911
|
value={mockCurrentTags}
|
|
@@ -1034,69 +914,60 @@ describe('CustomTags', () => {
|
|
|
1034
914
|
/>,
|
|
1035
915
|
);
|
|
1036
916
|
|
|
1037
|
-
let tags = getTagsFromDOM(
|
|
917
|
+
let tags = getTagsFromDOM(container);
|
|
1038
918
|
|
|
1039
919
|
expect(tags).toHaveLength(3);
|
|
1040
920
|
|
|
1041
|
-
|
|
921
|
+
vi.useFakeTimers();
|
|
1042
922
|
|
|
1043
|
-
|
|
923
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
1044
924
|
|
|
1045
925
|
await act(async () => {
|
|
1046
|
-
|
|
1047
|
-
await input.simulate('change', {
|
|
926
|
+
fireEvent.change(input, {
|
|
1048
927
|
target: { value: mockTag },
|
|
1049
928
|
});
|
|
1050
929
|
});
|
|
1051
930
|
|
|
1052
|
-
wrapper.update();
|
|
1053
|
-
|
|
1054
931
|
await act(async () => {
|
|
1055
|
-
|
|
932
|
+
vi.runAllTimers();
|
|
1056
933
|
});
|
|
1057
934
|
|
|
1058
|
-
wrapper.update();
|
|
1059
|
-
|
|
1060
935
|
// select first element
|
|
1061
|
-
input = wrapper.find('input');
|
|
1062
936
|
act(() => {
|
|
1063
|
-
|
|
1064
|
-
input.prop('onKeyDown')?.({
|
|
937
|
+
fireEvent.keyDown(input, {
|
|
1065
938
|
key: 'ArrowDown',
|
|
1066
|
-
preventDefault: () => jest.fn(),
|
|
1067
939
|
});
|
|
1068
940
|
});
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
expect(
|
|
1072
|
-
|
|
941
|
+
const suggestions = container.querySelectorAll('li');
|
|
942
|
+
expect(suggestions[0].classList.contains('selected')).toBe(true);
|
|
943
|
+
expect(
|
|
944
|
+
suggestions[suggestions.length - 1].classList.contains('selected'),
|
|
945
|
+
).toBe(false);
|
|
1073
946
|
|
|
1074
947
|
// enter key pressed
|
|
1075
|
-
input = wrapper.find('input');
|
|
1076
948
|
await act(async () => {
|
|
1077
|
-
|
|
949
|
+
fireEvent.keyDown(input, {
|
|
1078
950
|
key: 'Enter',
|
|
1079
|
-
//@ts-expect-error we're not sending a full KeyboardEvent
|
|
1080
|
-
currentTarget: { value: mockTag },
|
|
1081
|
-
persist: () => jest.fn(),
|
|
1082
951
|
});
|
|
1083
|
-
|
|
1084
|
-
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
await waitFor(() => {
|
|
955
|
+
tags = getTagsFromDOM(container);
|
|
956
|
+
expect(tags).toHaveLength(4);
|
|
1085
957
|
});
|
|
1086
958
|
|
|
1087
959
|
const [firstSuggestion] = mockSuggestions;
|
|
1088
960
|
|
|
1089
961
|
expect(tags).toEqual([...mockCurrentTags, firstSuggestion]);
|
|
1090
|
-
expect(tags).toHaveLength(4);
|
|
1091
962
|
expect(onChangespy).toHaveBeenCalledTimes(1);
|
|
1092
963
|
});
|
|
1093
964
|
});
|
|
1094
965
|
|
|
1095
966
|
it('manages tags sorted', async () => {
|
|
1096
|
-
const onChangeSpy =
|
|
967
|
+
const onChangeSpy = vi.fn();
|
|
1097
968
|
const mockCurrentTags = ['4', '2', '1'];
|
|
1098
969
|
const mockTag = '3';
|
|
1099
|
-
const
|
|
970
|
+
const { container } = render(
|
|
1100
971
|
<CustomTags
|
|
1101
972
|
name={'test-name'}
|
|
1102
973
|
onChange={onChangeSpy}
|
|
@@ -1104,30 +975,25 @@ describe('CustomTags', () => {
|
|
|
1104
975
|
/>,
|
|
1105
976
|
);
|
|
1106
977
|
|
|
1107
|
-
let tags = getTagsFromDOM(
|
|
978
|
+
let tags = getTagsFromDOM(container);
|
|
1108
979
|
|
|
1109
980
|
expect(tags).toHaveLength(3);
|
|
1110
981
|
|
|
1111
|
-
const input =
|
|
982
|
+
const input = container.querySelector('input') as HTMLInputElement;
|
|
1112
983
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
input.simulate('change');
|
|
1117
|
-
wrapper.update();
|
|
984
|
+
fireEvent.change(input, {
|
|
985
|
+
target: { value: mockTag },
|
|
986
|
+
});
|
|
1118
987
|
|
|
1119
|
-
const plusButton =
|
|
1120
|
-
.
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
})
|
|
1124
|
-
.first();
|
|
1125
|
-
plusButton.simulate('click');
|
|
988
|
+
const plusButton = container.querySelector(
|
|
989
|
+
'.plusButton',
|
|
990
|
+
) as HTMLButtonElement;
|
|
991
|
+
fireEvent.click(plusButton);
|
|
1126
992
|
|
|
1127
|
-
tags = getTagsFromDOM(
|
|
993
|
+
tags = getTagsFromDOM(container);
|
|
1128
994
|
expect(tags).toEqual(['1', '2', '3', '4']);
|
|
1129
995
|
expect(tags).toHaveLength(4);
|
|
1130
996
|
expect(onChangeSpy).toHaveBeenCalledTimes(1);
|
|
1131
|
-
expect(input.
|
|
997
|
+
expect(input.value).toBe('');
|
|
1132
998
|
});
|
|
1133
999
|
});
|