Skip to content

Commit 3d3aaec

Browse files
authored
Merge pull request #120 from input-output-hk/test/add-infobar-testids
test: add testIds for info-bar component
2 parents 0fa3c2a + 6c90f1c commit 3d3aaec

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/design-system/info-bar/info-bar.component.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,29 @@ export interface Props {
1515
label?: string;
1616
onClick?: () => void;
1717
};
18+
testId?: string;
1819
}
1920

2021
export const InfoBar = ({
2122
message,
2223
icon,
2324
callToAction,
25+
testId,
2426
}: Readonly<Props>): JSX.Element => {
2527
return (
2628
<Flex className={cx.container}>
27-
<Box className={cx.icon}>{icon}</Box>
29+
<Box
30+
className={cx.icon}
31+
data-testid={testId ? `${testId}-icon` : 'info-bar-icon'}
32+
>
33+
{icon}
34+
</Box>
2835
<Box>
29-
<Text.Button weight="$semibold" className={cx.message}>
36+
<Text.Button
37+
weight="$semibold"
38+
className={cx.message}
39+
data-testid={testId ? `${testId}-message` : 'info-bar-message'}
40+
>
3041
{message}
3142
</Text.Button>
3243
</Box>
@@ -36,6 +47,7 @@ export const InfoBar = ({
3647
<CallToAction
3748
onClick={callToAction.onClick}
3849
label={callToAction.label}
50+
data-testid={testId ? `${testId}-cta` : 'info-bar-cta'}
3951
/>
4052
</Box>
4153
)}

0 commit comments

Comments
 (0)