Skip to content

feat: add test ids for action card component #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/design-system/action-card/action-card.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ type Props = Omit<OmitClassName<'div'>, 'title'> & {
icon: ReactNode;
rootClassName?: string;
iconClassName?: string;
testId?: string;
};

export const ActionCard = ({
title,
description = '',
icon,
testId,
...props
}: Readonly<Props>): JSX.Element => (
<Box {...props} className={classNames([cx.root, props.rootClassName])}>
Expand All @@ -32,6 +34,7 @@ export const ActionCard = ({
mr="$24"
alignItems="center"
justifyContent="center"
data-testid={testId ? `${testId}-icon` : 'action-card-icon'}
>
{icon}
</Flex>
Expand All @@ -43,14 +46,21 @@ export const ActionCard = ({
weight={weight || '$medium'}
color={highlight ? 'highlight' : 'primary'}
key={text}
data-testid={testId ? `${testId}-title` : 'action-card-title'}
>
{text}{' '}
</Text.Body.Normal>
))}
</Box>
{description.length > 0 && (
<Box mt="$8">
<Text.Body.Small weight="$medium" color="secondary">
<Text.Body.Small
weight="$medium"
color="secondary"
data-testid={
testId ? `${testId}-description` : 'action-card-description'
}
>
{description}
</Text.Body.Small>
</Box>
Expand Down