13
13
import AlertMedium from '@spectrum-icons/ui/AlertMedium' ;
14
14
import { Button } from '@react-spectrum/button' ;
15
15
import { ButtonGroup } from '@react-spectrum/buttongroup' ;
16
- import { chain } from '@react-aria/utils' ;
16
+ import { chain , filterDOMProps } from '@react-aria/utils' ;
17
17
import { classNames , useStyleProps } from '@react-spectrum/utils' ;
18
18
import { Content } from '@react-spectrum/view' ;
19
19
import { Dialog } from './Dialog' ;
@@ -71,7 +71,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
71
71
isHidden = { styleProps . hidden }
72
72
size = "M"
73
73
role = "alertdialog"
74
- ref = { ref } >
74
+ ref = { ref }
75
+ { ...filterDOMProps ( props ) } >
75
76
< Heading > { title } </ Heading >
76
77
{ ( variant === 'error' || variant === 'warning' ) &&
77
78
< AlertMedium
@@ -85,7 +86,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
85
86
< Button
86
87
variant = "secondary"
87
88
onPress = { ( ) => chain ( onClose ( ) , onCancel ( ) ) }
88
- autoFocus = { autoFocusButton === 'cancel' } >
89
+ autoFocus = { autoFocusButton === 'cancel' }
90
+ data-testid = "rsp-alertDialog-cancelButton" >
89
91
{ cancelLabel }
90
92
</ Button >
91
93
}
@@ -94,15 +96,17 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
94
96
variant = "secondary"
95
97
onPress = { ( ) => chain ( onClose ( ) , onSecondaryAction ( ) ) }
96
98
isDisabled = { isSecondaryActionDisabled }
97
- autoFocus = { autoFocusButton === 'secondary' } >
99
+ autoFocus = { autoFocusButton === 'secondary' }
100
+ data-testid = "rsp-alertDialog-secondaryButton" >
98
101
{ secondaryActionLabel }
99
102
</ Button >
100
103
}
101
104
< Button
102
105
variant = { confirmVariant }
103
106
onPress = { ( ) => chain ( onClose ( ) , onPrimaryAction ( ) ) }
104
107
isDisabled = { isPrimaryActionDisabled }
105
- autoFocus = { autoFocusButton === 'primary' } >
108
+ autoFocus = { autoFocusButton === 'primary' }
109
+ data-testid = "rsp-alertDialog-confirmButton" >
106
110
{ primaryActionLabel }
107
111
</ Button >
108
112
</ ButtonGroup >
0 commit comments