Skip to content

Commit 801369e

Browse files
authored
Add in My Guardian to Follow Buttons (#13844)
* Add text for following my guardian * Add in my guardian to the follow cta * Update the tests
1 parent 3e75279 commit 801369e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

dotcom-rendering/src/components/FollowButtons.test.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,31 @@ it('should show a follow contributor button for a single contributor when render
3131
displayName="Jon Doe"
3232
/>,
3333
);
34-
expect(getByText('Follow Jon Doe')).toBeInTheDocument();
34+
expect(getByText('Follow Jon Doe in My Guardian')).toBeInTheDocument();
3535
});
3636

37-
it('should show a follow contributor button for a single contributor when rendering for apps', async () => {
37+
it('should not include the in My Guardian when the display name is longer than 21 characters in the follow action', () => {
38+
const { getByText } = render(
39+
<FollowTagButton
40+
isFollowing={false}
41+
onClickHandler={() => undefined}
42+
displayName="abcdefghijklmnopqrstuv"
43+
/>,
44+
);
45+
expect(getByText('Follow abcdefghijklmnopqrstuv')).toBeInTheDocument();
46+
});
47+
48+
it('should not include the in My Guardian when the display name is longer than 21 characters in the following action', async () => {
3849
const { getByText } = render(
3950
<FollowTagButton
4051
onClickHandler={() => undefined}
4152
isFollowing={true}
42-
displayName="Jon Doe"
53+
displayName="abcdefghijklmnopqrstuv"
4354
/>,
4455
);
4556
await waitFor(() =>
46-
expect(getByText('Following Jon Doe')).toBeInTheDocument(),
57+
expect(
58+
getByText('Following abcdefghijklmnopqrstuv'),
59+
).toBeInTheDocument(),
4760
);
4861
});

dotcom-rendering/src/components/FollowButtons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ const tagTextSpan = ({
7979
displayName?: string;
8080
}) => (
8181
<span>
82-
{isFollowing ? 'Following' : 'Follow'} {displayName}
82+
{isFollowing ? 'Following' : 'Follow'} {displayName}{' '}
83+
{displayName && displayName.length < 21 ? 'in My Guardian' : ''}
8384
</span>
8485
);
8586

0 commit comments

Comments
 (0)