1313import AlertMedium from '@spectrum-icons/ui/AlertMedium' ;
1414import { Button } from '@react-spectrum/button' ;
1515import { ButtonGroup } from '@react-spectrum/buttongroup' ;
16- import { chain } from '@react-aria/utils' ;
16+ import { chain , filterDOMProps } from '@react-aria/utils' ;
1717import { classNames , useStyleProps } from '@react-spectrum/utils' ;
1818import { Content } from '@react-spectrum/view' ;
1919import { Dialog } from './Dialog' ;
@@ -71,7 +71,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
7171 isHidden = { styleProps . hidden }
7272 size = "M"
7373 role = "alertdialog"
74- ref = { ref } >
74+ ref = { ref }
75+ { ...filterDOMProps ( props ) } >
7576 < Heading > { title } </ Heading >
7677 { ( variant === 'error' || variant === 'warning' ) &&
7778 < AlertMedium
@@ -85,7 +86,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
8586 < Button
8687 variant = "secondary"
8788 onPress = { ( ) => chain ( onClose ( ) , onCancel ( ) ) }
88- autoFocus = { autoFocusButton === 'cancel' } >
89+ autoFocus = { autoFocusButton === 'cancel' }
90+ data-testid = "rsp-alertDialog-cancelButton" >
8991 { cancelLabel }
9092 </ Button >
9193 }
@@ -94,15 +96,17 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
9496 variant = "secondary"
9597 onPress = { ( ) => chain ( onClose ( ) , onSecondaryAction ( ) ) }
9698 isDisabled = { isSecondaryActionDisabled }
97- autoFocus = { autoFocusButton === 'secondary' } >
99+ autoFocus = { autoFocusButton === 'secondary' }
100+ data-testid = "rsp-alertDialog-secondaryButton" >
98101 { secondaryActionLabel }
99102 </ Button >
100103 }
101104 < Button
102105 variant = { confirmVariant }
103106 onPress = { ( ) => chain ( onClose ( ) , onPrimaryAction ( ) ) }
104107 isDisabled = { isPrimaryActionDisabled }
105- autoFocus = { autoFocusButton === 'primary' } >
108+ autoFocus = { autoFocusButton === 'primary' }
109+ data-testid = "rsp-alertDialog-confirmButton" >
106110 { primaryActionLabel }
107111 </ Button >
108112 </ ButtonGroup >
0 commit comments