@centreon/ui 23.10.33 → 23.10.34-MON-19940-Add-testIds-cloud-notifications.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/package.json +1 -1
- package/src/Dialog/index.tsx +20 -1
package/package.json
CHANGED
package/src/Dialog/index.tsx
CHANGED
|
@@ -28,12 +28,18 @@ const useStyles = makeStyles<StylesProps>()((theme, { contentWidth }) => ({
|
|
|
28
28
|
}
|
|
29
29
|
}));
|
|
30
30
|
|
|
31
|
+
interface DialogDataTestId {
|
|
32
|
+
dataTestIdCanceledButton?: string;
|
|
33
|
+
dataTestIdConfirmButton?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
export type Props = {
|
|
32
37
|
cancelDisabled?: boolean;
|
|
33
38
|
children?: ReactNode;
|
|
34
39
|
className?: string;
|
|
35
40
|
confirmDisabled?: boolean;
|
|
36
41
|
contentWidth?: number;
|
|
42
|
+
dataTestId?: DialogDataTestId;
|
|
37
43
|
dialogActionsClassName?: string;
|
|
38
44
|
dialogConfirmButtonClassName?: string;
|
|
39
45
|
dialogContentClassName?: string;
|
|
@@ -62,6 +68,7 @@ const Dialog = ({
|
|
|
62
68
|
confirmDisabled = false,
|
|
63
69
|
cancelDisabled = false,
|
|
64
70
|
submitting = false,
|
|
71
|
+
dataTestId,
|
|
65
72
|
dialogPaperClassName,
|
|
66
73
|
dialogTitleClassName,
|
|
67
74
|
dialogContentClassName,
|
|
@@ -71,6 +78,12 @@ const Dialog = ({
|
|
|
71
78
|
}: Props): JSX.Element => {
|
|
72
79
|
const { classes, cx } = useStyles({ contentWidth });
|
|
73
80
|
|
|
81
|
+
const dataTestIdConfirmButton =
|
|
82
|
+
dataTestId?.dataTestIdConfirmButton ?? labelConfirm;
|
|
83
|
+
|
|
84
|
+
const dataTestIdCanceledButton =
|
|
85
|
+
dataTestId?.dataTestIdCanceledButton ?? labelCancel;
|
|
86
|
+
|
|
74
87
|
return (
|
|
75
88
|
<MuiDialog
|
|
76
89
|
PaperProps={{
|
|
@@ -93,7 +106,12 @@ const Dialog = ({
|
|
|
93
106
|
)}
|
|
94
107
|
<DialogActions className={dialogActionsClassName}>
|
|
95
108
|
{onCancel && (
|
|
96
|
-
<Button
|
|
109
|
+
<Button
|
|
110
|
+
color="primary"
|
|
111
|
+
data-testid={dataTestIdCanceledButton}
|
|
112
|
+
disabled={cancelDisabled}
|
|
113
|
+
onClick={onCancel}
|
|
114
|
+
>
|
|
97
115
|
{labelCancel}
|
|
98
116
|
</Button>
|
|
99
117
|
)}
|
|
@@ -101,6 +119,7 @@ const Dialog = ({
|
|
|
101
119
|
aria-label={labelConfirm || ''}
|
|
102
120
|
className={dialogConfirmButtonClassName}
|
|
103
121
|
color="primary"
|
|
122
|
+
data-testid={dataTestIdConfirmButton}
|
|
104
123
|
disabled={confirmDisabled}
|
|
105
124
|
endIcon={submitting && <CircularProgress size={15} />}
|
|
106
125
|
onClick={onConfirm}
|