@onewelcome/react-lib-components 6.0.0 → 6.2.0
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/cjs/.scope.d.ts +2 -0
- package/dist/cjs/Button/Button.module.cjs.js +1 -1
- package/dist/cjs/Button/IconButton.module.cjs.js +1 -1
- package/dist/cjs/ContextMenu/ContextMenu.cjs.js +1 -1
- package/dist/cjs/ContextMenu/ContextMenu.cjs.js.map +1 -1
- package/dist/cjs/ContextMenu/ContextMenuItem.module.cjs.js +1 -1
- package/dist/cjs/ContextMenu/ContextMenuService.cjs.js +1 -1
- package/dist/cjs/ContextMenu/ContextMenuService.cjs.js.map +1 -1
- package/dist/cjs/DataGrid/DataGridActions/DataGridColumnsToggle.module.cjs.js +1 -1
- package/dist/cjs/Form/Fieldset/Fieldset.cjs.js +1 -1
- package/dist/cjs/Form/Fieldset/Fieldset.cjs.js.map +1 -1
- package/dist/cjs/Form/Input/Input.module.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.module.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.module.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.module.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.module.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.module.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.module.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/SelectService.cjs.js +1 -1
- package/dist/cjs/Form/Select/SelectService.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js +2 -0
- package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js +2 -0
- package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/SingleSelect/Select.module.cjs.js +2 -0
- package/dist/cjs/Form/Select/useAddNewBtn.cjs.js +2 -0
- package/dist/cjs/Form/Select/useAddNewBtn.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/useAddNewBtn.module.cjs.js +2 -0
- package/dist/cjs/Form/Select/useAddNewBtn.module.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/useSearch.cjs.js +2 -0
- package/dist/cjs/Form/Select/useSearch.cjs.js.map +1 -0
- package/dist/cjs/Form/Textarea/Textarea.module.cjs.js +1 -1
- package/dist/cjs/Form/Wrapper/InputWrapper/InputWrapper.module.cjs.js +1 -1
- package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js +1 -1
- package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js.map +1 -1
- package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.module.cjs.js +1 -1
- package/dist/cjs/Form/Wrapper/Wrapper/Wrapper.module.cjs.js +1 -1
- package/dist/cjs/Icon/Icon.cjs.js +1 -1
- package/dist/cjs/Icon/Icon.cjs.js.map +1 -1
- package/dist/cjs/Icon/Icon.module.cjs.js +1 -1
- package/dist/cjs/Link/Link.module.cjs.js +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModal.module.cjs.js +1 -1
- package/dist/cjs/Notifications/SlideInModal/SlideInModal.module.cjs.js +1 -1
- package/dist/cjs/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.cjs.js +1 -1
- package/dist/cjs/Pagination/Pagination.cjs.js +1 -1
- package/dist/cjs/Pagination/Pagination.cjs.js.map +1 -1
- package/dist/cjs/Popover/Popover.cjs.js +1 -1
- package/dist/cjs/Popover/Popover.cjs.js.map +1 -1
- package/dist/cjs/Popover/Popover.module.cjs.js +1 -1
- package/dist/cjs/Stepper/Step.cjs.js +1 -1
- package/dist/cjs/Stepper/Step.cjs.js.map +1 -1
- package/dist/cjs/Stepper/Step.module.cjs.js +1 -1
- package/dist/cjs/Stepper/Stepper.cjs.js +1 -1
- package/dist/cjs/Stepper/Stepper.cjs.js.map +1 -1
- package/dist/cjs/Tabs/TabButton.module.cjs.js +1 -1
- package/dist/cjs/Tag/RemoveButton.cjs.js +2 -0
- package/dist/cjs/Tag/RemoveButton.cjs.js.map +1 -0
- package/dist/cjs/Tag/RemoveButton.module.cjs.js +2 -0
- package/dist/cjs/Tag/RemoveButton.module.cjs.js.map +1 -0
- package/dist/cjs/Tag/Tag.cjs.js +1 -1
- package/dist/cjs/Tag/Tag.cjs.js.map +1 -1
- package/dist/cjs/Tag/Tag.module.cjs.js +1 -1
- package/dist/cjs/TextEllipsis/TextEllipsis.module.cjs.js +1 -1
- package/dist/cjs/Tiles/Tile.module.cjs.js +1 -1
- package/dist/cjs/Tooltip/Tooltip.module.cjs.js +1 -1
- package/dist/cjs/Wizard/BaseWizardSteps/BaseWizardSteps.module.cjs.js +1 -1
- package/dist/cjs/src/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/cjs/src/components/ContextMenu/ContextMenuService.d.ts +4 -1
- package/dist/cjs/src/components/Form/Select/MultiSelect/MultiOption.d.ts +6 -0
- package/dist/cjs/src/components/Form/Select/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/cjs/src/components/Form/Select/MultiSelect/SelectButton.d.ts +4 -0
- package/dist/cjs/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +11 -0
- package/dist/cjs/src/components/Form/Select/Select.interfaces.d.ts +47 -1
- package/dist/cjs/src/components/Form/Select/SelectService.d.ts +8 -3
- package/dist/cjs/src/components/Form/Select/{Option.d.ts → SingleSelect/Option.d.ts} +1 -0
- package/dist/cjs/src/components/Form/Select/SingleSelect/Select.d.ts +3 -0
- package/dist/cjs/src/components/Form/Select/SingleSelect/Select.test.d.ts +63 -0
- package/dist/cjs/src/components/Form/Select/useAddNewBtn.d.ts +12 -0
- package/dist/cjs/src/components/Form/Select/useSearch.d.ts +29 -0
- package/dist/cjs/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.d.ts +16 -0
- package/dist/cjs/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +2 -2
- package/dist/cjs/src/components/Icon/Icon.d.ts +1 -0
- package/dist/cjs/src/components/Stepper/Stepper.d.ts +0 -1
- package/dist/cjs/src/components/Tag/RemoveButton.d.ts +7 -0
- package/dist/cjs/src/components/Tag/Tag.d.ts +3 -0
- package/dist/cjs/src/hooks/usePosition.cjs.js.map +1 -1
- package/dist/cjs/src/hooks/usePosition.d.ts +1 -1
- package/dist/cjs/src/index.cjs.js +1 -1
- package/dist/cjs/src/index.d.ts +7 -4
- package/dist/esm/.scope.d.ts +2 -0
- package/dist/esm/Button/Button.module.esm.js +1 -1
- package/dist/esm/Button/IconButton.module.esm.js +1 -1
- package/dist/esm/ContextMenu/ContextMenu.esm.js +1 -1
- package/dist/esm/ContextMenu/ContextMenu.esm.js.map +1 -1
- package/dist/esm/ContextMenu/ContextMenuItem.module.esm.js +1 -1
- package/dist/esm/ContextMenu/ContextMenuService.esm.js +1 -1
- package/dist/esm/ContextMenu/ContextMenuService.esm.js.map +1 -1
- package/dist/esm/DataGrid/DataGridActions/DataGridColumnsToggle.module.esm.js +1 -1
- package/dist/esm/Form/Fieldset/Fieldset.esm.js +1 -1
- package/dist/esm/Form/Fieldset/Fieldset.esm.js.map +1 -1
- package/dist/esm/Form/Input/Input.module.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.module.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.module.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/SelectButton.module.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/SelectButton.module.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.module.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.module.esm.js.map +1 -0
- package/dist/esm/Form/Select/SelectService.esm.js +1 -1
- package/dist/esm/Form/Select/SelectService.esm.js.map +1 -1
- package/dist/esm/Form/Select/SingleSelect/Option.esm.js +2 -0
- package/dist/esm/Form/Select/SingleSelect/Option.esm.js.map +1 -0
- package/dist/esm/Form/Select/SingleSelect/Select.esm.js +2 -0
- package/dist/esm/Form/Select/SingleSelect/Select.esm.js.map +1 -0
- package/dist/esm/Form/Select/SingleSelect/Select.module.esm.js +2 -0
- package/dist/esm/Form/Select/useAddNewBtn.esm.js +2 -0
- package/dist/esm/Form/Select/useAddNewBtn.esm.js.map +1 -0
- package/dist/esm/Form/Select/useAddNewBtn.module.esm.js +2 -0
- package/dist/esm/Form/Select/useAddNewBtn.module.esm.js.map +1 -0
- package/dist/esm/Form/Select/useSearch.esm.js +2 -0
- package/dist/esm/Form/Select/useSearch.esm.js.map +1 -0
- package/dist/esm/Form/Textarea/Textarea.module.esm.js +1 -1
- package/dist/esm/Form/Wrapper/InputWrapper/InputWrapper.module.esm.js +1 -1
- package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.esm.js +1 -1
- package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.esm.js.map +1 -1
- package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.module.esm.js +1 -1
- package/dist/esm/Form/Wrapper/Wrapper/Wrapper.module.esm.js +1 -1
- package/dist/esm/Icon/Icon.esm.js +1 -1
- package/dist/esm/Icon/Icon.esm.js.map +1 -1
- package/dist/esm/Icon/Icon.module.esm.js +1 -1
- package/dist/esm/Link/Link.module.esm.js +1 -1
- package/dist/esm/Notifications/BaseModal/BaseModal.module.esm.js +1 -1
- package/dist/esm/Notifications/SlideInModal/SlideInModal.module.esm.js +1 -1
- package/dist/esm/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.esm.js +1 -1
- package/dist/esm/Pagination/Pagination.esm.js +1 -1
- package/dist/esm/Pagination/Pagination.esm.js.map +1 -1
- package/dist/esm/Popover/Popover.esm.js +1 -1
- package/dist/esm/Popover/Popover.esm.js.map +1 -1
- package/dist/esm/Popover/Popover.module.esm.js +1 -1
- package/dist/esm/Stepper/Step.esm.js +1 -1
- package/dist/esm/Stepper/Step.esm.js.map +1 -1
- package/dist/esm/Stepper/Step.module.esm.js +1 -1
- package/dist/esm/Stepper/Stepper.esm.js +1 -1
- package/dist/esm/Stepper/Stepper.esm.js.map +1 -1
- package/dist/esm/Tabs/TabButton.module.esm.js +1 -1
- package/dist/esm/Tag/RemoveButton.esm.js +2 -0
- package/dist/esm/Tag/RemoveButton.esm.js.map +1 -0
- package/dist/esm/Tag/RemoveButton.module.esm.js +2 -0
- package/dist/esm/Tag/RemoveButton.module.esm.js.map +1 -0
- package/dist/esm/Tag/Tag.esm.js +1 -1
- package/dist/esm/Tag/Tag.esm.js.map +1 -1
- package/dist/esm/Tag/Tag.module.esm.js +1 -1
- package/dist/esm/TextEllipsis/TextEllipsis.module.esm.js +1 -1
- package/dist/esm/Tiles/Tile.module.esm.js +1 -1
- package/dist/esm/Tooltip/Tooltip.module.esm.js +1 -1
- package/dist/esm/Wizard/BaseWizardSteps/BaseWizardSteps.module.esm.js +1 -1
- package/dist/esm/src/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/esm/src/components/ContextMenu/ContextMenuService.d.ts +4 -1
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiOption.d.ts +6 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/SelectButton.d.ts +4 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +11 -0
- package/dist/esm/src/components/Form/Select/Select.interfaces.d.ts +47 -1
- package/dist/esm/src/components/Form/Select/SelectService.d.ts +8 -3
- package/dist/esm/src/components/Form/Select/{Option.d.ts → SingleSelect/Option.d.ts} +1 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/Option.test.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/Select.d.ts +3 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/Select.test.d.ts +63 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/SelectKeyboardNavigation.test.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/useAddNewBtn.d.ts +12 -0
- package/dist/esm/src/components/Form/Select/useSearch.d.ts +29 -0
- package/dist/esm/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.d.ts +16 -0
- package/dist/esm/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.test.d.ts +1 -0
- package/dist/esm/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +2 -2
- package/dist/esm/src/components/Icon/Icon.d.ts +1 -0
- package/dist/esm/src/components/Stepper/Stepper.d.ts +0 -1
- package/dist/esm/src/components/Tag/RemoveButton.d.ts +7 -0
- package/dist/esm/src/components/Tag/Tag.d.ts +3 -0
- package/dist/esm/src/hooks/usePosition.d.ts +1 -1
- package/dist/esm/src/hooks/usePosition.esm.js.map +1 -1
- package/dist/esm/src/index.d.ts +7 -4
- package/dist/esm/src/index.esm.js +1 -1
- package/package.json +49 -46
- package/src/components/ContextMenu/ContextMenu.tsx +13 -23
- package/src/components/ContextMenu/ContextMenuService.ts +47 -1
- package/src/components/Form/Fieldset/Fieldset.tsx +3 -1
- package/src/{hooks/useWrapper.test.ts → components/Form/Select/MultiSelect/MultiOption.tsx} +13 -10
- package/src/components/Form/Select/{Select.module.scss → MultiSelect/MultiSelect.module.scss} +19 -20
- package/src/components/Form/Select/MultiSelect/MultiSelect.tsx +363 -0
- package/src/components/Form/Select/MultiSelect/SelectButton.module.scss +27 -0
- package/src/components/Form/Select/MultiSelect/SelectButton.tsx +37 -0
- package/src/components/Form/Select/MultiSelect/SelectedOptions.module.scss +31 -0
- package/src/components/Form/Select/MultiSelect/SelectedOptions.tsx +67 -0
- package/src/components/Form/Select/Select.interfaces.ts +51 -1
- package/src/components/Form/Select/SelectService.ts +46 -13
- package/src/components/Form/Select/{Option.tsx → SingleSelect/Option.tsx} +3 -1
- package/src/components/Form/Select/SingleSelect/Select.module.scss +232 -0
- package/src/components/Form/Select/{Select.tsx → SingleSelect/Select.tsx} +56 -87
- package/src/components/Form/Select/useAddNewBtn.module.scss +51 -0
- package/src/components/Form/Select/useAddNewBtn.tsx +54 -0
- package/src/components/Form/Select/useSearch.tsx +124 -0
- package/src/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss +0 -10
- package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss +27 -0
- package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.tsx +84 -0
- package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss +0 -4
- package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +3 -2
- package/src/components/Form/Wrapper/Wrapper/Wrapper.module.scss +0 -6
- package/src/components/Icon/Icon.module.scss +5 -0
- package/src/components/Icon/Icon.tsx +1 -0
- package/src/components/Link/Link.module.scss +16 -0
- package/src/components/Pagination/Pagination.tsx +2 -2
- package/src/components/Popover/Popover.tsx +19 -2
- package/src/components/Stepper/Step.tsx +2 -1
- package/src/components/Stepper/Stepper.tsx +0 -2
- package/src/{hooks/useScroll.test.tsx → components/Tag/RemoveButton.module.scss} +22 -17
- package/src/components/Tag/RemoveButton.tsx +52 -0
- package/src/components/Tag/Tag.module.scss +23 -2
- package/src/components/Tag/Tag.tsx +21 -11
- package/src/components/Tooltip/Tooltip.module.scss +1 -0
- package/src/font/icomoon.eot +0 -0
- package/src/font/icomoon.svg +1 -0
- package/src/font/icomoon.ttf +0 -0
- package/src/font/icomoon.woff +0 -0
- package/src/font/selection.json +1 -1
- package/src/hooks/usePosition.ts +1 -1
- package/src/index.ts +11 -4
- package/src/interfaces.ts +2 -2
- package/src/mixins.module.scss +2 -4
- package/dist/cjs/Form/Select/Option.cjs.js +0 -2
- package/dist/cjs/Form/Select/Option.cjs.js.map +0 -1
- package/dist/cjs/Form/Select/Select.cjs.js +0 -2
- package/dist/cjs/Form/Select/Select.cjs.js.map +0 -1
- package/dist/cjs/Form/Select/Select.module.cjs.js +0 -2
- package/dist/cjs/src/components/Form/Select/Select.d.ts +0 -23
- package/dist/esm/Form/Select/Option.esm.js +0 -2
- package/dist/esm/Form/Select/Option.esm.js.map +0 -1
- package/dist/esm/Form/Select/Select.esm.js +0 -2
- package/dist/esm/Form/Select/Select.esm.js.map +0 -1
- package/dist/esm/Form/Select/Select.module.esm.js +0 -2
- package/dist/esm/src/components/Form/Select/Select.d.ts +0 -23
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -64
- package/src/components/Button/BaseButton.test.tsx +0 -133
- package/src/components/Button/Button.test.tsx +0 -150
- package/src/components/Button/IconButton.test.tsx +0 -106
- package/src/components/ContextMenu/ContextMenu.test.tsx +0 -358
- package/src/components/DataGrid/DataGrid.test.tsx +0 -437
- package/src/components/DataGrid/DataGridActions/DataGridActions.test.tsx +0 -204
- package/src/components/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +0 -99
- package/src/components/DataGrid/DataGridBody/DataGridBody.test.tsx +0 -140
- package/src/components/DataGrid/DataGridBody/DataGridCell.test.tsx +0 -90
- package/src/components/DataGrid/DataGridBody/DataGridRow.test.tsx +0 -117
- package/src/components/DataGrid/DataGridHeader/DataGridHeader.test.tsx +0 -276
- package/src/components/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +0 -144
- package/src/components/Form/Checkbox/Checkbox.test.tsx +0 -308
- package/src/components/Form/Fieldset/Fieldset.test.tsx +0 -127
- package/src/components/Form/FileUpload/FileItem/FileItem.test.tsx +0 -103
- package/src/components/Form/FileUpload/FileUpload.test.tsx +0 -374
- package/src/components/Form/Form.test.tsx +0 -63
- package/src/components/Form/FormControl/FormControl.test.tsx +0 -98
- package/src/components/Form/FormGroup/FormGroup.test.tsx +0 -127
- package/src/components/Form/FormHelperText/FormHelperText.test.tsx +0 -84
- package/src/components/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +0 -94
- package/src/components/Form/Input/Input.test.tsx +0 -267
- package/src/components/Form/Label/Label.test.tsx +0 -68
- package/src/components/Form/Radio/Radio.test.tsx +0 -130
- package/src/components/Form/Select/Option.test.tsx +0 -57
- package/src/components/Form/Select/Select.test.tsx +0 -564
- package/src/components/Form/Textarea/Textarea.test.tsx +0 -124
- package/src/components/Form/Toggle/Toggle.test.tsx +0 -200
- package/src/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +0 -141
- package/src/components/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +0 -211
- package/src/components/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +0 -117
- package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +0 -186
- package/src/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +0 -173
- package/src/components/Form/Wrapper/Wrapper/Wrapper.test.tsx +0 -59
- package/src/components/Icon/Icon.test.tsx +0 -83
- package/src/components/Link/Link.test.tsx +0 -203
- package/src/components/Notifications/Banner/Banner.test.tsx +0 -84
- package/src/components/Notifications/BaseModal/BaseModal.test.tsx +0 -194
- package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +0 -74
- package/src/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +0 -71
- package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +0 -74
- package/src/components/Notifications/Dialog/Dialog.test.tsx +0 -118
- package/src/components/Notifications/Dialog/DialogActions/DialogActions.test.tsx +0 -61
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +0 -87
- package/src/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +0 -111
- package/src/components/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +0 -175
- package/src/components/Notifications/Modal/Modal.test.tsx +0 -18
- package/src/components/Notifications/NotificationProvider/NotificationContext.test.tsx +0 -449
- package/src/components/Notifications/SlideInModal/SlideInModal.test.tsx +0 -90
- package/src/components/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +0 -53
- package/src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +0 -77
- package/src/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +0 -219
- package/src/components/Notifications/Snackbar/useSnackbar.test.tsx +0 -136
- package/src/components/Pagination/Pagination.test.tsx +0 -183
- package/src/components/Popover/Popover.test.tsx +0 -103
- package/src/components/ProgressBar/ProgressBar.test.tsx +0 -91
- package/src/components/Skeleton/Skeleton.test.tsx +0 -112
- package/src/components/StatusIndicator/StatusIndicator.test.tsx +0 -143
- package/src/components/Stepper/Stepper.test.tsx +0 -83
- package/src/components/Tabs/Tab.test.tsx +0 -49
- package/src/components/Tabs/TabButton.test.tsx +0 -65
- package/src/components/Tabs/Tabs.test.tsx +0 -291
- package/src/components/Tag/Tag.test.tsx +0 -89
- package/src/components/TextEllipsis/TextEllipsis.test.tsx +0 -96
- package/src/components/Tiles/Tile.test.tsx +0 -183
- package/src/components/Tiles/Tiles.test.tsx +0 -162
- package/src/components/Tooltip/Tooltip.test.tsx +0 -390
- package/src/components/Typography/Typography.test.tsx +0 -177
- package/src/components/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +0 -90
- package/src/components/Wizard/Wizard.test.tsx +0 -218
- package/src/components/Wizard/WizardActions/WizardActions.test.tsx +0 -187
- package/src/components/Wizard/WizardSteps/WizardSteps.test.tsx +0 -125
- package/src/components/_BaseStyling_/BaseStyling.test.tsx +0 -55
- package/src/hooks/useAnimation.test.tsx +0 -65
- package/src/hooks/useBodyClick.test.tsx +0 -55
- package/src/hooks/useDebouncedCallback.test.ts +0 -150
- package/src/hooks/useDetermineStatusIcon.test.ts +0 -28
- package/src/hooks/useFormSelector.test.ts +0 -56
- package/src/hooks/usePosition.test.tsx +0 -510
- package/src/hooks/useRepeater.test.tsx +0 -156
- package/src/hooks/useSpacing.test.ts +0 -86
- package/src/hooks/useUploadFile.test.ts +0 -211
- package/src/util/helper.test.tsx +0 -403
- /package/dist/cjs/Form/Select/{Select.module.cjs.js.map → SingleSelect/Select.module.cjs.js.map} +0 -0
- /package/dist/cjs/src/components/Form/Select/{Option.test.d.ts → MultiSelect/MultiSelect.test.d.ts} +0 -0
- /package/dist/{esm/src/components/Form/Select → cjs/src/components/Form/Select/SingleSelect}/Option.test.d.ts +0 -0
- /package/dist/cjs/src/components/Form/Select/{Select.test.d.ts → SingleSelect/SelectKeyboardNavigation.test.d.ts} +0 -0
- /package/dist/{esm/src/components/Form/Select/Select.test.d.ts → cjs/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.test.d.ts} +0 -0
- /package/dist/esm/Form/Select/{Select.module.esm.js.map → SingleSelect/Select.module.esm.js.map} +0 -0
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 OneWelcome B.V.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import React, { useEffect, useState } from "react";
|
|
18
|
-
import { getByTestId, render, renderHook, waitFor } from "@testing-library/react";
|
|
19
|
-
import { NotificationProvider, useNotificationContext } from "./NotificationContext";
|
|
20
|
-
import { Translations } from "./notification.interfaces";
|
|
21
|
-
import { act } from "react-dom/test-utils";
|
|
22
|
-
import { SnackbarProvider } from "../Snackbar/SnackbarProvider/SnackbarProvider";
|
|
23
|
-
import userEvent from "@testing-library/user-event";
|
|
24
|
-
import * as useSnackbarModule from "../Snackbar/useSnackbar";
|
|
25
|
-
|
|
26
|
-
jest.mock("../../../util/helper", () => ({
|
|
27
|
-
generateID: () => "test-id",
|
|
28
|
-
deepMerge: (defaultTranslations: Translations, translations: Translations) => ({
|
|
29
|
-
...defaultTranslations,
|
|
30
|
-
...translations
|
|
31
|
-
})
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
const renderSnackbarProvider = () => {
|
|
35
|
-
const AppComponent = () => {
|
|
36
|
-
const { addNotification } = useNotificationContext();
|
|
37
|
-
const [index, setIndex] = useState(0);
|
|
38
|
-
return (
|
|
39
|
-
<div>
|
|
40
|
-
content
|
|
41
|
-
<button
|
|
42
|
-
data-testid="show-success"
|
|
43
|
-
onClick={() => {
|
|
44
|
-
addNotification({
|
|
45
|
-
status: 200,
|
|
46
|
-
type: "success",
|
|
47
|
-
title: "Test Success",
|
|
48
|
-
message: "Test successful request"
|
|
49
|
-
});
|
|
50
|
-
setIndex(index + 1);
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
Success
|
|
54
|
-
</button>
|
|
55
|
-
<button
|
|
56
|
-
data-testid="show-error"
|
|
57
|
-
onClick={() => {
|
|
58
|
-
addNotification({
|
|
59
|
-
status: 400,
|
|
60
|
-
type: "error",
|
|
61
|
-
title: "TestError",
|
|
62
|
-
message: "Test bad request"
|
|
63
|
-
});
|
|
64
|
-
setIndex(index + 1);
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
Error
|
|
68
|
-
</button>
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const queries = render(
|
|
74
|
-
<SnackbarProvider closeButtonTitle="close">
|
|
75
|
-
<NotificationProvider>
|
|
76
|
-
<AppComponent />
|
|
77
|
-
</NotificationProvider>
|
|
78
|
-
</SnackbarProvider>
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const showSuccessSnackbarBtn = getByTestId(queries.container, "show-success");
|
|
82
|
-
const showErrorSnackbarBtn = getByTestId(queries.container, "show-error");
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
...queries,
|
|
86
|
-
showSuccessSnackbarBtn,
|
|
87
|
-
showErrorSnackbarBtn
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
describe("Actually shows the snackbars showing up", () => {
|
|
92
|
-
it("Shows the snackbars", async () => {
|
|
93
|
-
const { showSuccessSnackbarBtn, showErrorSnackbarBtn, getByText } = renderSnackbarProvider();
|
|
94
|
-
|
|
95
|
-
await userEvent.click(showSuccessSnackbarBtn);
|
|
96
|
-
await userEvent.click(showErrorSnackbarBtn);
|
|
97
|
-
|
|
98
|
-
await waitFor(() => expect(getByText("Test Success")).toBeInTheDocument());
|
|
99
|
-
await waitFor(() => expect(getByText("Test bad request")).toBeInTheDocument());
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe("Notification", () => {
|
|
104
|
-
describe("useNotificationContext", () => {
|
|
105
|
-
it("returns the correct context", () => {
|
|
106
|
-
const { result } = renderHook(() => useNotificationContext(), {
|
|
107
|
-
wrapper: NotificationProvider
|
|
108
|
-
});
|
|
109
|
-
expect(result.current).toEqual({
|
|
110
|
-
addNotification: expect.any(Function),
|
|
111
|
-
removeNotification: expect.any(Function),
|
|
112
|
-
resetNotifications: expect.any(Function),
|
|
113
|
-
state: {
|
|
114
|
-
notifications: []
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe("Adding and using the notification functions", () => {
|
|
121
|
-
it("Fires the addNotification and removeNotification function", async () => {
|
|
122
|
-
const { result } = renderHook(() => useNotificationContext(), {
|
|
123
|
-
wrapper: NotificationProvider
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
expect(result.current.state.notifications).toEqual([]);
|
|
127
|
-
|
|
128
|
-
await act(() => {
|
|
129
|
-
result.current.addNotification({
|
|
130
|
-
type: "error",
|
|
131
|
-
status: 401,
|
|
132
|
-
message: "Test Error"
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
expect(result.current.state.notifications).toEqual([
|
|
137
|
-
{
|
|
138
|
-
id: "test-id",
|
|
139
|
-
type: "error",
|
|
140
|
-
status: 401,
|
|
141
|
-
message: "Test Error",
|
|
142
|
-
handled: true
|
|
143
|
-
}
|
|
144
|
-
]);
|
|
145
|
-
|
|
146
|
-
await act(() => {
|
|
147
|
-
result.current.removeNotification("test-id");
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
expect(result.current.state.notifications).toEqual([]);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it("Fires the resetNotifications function", async () => {
|
|
154
|
-
const { result } = renderHook(() => useNotificationContext(), {
|
|
155
|
-
wrapper: NotificationProvider
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
expect(result.current.state.notifications).toEqual([]);
|
|
159
|
-
|
|
160
|
-
await act(() => {
|
|
161
|
-
result.current.addNotification({
|
|
162
|
-
type: "error",
|
|
163
|
-
status: 401,
|
|
164
|
-
message: "Test Error"
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
expect(result.current.state.notifications).toEqual([
|
|
169
|
-
{
|
|
170
|
-
id: "test-id",
|
|
171
|
-
type: "error",
|
|
172
|
-
status: 401,
|
|
173
|
-
message: "Test Error",
|
|
174
|
-
handled: true
|
|
175
|
-
}
|
|
176
|
-
]);
|
|
177
|
-
|
|
178
|
-
await act(() => {
|
|
179
|
-
result.current.resetNotifications();
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
expect(result.current.state.notifications).toEqual([]);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
describe("Translations", () => {
|
|
187
|
-
it("Translates the status 400, 401 and 403 translations", async () => {
|
|
188
|
-
const enqueueErrorSnackbarMock = jest.fn();
|
|
189
|
-
|
|
190
|
-
jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
|
|
191
|
-
enqueueWarningSnackbar: jest.fn(),
|
|
192
|
-
enqueueErrorSnackbar: enqueueErrorSnackbarMock,
|
|
193
|
-
enqueueSuccessSnackbar: jest.fn(),
|
|
194
|
-
enqueueSnackbar: jest.fn()
|
|
195
|
-
}));
|
|
196
|
-
|
|
197
|
-
const providedTranslations = {
|
|
198
|
-
general: { error: "TestError" },
|
|
199
|
-
messages: {
|
|
200
|
-
unauthorized: "Test unauthorized",
|
|
201
|
-
badRequest: "Test bad request",
|
|
202
|
-
forbidden: "Test forbidden"
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const TestComponent = () => {
|
|
207
|
-
const { addNotification, state } = useNotificationContext();
|
|
208
|
-
|
|
209
|
-
useEffect(() => {
|
|
210
|
-
(async () => {
|
|
211
|
-
if (state.notifications.length === 3) {
|
|
212
|
-
await waitFor(() =>
|
|
213
|
-
expect(state.notifications).toEqual([
|
|
214
|
-
{
|
|
215
|
-
id: "test-id",
|
|
216
|
-
type: "error",
|
|
217
|
-
status: 400,
|
|
218
|
-
message: "TestError",
|
|
219
|
-
handled: true
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: "test-id",
|
|
223
|
-
type: "error",
|
|
224
|
-
status: 401,
|
|
225
|
-
message: "TestError",
|
|
226
|
-
handled: true
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
id: "test-id",
|
|
230
|
-
type: "error",
|
|
231
|
-
status: 403,
|
|
232
|
-
message: "TestError",
|
|
233
|
-
handled: true
|
|
234
|
-
}
|
|
235
|
-
])
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
})();
|
|
239
|
-
}, [state.notifications]);
|
|
240
|
-
|
|
241
|
-
useEffect(() => {
|
|
242
|
-
(async () => {
|
|
243
|
-
await act(() => {
|
|
244
|
-
addNotification({ type: "error", status: 400 });
|
|
245
|
-
addNotification({ type: "error", status: 401 });
|
|
246
|
-
addNotification({ type: "error", status: 403 });
|
|
247
|
-
});
|
|
248
|
-
})();
|
|
249
|
-
}, []);
|
|
250
|
-
|
|
251
|
-
return null;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
render(
|
|
255
|
-
<NotificationProvider translations={providedTranslations}>
|
|
256
|
-
<TestComponent />
|
|
257
|
-
</NotificationProvider>
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
await waitFor(() => {
|
|
261
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
|
|
262
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test bad request", {
|
|
263
|
-
onClose: expect.any(Function)
|
|
264
|
-
});
|
|
265
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unauthorized", {
|
|
266
|
-
onClose: expect.any(Function)
|
|
267
|
-
});
|
|
268
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test forbidden", {
|
|
269
|
-
onClose: expect.any(Function)
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it("Translates the status 404, 500 and 502 translations", async () => {
|
|
275
|
-
const enqueueErrorSnackbarMock = jest.fn();
|
|
276
|
-
|
|
277
|
-
jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
|
|
278
|
-
enqueueWarningSnackbar: jest.fn(),
|
|
279
|
-
enqueueErrorSnackbar: enqueueErrorSnackbarMock,
|
|
280
|
-
enqueueSuccessSnackbar: jest.fn(),
|
|
281
|
-
enqueueSnackbar: jest.fn()
|
|
282
|
-
}));
|
|
283
|
-
|
|
284
|
-
const providedTranslations = {
|
|
285
|
-
general: { error: "TestError" },
|
|
286
|
-
messages: {
|
|
287
|
-
notFound: "Test not found",
|
|
288
|
-
general: "Test general",
|
|
289
|
-
unavailable: "Test unavailable"
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
const TestComponent = () => {
|
|
294
|
-
const { addNotification, state } = useNotificationContext();
|
|
295
|
-
|
|
296
|
-
useEffect(() => {
|
|
297
|
-
(async () => {
|
|
298
|
-
if (state.notifications.length === 3) {
|
|
299
|
-
await waitFor(() =>
|
|
300
|
-
expect(state.notifications).toEqual([
|
|
301
|
-
{
|
|
302
|
-
id: "test-id",
|
|
303
|
-
type: "error",
|
|
304
|
-
status: 404,
|
|
305
|
-
message: "TestError",
|
|
306
|
-
handled: true
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
id: "test-id",
|
|
310
|
-
type: "error",
|
|
311
|
-
status: 500,
|
|
312
|
-
message: "TestError",
|
|
313
|
-
handled: true
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
id: "test-id",
|
|
317
|
-
type: "error",
|
|
318
|
-
status: 502,
|
|
319
|
-
message: "TestError",
|
|
320
|
-
handled: true
|
|
321
|
-
}
|
|
322
|
-
])
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
})();
|
|
326
|
-
}, [state.notifications]);
|
|
327
|
-
|
|
328
|
-
useEffect(() => {
|
|
329
|
-
(async () => {
|
|
330
|
-
await act(() => {
|
|
331
|
-
addNotification({ type: "error", status: 404 });
|
|
332
|
-
addNotification({ type: "error", status: 500 });
|
|
333
|
-
addNotification({ type: "error", status: 502 });
|
|
334
|
-
});
|
|
335
|
-
})();
|
|
336
|
-
}, []);
|
|
337
|
-
|
|
338
|
-
return null;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
render(
|
|
342
|
-
<NotificationProvider translations={providedTranslations}>
|
|
343
|
-
<TestComponent />
|
|
344
|
-
</NotificationProvider>
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
await waitFor(() => {
|
|
348
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
|
|
349
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test not found", {
|
|
350
|
-
onClose: expect.any(Function)
|
|
351
|
-
});
|
|
352
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test general", {
|
|
353
|
-
onClose: expect.any(Function)
|
|
354
|
-
});
|
|
355
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unavailable", {
|
|
356
|
-
onClose: expect.any(Function)
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
it("Translates the status 503, 504 and general if the code isn't recognized", async () => {
|
|
362
|
-
const enqueueErrorSnackbarMock = jest.fn();
|
|
363
|
-
|
|
364
|
-
jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
|
|
365
|
-
enqueueWarningSnackbar: jest.fn(),
|
|
366
|
-
enqueueErrorSnackbar: enqueueErrorSnackbarMock,
|
|
367
|
-
enqueueSuccessSnackbar: jest.fn(),
|
|
368
|
-
enqueueSnackbar: jest.fn()
|
|
369
|
-
}));
|
|
370
|
-
|
|
371
|
-
const providedTranslations = {
|
|
372
|
-
general: { error: "TestError" },
|
|
373
|
-
messages: {
|
|
374
|
-
timeout: "Test timeout",
|
|
375
|
-
general: "Test general",
|
|
376
|
-
unavailable: "Test unavailable"
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
const TestComponent = () => {
|
|
381
|
-
const { addNotification, state } = useNotificationContext();
|
|
382
|
-
|
|
383
|
-
useEffect(() => {
|
|
384
|
-
(async () => {
|
|
385
|
-
if (state.notifications.length === 3) {
|
|
386
|
-
await waitFor(() =>
|
|
387
|
-
expect(state.notifications).toEqual([
|
|
388
|
-
{
|
|
389
|
-
id: "test-id",
|
|
390
|
-
type: "error",
|
|
391
|
-
status: 503,
|
|
392
|
-
message: "TestError",
|
|
393
|
-
handled: true
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
id: "test-id",
|
|
397
|
-
type: "error",
|
|
398
|
-
status: 504,
|
|
399
|
-
message: "TestError",
|
|
400
|
-
handled: true
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
id: "test-id",
|
|
404
|
-
type: "error",
|
|
405
|
-
status: 999,
|
|
406
|
-
message: "TestError",
|
|
407
|
-
handled: true
|
|
408
|
-
}
|
|
409
|
-
])
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
})();
|
|
413
|
-
}, [state.notifications]);
|
|
414
|
-
|
|
415
|
-
useEffect(() => {
|
|
416
|
-
(async () => {
|
|
417
|
-
await act(() => {
|
|
418
|
-
addNotification({ type: "error", status: 503 });
|
|
419
|
-
addNotification({ type: "error", status: 504 });
|
|
420
|
-
// @ts-ignore-next-line - We want to test the default case
|
|
421
|
-
addNotification({ type: "error", status: 999 });
|
|
422
|
-
});
|
|
423
|
-
})();
|
|
424
|
-
}, []);
|
|
425
|
-
|
|
426
|
-
return null;
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
render(
|
|
430
|
-
<NotificationProvider translations={providedTranslations}>
|
|
431
|
-
<TestComponent />
|
|
432
|
-
</NotificationProvider>
|
|
433
|
-
);
|
|
434
|
-
|
|
435
|
-
await waitFor(() => {
|
|
436
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
|
|
437
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test timeout", {
|
|
438
|
-
onClose: expect.any(Function)
|
|
439
|
-
});
|
|
440
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test general", {
|
|
441
|
-
onClose: expect.any(Function)
|
|
442
|
-
});
|
|
443
|
-
expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unavailable", {
|
|
444
|
-
onClose: expect.any(Function)
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 OneWelcome B.V.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import React, { useEffect, useRef } from "react";
|
|
18
|
-
import { SlideInModal } from "./SlideInModal";
|
|
19
|
-
import { Props } from "../Modal/Modal";
|
|
20
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
21
|
-
|
|
22
|
-
const defaultParams: Props = {
|
|
23
|
-
id: "",
|
|
24
|
-
children: undefined,
|
|
25
|
-
open: false
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const createSlideInModal = (params?: (defaultParams: Props) => Props) => {
|
|
29
|
-
let parameters: Props = defaultParams;
|
|
30
|
-
if (params) {
|
|
31
|
-
parameters = params(defaultParams);
|
|
32
|
-
}
|
|
33
|
-
const queries = render(<SlideInModal {...parameters} data-testid="SlideInModal" />);
|
|
34
|
-
const slideInModal = queries.getByTestId("SlideInModal");
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
...queries,
|
|
38
|
-
slideInModal
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
describe("SlideInModal should render", () => {
|
|
43
|
-
it("renders without crashing", () => {
|
|
44
|
-
const { slideInModal } = createSlideInModal();
|
|
45
|
-
|
|
46
|
-
expect(slideInModal).toBeDefined();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("makes modal content's container visible after opening transition ends", () => {
|
|
50
|
-
const { slideInModal, rerender } = createSlideInModal();
|
|
51
|
-
|
|
52
|
-
expect(slideInModal).toHaveClass("hide");
|
|
53
|
-
|
|
54
|
-
rerender(<SlideInModal {...defaultParams} open />);
|
|
55
|
-
fireEvent.transitionEnd(slideInModal);
|
|
56
|
-
|
|
57
|
-
expect(slideInModal).not.toHaveClass("hide");
|
|
58
|
-
|
|
59
|
-
rerender(<SlideInModal {...defaultParams} open={false} />);
|
|
60
|
-
fireEvent.transitionEnd(slideInModal);
|
|
61
|
-
|
|
62
|
-
expect(slideInModal).toHaveClass("hide");
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe("ref should work", () => {
|
|
67
|
-
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
68
|
-
const ExampleComponent = ({
|
|
69
|
-
propagateRef
|
|
70
|
-
}: {
|
|
71
|
-
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
72
|
-
}) => {
|
|
73
|
-
const ref = useRef(null);
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (ref.current) {
|
|
77
|
-
propagateRef && propagateRef(ref);
|
|
78
|
-
}
|
|
79
|
-
}, [ref]);
|
|
80
|
-
|
|
81
|
-
return <SlideInModal {...defaultParams} data-ref="testing" ref={ref} />;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
85
|
-
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
render(<ExampleComponent propagateRef={refCheck} />);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 OneWelcome B.V.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import React from "react";
|
|
18
|
-
import { SnackbarContainer, Props } from "./SnackbarContainer";
|
|
19
|
-
import { render } from "@testing-library/react";
|
|
20
|
-
|
|
21
|
-
const defaultParams: Props = {
|
|
22
|
-
placement: { vertical: "top", horizontal: "center" },
|
|
23
|
-
children: <span>children</span>
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const createSnackbarContainer = (params?: (defaultParams: Props) => Props) => {
|
|
27
|
-
let parameters: Props = defaultParams;
|
|
28
|
-
if (params) {
|
|
29
|
-
parameters = params(defaultParams);
|
|
30
|
-
}
|
|
31
|
-
const queries = render(<SnackbarContainer {...parameters} data-testid="snackbarcontainer" />);
|
|
32
|
-
const snackbarcontainer = queries.getByTestId("snackbarcontainer");
|
|
33
|
-
return { ...queries, snackbarcontainer };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
describe("SnackbarContainer should render", () => {
|
|
37
|
-
it("renders without crashing", () => {
|
|
38
|
-
const { snackbarcontainer, getByText } = createSnackbarContainer();
|
|
39
|
-
expect(snackbarcontainer).toHaveClass("top");
|
|
40
|
-
expect(snackbarcontainer).toHaveClass("center");
|
|
41
|
-
expect(snackbarcontainer).toHaveStyle({ zIndex: "" });
|
|
42
|
-
expect(getByText("children")).toBeDefined();
|
|
43
|
-
expect(snackbarcontainer).toBeDefined();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("renders with zIndex", () => {
|
|
47
|
-
const { snackbarcontainer } = createSnackbarContainer(defaultParams => ({
|
|
48
|
-
...defaultParams,
|
|
49
|
-
zIndex: 1
|
|
50
|
-
}));
|
|
51
|
-
expect(snackbarcontainer).toHaveStyle({ zIndex: "1" });
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 OneWelcome B.V.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import React from "react";
|
|
18
|
-
import { render, getByRole, waitFor } from "@testing-library/react";
|
|
19
|
-
import { SnackbarItem, Props } from "./SnackbarItem";
|
|
20
|
-
import userEvent from "@testing-library/user-event";
|
|
21
|
-
|
|
22
|
-
const initParams: Props = {
|
|
23
|
-
id: "id",
|
|
24
|
-
title: "title",
|
|
25
|
-
content: "content",
|
|
26
|
-
duration: 1,
|
|
27
|
-
variant: "success",
|
|
28
|
-
closeButtonTitle: "close",
|
|
29
|
-
onClose: jest.fn()
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
describe("<SnackbarItem />", () => {
|
|
33
|
-
it("should render without crashing", () => {
|
|
34
|
-
const { container } = render(<SnackbarItem {...initParams} />);
|
|
35
|
-
|
|
36
|
-
const titleDiv = container.querySelector(".title");
|
|
37
|
-
expect(titleDiv).toHaveTextContent(initParams.title!);
|
|
38
|
-
const contentDiv = container.querySelector(".content");
|
|
39
|
-
expect(contentDiv).toHaveTextContent(initParams.content!);
|
|
40
|
-
const actionsDiv = container.querySelector(".actions");
|
|
41
|
-
expect(actionsDiv).toBeNull();
|
|
42
|
-
expect(getByRole(container, "button")).toBeDefined();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("should clicking close button call callback function", async () => {
|
|
46
|
-
const { container } = render(<SnackbarItem {...initParams} duration={10000000} />);
|
|
47
|
-
|
|
48
|
-
expect(initParams.onClose).not.toBeCalled();
|
|
49
|
-
await userEvent.click(getByRole(container, "button"));
|
|
50
|
-
waitFor(() => {
|
|
51
|
-
expect(initParams.onClose).toBeCalledTimes(1);
|
|
52
|
-
expect(initParams.onClose).toHaveBeenCalledWith(initParams.id);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("should call close callback after provided duration", () => {
|
|
57
|
-
render(<SnackbarItem {...initParams} />);
|
|
58
|
-
|
|
59
|
-
expect(initParams.onClose).not.toBeCalled();
|
|
60
|
-
waitFor(() => {
|
|
61
|
-
expect(initParams.onClose).toBeCalledTimes(1);
|
|
62
|
-
expect(initParams.onClose).toHaveBeenCalledWith(initParams.id);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("should render only content when only title is provided", () => {
|
|
67
|
-
const { container } = render(<SnackbarItem {...initParams} content={undefined} />);
|
|
68
|
-
|
|
69
|
-
const titleDiv = container.querySelector(".title");
|
|
70
|
-
expect(titleDiv).toBeNull();
|
|
71
|
-
const contentDiv = container.querySelector(".content");
|
|
72
|
-
expect(contentDiv).toHaveTextContent(initParams.title!);
|
|
73
|
-
const actionsDiv = container.querySelector(".actions");
|
|
74
|
-
expect(actionsDiv).toBeNull();
|
|
75
|
-
expect(getByRole(container, "button")).toBeDefined();
|
|
76
|
-
});
|
|
77
|
-
});
|