Skip to content

Commit c80cf28

Browse files
authored
Merge pull request #46 from input-output-hk/feat/add-test-id-lw-10959
feat: add test ids for tokens table list lw-10959
2 parents 6fca8b4 + 788ef80 commit c80cf28

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/design-system/assets-table/assets-table-token-amount.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export const TokenAmount = ({
1616
}: Readonly<Props>): JSX.Element => {
1717
return (
1818
<Flex flexDirection="column" alignItems="flex-end" className={cx.container}>
19-
<Text.Body.Large weight="$semibold">{amount}</Text.Body.Large>
19+
<Text.Body.Large weight="$semibold" data-testid="token-amount">
20+
{amount}
21+
</Text.Body.Large>
2022
<Text.Body.Normal color="secondary" weight="$semibold">
2123
{fiatPrice}
2224
</Text.Body.Normal>

src/design-system/assets-table/assets-table-token-profile.component.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,33 @@ interface Props {
1111
imageSrc: string;
1212
name: string;
1313
description: string;
14+
testId?: string;
1415
}
1516

1617
export const TokenProfile = ({
1718
imageSrc,
1819
name,
1920
description,
21+
testId = 'token-profile',
2022
}: Readonly<Props>): JSX.Element => {
2123
return (
2224
<div className={cx.container}>
2325
<Grid columns="$fitContent" gutters="$0">
2426
<Cell>
2527
<Box mr="$24">
26-
<Image imageSrc={imageSrc} alt={name} />
28+
<Image imageSrc={imageSrc} alt={name} testId={`${testId}-icon`} />
2729
</Box>
2830
</Cell>
2931
<Cell>
30-
<Text.Body.Large weight="$semibold">{name}</Text.Body.Large>
32+
<Text.Body.Large weight="$semibold" data-testid={`${testId}-name`}>
33+
{name}
34+
</Text.Body.Large>
3135
<Box>
32-
<Text.Body.Normal color="secondary" weight="$semibold">
36+
<Text.Body.Normal
37+
color="secondary"
38+
weight="$semibold"
39+
data-testid={`${testId}-ticker`}
40+
>
3341
{description}
3442
</Text.Body.Normal>
3543
</Box>

src/design-system/profile-picture/image.component.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface Props {
1212
alt?: string;
1313
delayMs?: number;
1414
selected?: boolean;
15+
testId?: string;
1516
}
1617

1718
export const Image = ({
@@ -20,13 +21,19 @@ export const Image = ({
2021
alt,
2122
delayMs = 600,
2223
selected,
24+
testId = 'profile-picture',
2325
}: Readonly<Props>): JSX.Element => (
2426
<RadixUIAvatar.Root
2527
className={classNames(cx.root, cx.container, {
2628
[cx.selected]: selected,
2729
})}
2830
>
29-
<RadixUIAvatar.Image className={cx.image} src={imageSrc} alt={alt} />
31+
<RadixUIAvatar.Image
32+
className={cx.image}
33+
src={imageSrc}
34+
alt={alt}
35+
data-testid={testId}
36+
/>
3037
<RadixUIAvatar.Fallback delayMs={delayMs}>
3138
{fallback}
3239
</RadixUIAvatar.Fallback>

0 commit comments

Comments
 (0)