Adds support for ouiaId's on copy buttons

This commit is contained in:
mabashian
2021-03-08 16:11:22 -05:00
parent 811186308c
commit 6a32164438
3 changed files with 8 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ function CopyButton({
onCopyFinish,
errorMessage,
i18n,
ouiaId,
}) {
const { isLoading, error: copyError, request: copyItemToAPI } = useRequest(
copyItem
@@ -35,6 +36,7 @@ function CopyButton({
<>
<Button
id={id}
ouiaId={ouiaId}
isDisabled={isLoading || isDisabled}
aria-label={i18n._(t`Copy`)}
variant="plain"
@@ -62,10 +64,12 @@ CopyButton.propTypes = {
onCopyFinish: PropTypes.func.isRequired,
errorMessage: PropTypes.string.isRequired,
isDisabled: PropTypes.bool,
ouiaId: PropTypes.string,
};
CopyButton.defaultProps = {
isDisabled: false,
ouiaId: null,
};
export default withI18n()(CopyButton);

View File

@@ -227,7 +227,7 @@ function NotificationTemplatesList({ i18n }) {
{i18n._(t`Failed to delete one or more notification template.`)}
<ErrorDetail error={deletionError} />
</AlertModal>
<AlertGroup isToast>
<AlertGroup ouiaId="notification-template-alerts" isToast>
{testToasts
.filter(notification => notification.status !== 'pending')
.map(notification => (

View File

@@ -119,6 +119,7 @@ function NotificationTemplateListItem({
<ActionsTd dataLabel={i18n._(t`Actions`)}>
<ActionItem visible tooltip={i18n._(t`Test notification`)}>
<Button
ouiaId={`notification-test-button-${template.id}`}
aria-label={i18n._(t`Test Notification`)}
variant="plain"
onClick={sendTestNotification}
@@ -132,6 +133,7 @@ function NotificationTemplateListItem({
tooltip={i18n._(t`Edit`)}
>
<Button
ouiaId={`notification-edit-button-${template.id}`}
aria-label={i18n._(t`Edit Notification Template`)}
variant="plain"
component={Link}
@@ -145,6 +147,7 @@ function NotificationTemplateListItem({
tooltip={i18n._(t`Copy Notification Template`)}
>
<CopyButton
ouiaId={`notification-copy-button-${template.id}`}
copyItem={copyTemplate}
isCopyDisabled={isCopyDisabled}
onCopyStart={handleCopyStart}