Skip to content

Commit 1545c97

Browse files
authored
Merge pull request #115 from input-output-hk/feat/action-card-test-ids
feat: add test ids for action card component
2 parents 7e60039 + 12d8d46 commit 1545c97

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/design-system/action-card/action-card.component.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ type Props = Omit<OmitClassName<'div'>, 'title'> & {
1818
icon: ReactNode;
1919
rootClassName?: string;
2020
iconClassName?: string;
21+
testId?: string;
2122
};
2223

2324
export const ActionCard = ({
2425
title,
2526
description = '',
2627
icon,
28+
testId,
2729
...props
2830
}: Readonly<Props>): JSX.Element => (
2931
<Box {...props} className={classNames([cx.root, props.rootClassName])}>
@@ -32,6 +34,7 @@ export const ActionCard = ({
3234
mr="$24"
3335
alignItems="center"
3436
justifyContent="center"
37+
data-testid={testId ? `${testId}-icon` : 'action-card-icon'}
3538
>
3639
{icon}
3740
</Flex>
@@ -43,14 +46,21 @@ export const ActionCard = ({
4346
weight={weight || '$medium'}
4447
color={highlight ? 'highlight' : 'primary'}
4548
key={text}
49+
data-testid={testId ? `${testId}-title` : 'action-card-title'}
4650
>
4751
{text}{' '}
4852
</Text.Body.Normal>
4953
))}
5054
</Box>
5155
{description.length > 0 && (
5256
<Box mt="$8">
53-
<Text.Body.Small weight="$medium" color="secondary">
57+
<Text.Body.Small
58+
weight="$medium"
59+
color="secondary"
60+
data-testid={
61+
testId ? `${testId}-description` : 'action-card-description'
62+
}
63+
>
5464
{description}
5565
</Text.Body.Small>
5666
</Box>

0 commit comments

Comments
 (0)