@onewelcome/react-lib-components 0.2.1 → 0.2.4
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/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/Button/BaseButton.d.ts +4 -4
- package/dist/Button/Button.d.ts +3 -3
- package/dist/Button/IconButton.d.ts +4 -4
- package/dist/ContextMenu/ContextMenu.d.ts +5 -5
- package/dist/ContextMenu/ContextMenuItem.d.ts +2 -2
- package/dist/DataGrid/DataGrid.d.ts +6 -6
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +4 -4
- package/dist/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridBody.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridCell.d.ts +2 -2
- package/dist/DataGrid/DataGridBody/DataGridRow.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeader.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +3 -3
- package/dist/DataGrid/datagrid.interfaces.d.ts +1 -1
- package/dist/Form/Checkbox/Checkbox.d.ts +5 -5
- package/dist/Form/Fieldset/Fieldset.d.ts +3 -3
- package/dist/Form/Form.d.ts +1 -1
- package/dist/Form/FormControl/FormControl.d.ts +3 -3
- package/dist/Form/FormGroup/FormGroup.d.ts +5 -5
- package/dist/Form/FormHelperText/FormHelperText.d.ts +3 -3
- package/dist/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +6 -6
- package/dist/Form/Input/Input.d.ts +5 -5
- package/dist/Form/Label/Label.d.ts +2 -2
- package/dist/Form/Radio/Radio.d.ts +5 -5
- package/dist/Form/Select/Option.d.ts +2 -2
- package/dist/Form/Select/Select.d.ts +5 -5
- package/dist/Form/Textarea/Textarea.d.ts +6 -6
- package/dist/Form/Toggle/Toggle.d.ts +3 -3
- package/dist/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/InputWrapper/InputWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/Wrapper/Wrapper.d.ts +6 -6
- package/dist/Form/form.interfaces.d.ts +2 -2
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Link/Link.d.ts +7 -7
- package/dist/Notifications/BaseModal/BaseModal.d.ts +4 -4
- package/dist/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +2 -2
- package/dist/Notifications/Dialog/Dialog.d.ts +5 -5
- package/dist/Notifications/Dialog/DialogActions/DialogActions.d.ts +3 -3
- package/dist/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +2 -2
- package/dist/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +3 -3
- package/dist/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +7 -7
- package/dist/Notifications/Modal/Modal.d.ts +1 -1
- package/dist/Notifications/Modal/ModalActions/ModalActions.d.ts +1 -1
- package/dist/Notifications/Modal/ModalContent/ModalContent.d.ts +1 -1
- package/dist/Notifications/Modal/ModalHeader/ModalHeader.d.ts +1 -1
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarItem/SnackbarItem.d.ts +2 -2
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +2 -2
- package/dist/Notifications/Snackbar/interfaces.d.ts +2 -2
- package/dist/Pagination/Pagination.d.ts +3 -3
- package/dist/Popover/Popover.d.ts +3 -3
- package/dist/Skeleton/Skeleton.d.ts +3 -3
- package/dist/StatusIndicator/StatusIndicator.d.ts +5 -5
- package/dist/Tabs/Tab.d.ts +1 -1
- package/dist/Tabs/TabButton.d.ts +2 -2
- package/dist/Tabs/TabPanel.d.ts +2 -2
- package/dist/Tabs/Tabs.d.ts +4 -4
- package/dist/TextEllipsis/TextEllipsis.d.ts +2 -2
- package/dist/Tiles/Tile.d.ts +5 -5
- package/dist/Tiles/Tiles.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +3 -3
- package/dist/Typography/Typography.d.ts +3 -3
- package/dist/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +2 -2
- package/dist/Wizard/Wizard.d.ts +3 -3
- package/dist/Wizard/WizardActions/WizardActions.d.ts +2 -2
- package/dist/Wizard/WizardStateProvider.d.ts +2 -2
- package/dist/Wizard/WizardSteps/WizardSteps.d.ts +2 -2
- package/dist/Wizard/wizardStateReducer.d.ts +5 -5
- package/dist/_BaseStyling_/BaseStyling.d.ts +1 -1
- package/dist/hooks/usePosition.d.ts +5 -5
- package/dist/hooks/useRepeater.d.ts +1 -1
- package/dist/hooks/useScroll.d.ts +1 -1
- package/dist/hooks/useSpacing.d.ts +1 -1
- package/dist/hooks/useWrapper.d.ts +1 -1
- package/dist/index.d.ts +55 -55
- package/dist/interfaces.d.ts +1 -1
- package/dist/react-lib-components.cjs.development.js +683 -581
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +683 -581
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +27 -16
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +15 -15
- package/src/Breadcrumbs/Breadcrumbs.tsx +11 -11
- package/src/Button/BaseButton.module.scss +1 -1
- package/src/Button/BaseButton.test.tsx +27 -27
- package/src/Button/BaseButton.tsx +8 -8
- package/src/Button/Button.module.scss +5 -5
- package/src/Button/Button.test.tsx +39 -39
- package/src/Button/Button.tsx +10 -10
- package/src/Button/IconButton.module.scss +5 -5
- package/src/Button/IconButton.test.tsx +29 -29
- package/src/Button/IconButton.tsx +11 -11
- package/src/ContextMenu/ContextMenu.test.tsx +97 -76
- package/src/ContextMenu/ContextMenu.tsx +48 -42
- package/src/ContextMenu/ContextMenuItem.module.scss +1 -1
- package/src/ContextMenu/ContextMenuItem.tsx +8 -5
- package/src/DataGrid/DataGrid.test.tsx +193 -193
- package/src/DataGrid/DataGrid.tsx +26 -26
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +63 -63
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +15 -15
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +1 -1
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +21 -21
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +20 -20
- package/src/DataGrid/DataGridBody/DataGridBody.test.tsx +40 -40
- package/src/DataGrid/DataGridBody/DataGridBody.tsx +10 -10
- package/src/DataGrid/DataGridBody/DataGridCell.module.scss +1 -1
- package/src/DataGrid/DataGridBody/DataGridCell.test.tsx +25 -25
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +6 -6
- package/src/DataGrid/DataGridBody/DataGridRow.test.tsx +38 -38
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +9 -9
- package/src/DataGrid/DataGridHeader/DataGridHeader.module.scss +1 -2
- package/src/DataGrid/DataGridHeader/DataGridHeader.test.tsx +119 -119
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +13 -13
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +2 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +51 -51
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +14 -14
- package/src/DataGrid/datagrid.interfaces.ts +1 -1
- package/src/Form/Checkbox/Checkbox.test.tsx +74 -74
- package/src/Form/Checkbox/Checkbox.tsx +27 -27
- package/src/Form/Fieldset/Fieldset.module.scss +1 -1
- package/src/Form/Fieldset/Fieldset.test.tsx +35 -35
- package/src/Form/Fieldset/Fieldset.tsx +27 -27
- package/src/Form/Form.test.tsx +18 -18
- package/src/Form/Form.tsx +3 -3
- package/src/Form/FormControl/FormControl.test.tsx +22 -22
- package/src/Form/FormControl/FormControl.tsx +10 -10
- package/src/Form/FormGroup/FormGroup.test.tsx +37 -37
- package/src/Form/FormGroup/FormGroup.tsx +16 -16
- package/src/Form/FormHelperText/FormHelperText.test.tsx +18 -18
- package/src/Form/FormHelperText/FormHelperText.tsx +7 -7
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +15 -15
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +14 -14
- package/src/Form/Input/Input.module.scss +20 -44
- package/src/Form/Input/Input.test.tsx +121 -73
- package/src/Form/Input/Input.tsx +96 -35
- package/src/Form/Label/Label.test.tsx +13 -13
- package/src/Form/Label/Label.tsx +6 -6
- package/src/Form/Radio/Radio.test.tsx +35 -35
- package/src/Form/Radio/Radio.tsx +17 -17
- package/src/Form/Select/Option.test.tsx +10 -10
- package/src/Form/Select/Option.tsx +8 -8
- package/src/Form/Select/Select.module.scss +7 -9
- package/src/Form/Select/Select.test.tsx +144 -141
- package/src/Form/Select/Select.tsx +79 -78
- package/src/Form/Textarea/Textarea.module.scss +8 -18
- package/src/Form/Textarea/Textarea.test.tsx +27 -27
- package/src/Form/Textarea/Textarea.tsx +33 -13
- package/src/Form/Toggle/Toggle.module.scss +1 -1
- package/src/Form/Toggle/Toggle.test.tsx +22 -22
- package/src/Form/Toggle/Toggle.tsx +10 -10
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +39 -39
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +12 -12
- package/src/Form/Wrapper/InputWrapper/InputWrapper.module.scss +2 -8
- package/src/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +30 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +35 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +12 -12
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +12 -12
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +2 -11
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +50 -50
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +22 -22
- package/src/Form/Wrapper/Wrapper/Wrapper.module.scss +2 -2
- package/src/Form/Wrapper/Wrapper/Wrapper.test.tsx +11 -11
- package/src/Form/Wrapper/Wrapper/Wrapper.tsx +17 -17
- package/src/Form/form.interfaces.ts +2 -2
- package/src/Icon/Icon.module.scss +71 -71
- package/src/Icon/Icon.test.tsx +18 -18
- package/src/Icon/Icon.tsx +70 -70
- package/src/Link/Link.module.scss +5 -5
- package/src/Link/Link.test.tsx +76 -76
- package/src/Link/Link.tsx +27 -27
- package/src/Link/types.d.ts +2 -2
- package/src/Notifications/BaseModal/BaseModal.module.scss +1 -1
- package/src/Notifications/BaseModal/BaseModal.test.tsx +53 -53
- package/src/Notifications/BaseModal/BaseModal.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +13 -13
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +19 -19
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +10 -10
- package/src/Notifications/Dialog/Dialog.test.tsx +35 -35
- package/src/Notifications/Dialog/Dialog.tsx +19 -19
- package/src/Notifications/Dialog/DialogActions/DialogActions.test.tsx +14 -14
- package/src/Notifications/Dialog/DialogActions/DialogActions.tsx +6 -6
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +12 -12
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.tsx +6 -6
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +20 -20
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +7 -7
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +36 -36
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.tsx +8 -8
- package/src/Notifications/Modal/Modal.test.tsx +6 -6
- package/src/Notifications/Modal/Modal.tsx +1 -1
- package/src/Notifications/Modal/ModalActions/ModalActions.tsx +2 -2
- package/src/Notifications/Modal/ModalContent/ModalContent.tsx +2 -2
- package/src/Notifications/Modal/ModalHeader/ModalHeader.tsx +2 -2
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +16 -16
- package/src/Notifications/SlideInModal/SlideInModal.tsx +16 -11
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +16 -16
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.tsx +6 -6
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +2 -2
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +17 -17
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +23 -23
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +32 -32
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.tsx +18 -18
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.tsx +3 -3
- package/src/Notifications/Snackbar/interfaces.ts +2 -2
- package/src/Notifications/Snackbar/useSnackbar.ts +2 -2
- package/src/Pagination/Pagination.module.scss +2 -0
- package/src/Pagination/Pagination.test.tsx +47 -47
- package/src/Pagination/Pagination.tsx +35 -35
- package/src/Popover/Popover.test.tsx +19 -19
- package/src/Popover/Popover.tsx +7 -7
- package/src/Skeleton/Skeleton.module.scss +2 -2
- package/src/Skeleton/Skeleton.test.tsx +29 -29
- package/src/Skeleton/Skeleton.tsx +10 -10
- package/src/StatusIndicator/StatusIndicator.test.tsx +38 -38
- package/src/StatusIndicator/StatusIndicator.tsx +9 -9
- package/src/Tabs/Tab.test.tsx +13 -13
- package/src/Tabs/Tab.tsx +1 -1
- package/src/Tabs/TabButton.test.tsx +28 -28
- package/src/Tabs/TabButton.tsx +7 -7
- package/src/Tabs/TabPanel.test.tsx +30 -30
- package/src/Tabs/TabPanel.tsx +4 -4
- package/src/Tabs/Tabs.test.tsx +93 -93
- package/src/Tabs/Tabs.tsx +25 -25
- package/src/TextEllipsis/TextEllipsis.test.tsx +22 -22
- package/src/TextEllipsis/TextEllipsis.tsx +6 -6
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tiles/Tile.test.tsx +42 -42
- package/src/Tiles/Tile.tsx +22 -22
- package/src/Tiles/Tiles.test.tsx +30 -30
- package/src/Tiles/Tiles.tsx +9 -9
- package/src/Tooltip/Tooltip.test.tsx +35 -35
- package/src/Tooltip/Tooltip.tsx +21 -21
- package/src/Typography/Typography.module.scss +1 -1
- package/src/Typography/Typography.test.tsx +49 -49
- package/src/Typography/Typography.tsx +42 -42
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.module.scss +1 -1
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +26 -26
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.tsx +24 -24
- package/src/Wizard/Wizard.test.tsx +56 -56
- package/src/Wizard/Wizard.tsx +6 -6
- package/src/Wizard/WizardActions/WizardActions.test.tsx +34 -34
- package/src/Wizard/WizardActions/WizardActions.tsx +14 -14
- package/src/Wizard/WizardStateProvider.tsx +3 -3
- package/src/Wizard/WizardSteps/WizardSteps.test.tsx +27 -27
- package/src/Wizard/WizardSteps/WizardSteps.tsx +7 -7
- package/src/Wizard/wizardStateReducer.ts +9 -9
- package/src/_BaseStyling_/BaseStyling.test.tsx +14 -14
- package/src/_BaseStyling_/BaseStyling.tsx +50 -50
- package/src/hooks/useAnimation.test.tsx +12 -12
- package/src/hooks/useAnimation.ts +4 -4
- package/src/hooks/useBodyClick.test.tsx +8 -8
- package/src/hooks/useBodyClick.ts +3 -3
- package/src/hooks/useFormSelector.test.ts +17 -17
- package/src/hooks/useFormSelector.ts +4 -4
- package/src/hooks/usePosition.test.tsx +215 -215
- package/src/hooks/usePosition.ts +73 -72
- package/src/hooks/useRepeater.test.tsx +26 -26
- package/src/hooks/useRepeater.ts +5 -5
- package/src/hooks/useScroll.test.tsx +5 -5
- package/src/hooks/useScroll.ts +3 -3
- package/src/hooks/useSpacing.test.ts +40 -40
- package/src/hooks/useSpacing.ts +3 -3
- package/src/hooks/useWrapper.test.ts +12 -12
- package/src/hooks/useWrapper.ts +10 -10
- package/src/index.ts +67 -67
- package/src/interfaces.ts +1 -1
- package/src/mixins.module.scss +76 -27
- package/src/types.d.ts +1 -1
- package/src/util/helper.test.tsx +25 -25
- package/src/util/helper.tsx +64 -64
package/src/Tiles/Tile.test.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import { Tile, Props } from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { Icon, Icons } from
|
|
5
|
-
import { ContextMenu } from
|
|
6
|
-
import { IconButton } from
|
|
7
|
-
import { ContextMenuItem } from
|
|
8
|
-
import userEvent from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Tile, Props } from "./Tile";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
import { Icon, Icons } from "../Icon/Icon";
|
|
5
|
+
import { ContextMenu } from "../ContextMenu/ContextMenu";
|
|
6
|
+
import { IconButton } from "../Button/IconButton";
|
|
7
|
+
import { ContextMenuItem } from "../ContextMenu/ContextMenuItem";
|
|
8
|
+
import userEvent from "@testing-library/user-event";
|
|
9
9
|
|
|
10
10
|
const onShow = jest.fn();
|
|
11
11
|
const onClose = jest.fn();
|
|
@@ -36,9 +36,9 @@ const contextMenu = (
|
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const defaultParams: Props = {
|
|
39
|
-
title:
|
|
39
|
+
title: "tile",
|
|
40
40
|
enabled: true,
|
|
41
|
-
tileAction: contextMenu
|
|
41
|
+
tileAction: contextMenu
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const createTile = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -51,42 +51,42 @@ const createTile = (params?: (defaultParams: Props) => Props) => {
|
|
|
51
51
|
tile content
|
|
52
52
|
</Tile>
|
|
53
53
|
);
|
|
54
|
-
const tile = queries.getByTestId(
|
|
55
|
-
const menutrigger = queries.getByTestId(
|
|
54
|
+
const tile = queries.getByTestId("tile");
|
|
55
|
+
const menutrigger = queries.getByTestId("contextmenu-trigger");
|
|
56
56
|
|
|
57
57
|
return {
|
|
58
58
|
...queries,
|
|
59
59
|
tile,
|
|
60
|
-
menutrigger
|
|
60
|
+
menutrigger
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
describe(
|
|
65
|
-
it(
|
|
64
|
+
describe("Tile should render", () => {
|
|
65
|
+
it("renders without crashing and enabled", () => {
|
|
66
66
|
const { tile } = createTile();
|
|
67
67
|
|
|
68
|
-
expect(tile.querySelector(
|
|
69
|
-
expect(tile.querySelector(
|
|
68
|
+
expect(tile.querySelector(".icon-checkmark")).toBeTruthy();
|
|
69
|
+
expect(tile.querySelector(".icon-forbidden")).toBeFalsy();
|
|
70
70
|
expect(tile).toBeDefined();
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
it(
|
|
74
|
-
const { tile } = createTile(
|
|
73
|
+
it("renders disabled", () => {
|
|
74
|
+
const { tile } = createTile(defaultParams => ({ ...defaultParams, enabled: false }));
|
|
75
75
|
|
|
76
|
-
expect(tile.querySelector(
|
|
77
|
-
expect(tile.querySelector(
|
|
76
|
+
expect(tile.querySelector(".icon-checkmark")).toBeFalsy();
|
|
77
|
+
expect(tile.querySelector(".icon-forbidden")).toBeTruthy();
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
it(
|
|
81
|
-
const { tile } = createTile(
|
|
80
|
+
it("renders no status", () => {
|
|
81
|
+
const { tile } = createTile(defaultParams => ({ ...defaultParams, enabled: undefined }));
|
|
82
82
|
|
|
83
|
-
expect(tile.querySelector(
|
|
84
|
-
expect(tile.querySelector(
|
|
83
|
+
expect(tile.querySelector(".icon-checkmark")).toBeFalsy();
|
|
84
|
+
expect(tile.querySelector(".icon-forbidden")).toBeFalsy();
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
describe("should throw errors since we don't pass props", () => {
|
|
89
|
-
it(
|
|
89
|
+
it("throws because of missing id", () => {
|
|
90
90
|
// Prevent throwing an error in the console when this test is executed. We fix this and the end of this test.
|
|
91
91
|
const err = console.error;
|
|
92
92
|
console.error = jest.fn();
|
|
@@ -95,12 +95,12 @@ describe("should throw errors since we don't pass props", () => {
|
|
|
95
95
|
|
|
96
96
|
try {
|
|
97
97
|
// @ts-ignore: mandatory props (test for non-typescript react projects)
|
|
98
|
-
render(<Tile imageProps={{ src:
|
|
98
|
+
render(<Tile imageProps={{ src: "test" }} />);
|
|
99
99
|
} catch (e: any) {
|
|
100
100
|
actual = e.message;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const expected =
|
|
103
|
+
const expected = "Please make sure to pass a title prop to your Tile component.";
|
|
104
104
|
|
|
105
105
|
expect(actual).toEqual(expected);
|
|
106
106
|
|
|
@@ -108,17 +108,17 @@ describe("should throw errors since we don't pass props", () => {
|
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
describe(
|
|
112
|
-
it(
|
|
111
|
+
describe("contextmenu", () => {
|
|
112
|
+
it("should render everything correctly", () => {
|
|
113
113
|
const { menutrigger, getByTestId } = createTile();
|
|
114
114
|
|
|
115
|
-
const contextMenu = getByTestId(
|
|
116
|
-
const menuitem1 = getByTestId(
|
|
117
|
-
const menuitem2 = getByTestId(
|
|
118
|
-
const menuitem3 = getByTestId(
|
|
119
|
-
const popover = document.querySelector(
|
|
115
|
+
const contextMenu = getByTestId("contextmenu");
|
|
116
|
+
const menuitem1 = getByTestId("item1");
|
|
117
|
+
const menuitem2 = getByTestId("item2");
|
|
118
|
+
const menuitem3 = getByTestId("item3");
|
|
119
|
+
const popover = document.querySelector(".popover");
|
|
120
120
|
|
|
121
|
-
expect(popover).toHaveStyle({ opacity:
|
|
121
|
+
expect(popover).toHaveStyle({ opacity: "0;" });
|
|
122
122
|
expect(menutrigger).toBeTruthy();
|
|
123
123
|
expect(contextMenu).toBeTruthy();
|
|
124
124
|
expect(menuitem1).toBeTruthy();
|
|
@@ -127,8 +127,8 @@ describe('contextmenu', () => {
|
|
|
127
127
|
|
|
128
128
|
userEvent.click(menutrigger);
|
|
129
129
|
expect(onShow).toHaveBeenCalled();
|
|
130
|
-
expect(popover).toHaveClass(
|
|
131
|
-
expect(popover).toHaveStyle({ opacity:
|
|
130
|
+
expect(popover).toHaveClass("show");
|
|
131
|
+
expect(popover).toHaveStyle({ opacity: "1;" });
|
|
132
132
|
|
|
133
133
|
userEvent.click(menuitem1);
|
|
134
134
|
userEvent.click(menuitem2);
|
|
@@ -138,10 +138,10 @@ describe('contextmenu', () => {
|
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
describe(
|
|
142
|
-
it(
|
|
141
|
+
describe("ref should work", () => {
|
|
142
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
143
143
|
const ExampleComponent = ({
|
|
144
|
-
propagateRef
|
|
144
|
+
propagateRef
|
|
145
145
|
}: {
|
|
146
146
|
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
147
147
|
}) => {
|
|
@@ -157,7 +157,7 @@ describe('ref should work', () => {
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
160
|
-
expect(ref.current).toHaveAttribute(
|
|
160
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
render(<ExampleComponent propagateRef={refCheck} />);
|
package/src/Tiles/Tile.tsx
CHANGED
|
@@ -2,21 +2,21 @@ import React, {
|
|
|
2
2
|
ComponentPropsWithoutRef,
|
|
3
3
|
ComponentPropsWithRef,
|
|
4
4
|
ReactElement,
|
|
5
|
-
useState
|
|
6
|
-
} from
|
|
7
|
-
import { Icon, Icons } from
|
|
8
|
-
import classes from
|
|
9
|
-
import readyClasses from
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Icon, Icons } from "../Icon/Icon";
|
|
8
|
+
import classes from "./Tile.module.scss";
|
|
9
|
+
import readyClasses from "../readyclasses.module.scss";
|
|
10
10
|
|
|
11
|
-
import { Props as ContextMenuProps } from
|
|
12
|
-
import { generateID } from
|
|
13
|
-
import { Props as IconButtonProps } from
|
|
11
|
+
import { Props as ContextMenuProps } from "../ContextMenu/ContextMenu";
|
|
12
|
+
import { generateID } from "../util/helper";
|
|
13
|
+
import { Props as IconButtonProps } from "../Button/IconButton";
|
|
14
14
|
|
|
15
|
-
interface ImageProps extends ComponentPropsWithoutRef<
|
|
15
|
+
interface ImageProps extends ComponentPropsWithoutRef<"img"> {
|
|
16
16
|
src: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface Props extends ComponentPropsWithRef<
|
|
19
|
+
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
20
20
|
title: string;
|
|
21
21
|
imageProps?: ImageProps;
|
|
22
22
|
enabled?: boolean;
|
|
@@ -29,15 +29,15 @@ export const Tile = React.forwardRef<HTMLDivElement, Props>(
|
|
|
29
29
|
const [tileDescriptionID] = useState(generateID(20));
|
|
30
30
|
|
|
31
31
|
if (!title) {
|
|
32
|
-
throw new Error(
|
|
32
|
+
throw new Error("Please make sure to pass a title prop to your Tile component.");
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const statusMessage = () => {
|
|
36
36
|
if (enabled) {
|
|
37
|
-
return
|
|
37
|
+
return "Status: enabled";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return
|
|
40
|
+
return "Status: disabled";
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
return (
|
|
@@ -46,40 +46,40 @@ export const Tile = React.forwardRef<HTMLDivElement, Props>(
|
|
|
46
46
|
tabIndex={0}
|
|
47
47
|
aria-labelledby={tileDescriptionID}
|
|
48
48
|
ref={ref}
|
|
49
|
-
className={`${classes[
|
|
49
|
+
className={`${classes["tile"]} ${loading ? classes["loading"] : ""}`}
|
|
50
50
|
>
|
|
51
|
-
<header style={{ justifyContent: enabled === undefined ?
|
|
51
|
+
<header style={{ justifyContent: enabled === undefined ? "flex-end" : "space-between" }}>
|
|
52
52
|
{enabled === true && (
|
|
53
53
|
<Icon
|
|
54
54
|
color="var(--success)"
|
|
55
55
|
icon={Icons.Checkmark}
|
|
56
|
-
className={`${classes[
|
|
56
|
+
className={`${classes["icon"]} ${className ?? ""}`}
|
|
57
57
|
/>
|
|
58
58
|
)}
|
|
59
59
|
{enabled === false && (
|
|
60
60
|
<Icon
|
|
61
61
|
color="var(--greyed-out)"
|
|
62
62
|
icon={Icons.Forbidden}
|
|
63
|
-
className={`${classes[
|
|
63
|
+
className={`${classes["icon"]} ${className ?? ""}`}
|
|
64
64
|
/>
|
|
65
65
|
)}
|
|
66
66
|
{enabled !== undefined && (
|
|
67
|
-
<span id={tileDescriptionID} className={readyClasses[
|
|
67
|
+
<span id={tileDescriptionID} className={readyClasses["sr-only"]}>
|
|
68
68
|
{`${title}. ${statusMessage()}`}
|
|
69
69
|
</span>
|
|
70
70
|
)}
|
|
71
71
|
{tileAction ?? null}
|
|
72
72
|
</header>
|
|
73
|
-
<div className={classes[
|
|
73
|
+
<div className={classes["content"]}>
|
|
74
74
|
{imageProps && imageProps.src.length > 0 && (
|
|
75
|
-
<figure className={classes[
|
|
75
|
+
<figure className={classes["image"]}>
|
|
76
76
|
{!loading && <img {...imageProps} alt="" />}
|
|
77
77
|
</figure>
|
|
78
78
|
)}
|
|
79
79
|
{(!imageProps || imageProps.src.length === 0) && (
|
|
80
|
-
<Icon className={classes[
|
|
80
|
+
<Icon className={classes["placeholder"]} icon={Icons.Image} />
|
|
81
81
|
)}
|
|
82
|
-
<span className={classes[
|
|
82
|
+
<span className={classes["title"]}>{title}</span>
|
|
83
83
|
</div>
|
|
84
84
|
</article>
|
|
85
85
|
);
|
package/src/Tiles/Tiles.test.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import { Tiles, Props } from
|
|
3
|
-
import { Tile } from
|
|
4
|
-
import { render } from
|
|
5
|
-
import { Icon, Icons } from
|
|
6
|
-
import { ContextMenu } from
|
|
7
|
-
import { ContextMenuItem } from
|
|
8
|
-
import { IconButton } from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Tiles, Props } from "./Tiles";
|
|
3
|
+
import { Tile } from "./Tile";
|
|
4
|
+
import { render } from "@testing-library/react";
|
|
5
|
+
import { Icon, Icons } from "../Icon/Icon";
|
|
6
|
+
import { ContextMenu } from "../ContextMenu/ContextMenu";
|
|
7
|
+
import { ContextMenuItem } from "../ContextMenu/ContextMenuItem";
|
|
8
|
+
import { IconButton } from "../Button/IconButton";
|
|
9
9
|
|
|
10
10
|
const onShow = jest.fn();
|
|
11
11
|
const onClose = jest.fn();
|
|
@@ -47,7 +47,7 @@ const defaultParams: Props = {
|
|
|
47
47
|
key="tile1"
|
|
48
48
|
title="Tile1"
|
|
49
49
|
imageProps={{
|
|
50
|
-
src:
|
|
50
|
+
src: "https://www.onegini.com/hubfs/OneWelcome_Beeldmerk.svg"
|
|
51
51
|
}}
|
|
52
52
|
enabled={true}
|
|
53
53
|
tileAction={contextMenu}
|
|
@@ -57,7 +57,7 @@ const defaultParams: Props = {
|
|
|
57
57
|
key="tile2"
|
|
58
58
|
title="Tile2"
|
|
59
59
|
imageProps={{
|
|
60
|
-
src:
|
|
60
|
+
src: "https://www.onegini.com/hubfs/OneWelcome_Beeldmerk.svg"
|
|
61
61
|
}}
|
|
62
62
|
enabled={false}
|
|
63
63
|
tileAction={addToFavoriteButton}
|
|
@@ -67,12 +67,12 @@ const defaultParams: Props = {
|
|
|
67
67
|
key="tile3"
|
|
68
68
|
title="Tile3"
|
|
69
69
|
imageProps={{
|
|
70
|
-
src:
|
|
70
|
+
src: "https://www.onegini.com/hubfs/OneWelcome_Beeldmerk.svg"
|
|
71
71
|
}}
|
|
72
72
|
tileAction={contextMenu}
|
|
73
|
-
|
|
73
|
+
/>
|
|
74
74
|
],
|
|
75
|
-
className:
|
|
75
|
+
className: "example-classname"
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const createTiles = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -81,48 +81,48 @@ const createTiles = (params?: (defaultParams: Props) => Props) => {
|
|
|
81
81
|
parameters = params(defaultParams);
|
|
82
82
|
}
|
|
83
83
|
const queries = render(<Tiles {...parameters} data-testid="tiles" />);
|
|
84
|
-
const tiles = queries.getByTestId(
|
|
84
|
+
const tiles = queries.getByTestId("tiles");
|
|
85
85
|
|
|
86
86
|
let individualTiles;
|
|
87
87
|
|
|
88
88
|
if (!parameters.loading) {
|
|
89
|
-
individualTiles = queries.getAllByTestId(
|
|
89
|
+
individualTiles = queries.getAllByTestId("tile");
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
return {
|
|
93
93
|
...queries,
|
|
94
94
|
tiles,
|
|
95
|
-
individualTiles
|
|
95
|
+
individualTiles
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
describe(
|
|
100
|
-
it(
|
|
99
|
+
describe("Tiles should render", () => {
|
|
100
|
+
it("renders without crashing", () => {
|
|
101
101
|
const { tiles, individualTiles } = createTiles();
|
|
102
102
|
|
|
103
103
|
individualTiles?.forEach((tile, index) => {
|
|
104
|
-
expect(tile.querySelector(
|
|
105
|
-
expect(tile.querySelector(
|
|
104
|
+
expect(tile.querySelector(".title")).toHaveTextContent("Tile" + (index + 1).toFixed(0));
|
|
105
|
+
expect(tile.querySelector("img")).toBeTruthy();
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
expect(tiles).toHaveClass(
|
|
108
|
+
expect(tiles).toHaveClass("example-classname");
|
|
109
109
|
expect(tiles).toBeDefined();
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
describe(
|
|
114
|
-
it(
|
|
115
|
-
const { tiles } = createTiles(
|
|
113
|
+
describe("loading state should be handled properly", () => {
|
|
114
|
+
it("is loading", () => {
|
|
115
|
+
const { tiles } = createTiles(defaultParams => ({ ...defaultParams, loading: true }));
|
|
116
116
|
|
|
117
|
-
expect(tiles).toHaveAttribute(
|
|
118
|
-
expect(tiles.querySelectorAll(
|
|
117
|
+
expect(tiles).toHaveAttribute("aria-busy", "true");
|
|
118
|
+
expect(tiles.querySelectorAll(".tile.loading").length).toBe(3);
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
describe(
|
|
123
|
-
it(
|
|
122
|
+
describe("ref should work", () => {
|
|
123
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
124
124
|
const ExampleComponent = ({
|
|
125
|
-
propagateRef
|
|
125
|
+
propagateRef
|
|
126
126
|
}: {
|
|
127
127
|
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
128
128
|
}) => {
|
|
@@ -138,7 +138,7 @@ describe('ref should work', () => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
141
|
-
expect(ref.current).toHaveAttribute(
|
|
141
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
render(<ExampleComponent propagateRef={refCheck} />);
|
package/src/Tiles/Tiles.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { ComponentPropsWithRef, ReactNode } from
|
|
2
|
-
import classes from
|
|
3
|
-
import { Tile } from
|
|
1
|
+
import React, { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
import classes from "./Tiles.module.scss";
|
|
3
|
+
import { Tile } from "./Tile";
|
|
4
4
|
|
|
5
|
-
export interface Props extends ComponentPropsWithRef<
|
|
5
|
+
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
}
|
|
@@ -15,21 +15,21 @@ export const Tiles = React.forwardRef<HTMLDivElement, Props>(
|
|
|
15
15
|
<Tile
|
|
16
16
|
key="placeholder1"
|
|
17
17
|
title="placeholder"
|
|
18
|
-
imageProps={{ src:
|
|
18
|
+
imageProps={{ src: "placeholder" }}
|
|
19
19
|
loading={true}
|
|
20
20
|
/>,
|
|
21
21
|
<Tile
|
|
22
22
|
key="placeholder2"
|
|
23
23
|
title="placeholder"
|
|
24
|
-
imageProps={{ src:
|
|
24
|
+
imageProps={{ src: "placeholder" }}
|
|
25
25
|
loading={true}
|
|
26
26
|
/>,
|
|
27
27
|
<Tile
|
|
28
28
|
key="placeholder3"
|
|
29
29
|
title="placeholder"
|
|
30
|
-
imageProps={{ src:
|
|
30
|
+
imageProps={{ src: "placeholder" }}
|
|
31
31
|
loading={true}
|
|
32
|
-
|
|
32
|
+
/>
|
|
33
33
|
];
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -40,7 +40,7 @@ export const Tiles = React.forwardRef<HTMLDivElement, Props>(
|
|
|
40
40
|
<div
|
|
41
41
|
{...rest}
|
|
42
42
|
ref={ref}
|
|
43
|
-
className={`${classes[
|
|
43
|
+
className={`${classes["tiles"]} ${className ?? ""}`}
|
|
44
44
|
aria-live="polite"
|
|
45
45
|
aria-busy={loading}
|
|
46
46
|
>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import { Tooltip, Props } from
|
|
3
|
-
import { render } from
|
|
4
|
-
import userEvent from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Tooltip, Props } from "./Tooltip";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
import userEvent from "@testing-library/user-event";
|
|
5
5
|
|
|
6
6
|
const defaultParams: Props = {
|
|
7
|
-
children:
|
|
8
|
-
label:
|
|
7
|
+
children: "This is a test message",
|
|
8
|
+
label: "Label"
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const createTooltip = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -14,67 +14,67 @@ const createTooltip = (params?: (defaultParams: Props) => Props) => {
|
|
|
14
14
|
parameters = params(defaultParams);
|
|
15
15
|
}
|
|
16
16
|
const queries = render(<Tooltip {...parameters} data-testid="tooltip" />);
|
|
17
|
-
const tooltip = queries.getByTestId(
|
|
17
|
+
const tooltip = queries.getByTestId("tooltip");
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
20
|
...queries,
|
|
21
|
-
tooltip
|
|
21
|
+
tooltip
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
describe(
|
|
26
|
-
it(
|
|
27
|
-
const { tooltip, getByText } = createTooltip(
|
|
25
|
+
describe("Tooltip should render", () => {
|
|
26
|
+
it("renders without crashing", () => {
|
|
27
|
+
const { tooltip, getByText } = createTooltip(defaultParams => ({
|
|
28
28
|
...defaultParams,
|
|
29
|
-
className:
|
|
29
|
+
className: "testing"
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
|
-
const tooltipText = getByText(
|
|
33
|
-
const label = getByText(
|
|
32
|
+
const tooltipText = getByText("This is a test message");
|
|
33
|
+
const label = getByText("Label");
|
|
34
34
|
|
|
35
|
-
expect(tooltip).toHaveClass(
|
|
36
|
-
expect(tooltipText).toHaveStyle({ top:
|
|
35
|
+
expect(tooltip).toHaveClass("testing");
|
|
36
|
+
expect(tooltipText).toHaveStyle({ top: "0px", left: "16px" });
|
|
37
37
|
expect(label).toBeTruthy();
|
|
38
38
|
expect(tooltipText).toBeTruthy();
|
|
39
39
|
expect(tooltip).toBeTruthy();
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it(
|
|
43
|
-
const { tooltip, getByText } = createTooltip(
|
|
42
|
+
it("should override the default placement and offset values", () => {
|
|
43
|
+
const { tooltip, getByText } = createTooltip(defaultParams => ({
|
|
44
44
|
...defaultParams,
|
|
45
|
-
placement: { horizontal:
|
|
45
|
+
placement: { horizontal: "center", vertical: "center" },
|
|
46
46
|
offset: { top: 0, right: 16, left: 0, bottom: 16 },
|
|
47
|
-
transformOrigin: { horizontal:
|
|
47
|
+
transformOrigin: { horizontal: "right", vertical: "bottom" }
|
|
48
48
|
}));
|
|
49
49
|
|
|
50
|
-
const tooltipText = getByText(
|
|
51
|
-
expect(tooltipText).toHaveStyle({ right:
|
|
50
|
+
const tooltipText = getByText("This is a test message");
|
|
51
|
+
expect(tooltipText).toHaveStyle({ right: "1024px", bottom: "768px" });
|
|
52
52
|
expect(tooltip).toBeTruthy();
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
describe(
|
|
57
|
-
it(
|
|
56
|
+
describe("It opens the tooltip", () => {
|
|
57
|
+
it("opens", () => {
|
|
58
58
|
const { tooltip, getByText } = createTooltip();
|
|
59
59
|
|
|
60
|
-
const icon = tooltip.querySelector(
|
|
61
|
-
const tooltipHover = getByText(
|
|
60
|
+
const icon = tooltip.querySelector(".icon")!;
|
|
61
|
+
const tooltipHover = getByText("This is a test message");
|
|
62
62
|
userEvent.hover(icon);
|
|
63
63
|
|
|
64
|
-
expect(tooltipHover).toHaveClass(
|
|
65
|
-
expect(tooltipHover).toHaveAttribute(
|
|
64
|
+
expect(tooltipHover).toHaveClass("visible");
|
|
65
|
+
expect(tooltipHover).toHaveAttribute("aria-hidden", "false");
|
|
66
66
|
|
|
67
|
-
userEvent.keyboard(
|
|
67
|
+
userEvent.keyboard("{escape}");
|
|
68
68
|
|
|
69
|
-
expect(tooltipHover).not.toHaveClass(
|
|
70
|
-
expect(tooltipHover).toHaveAttribute(
|
|
69
|
+
expect(tooltipHover).not.toHaveClass("visible");
|
|
70
|
+
expect(tooltipHover).toHaveAttribute("aria-hidden", "true");
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
describe(
|
|
75
|
-
it(
|
|
74
|
+
describe("ref should work", () => {
|
|
75
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
76
76
|
const ExampleComponent = ({
|
|
77
|
-
propagateRef
|
|
77
|
+
propagateRef
|
|
78
78
|
}: {
|
|
79
79
|
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
80
80
|
}) => {
|
|
@@ -90,7 +90,7 @@ describe('ref should work', () => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
93
|
-
expect(ref.current).toHaveAttribute(
|
|
93
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
render(<ExampleComponent propagateRef={refCheck} />);
|