Skip to content

Commit 706f570

Browse files
committed
test: update test cases
Signed-off-by: Adam Setch <[email protected]>
1 parent 360b0f3 commit 706f570

File tree

11 files changed

+3581
-2200
lines changed

11 files changed

+3581
-2200
lines changed

src/renderer/components/buttons/PillButton.test.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IconColor } from '../../types';
44
import { type IPillButton, PillButton } from './PillButton';
55

66
describe('renderer/components/buttons/PillButton.tsx', () => {
7-
it('should render', () => {
7+
it('should render with metric', () => {
88
const props: IPillButton = {
99
title: 'Mock Pill',
1010
metric: 1,
@@ -14,4 +14,14 @@ describe('renderer/components/buttons/PillButton.tsx', () => {
1414
const tree = render(<PillButton {...props} />);
1515
expect(tree).toMatchSnapshot();
1616
});
17+
18+
it('should render without metric', () => {
19+
const props: IPillButton = {
20+
title: 'Mock Pill',
21+
icon: MarkGithubIcon,
22+
color: IconColor.GREEN,
23+
};
24+
const tree = render(<PillButton {...props} />);
25+
expect(tree).toMatchSnapshot();
26+
});
1727
});

src/renderer/components/buttons/PillButton.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import type { Icon } from '@primer/octicons-react';
21
import type { FC } from 'react';
2+
3+
import type { Icon } from '@primer/octicons-react';
4+
import { Octicon, Stack, Text } from '@primer/react';
5+
36
import { type IconColor, Size } from '../../types';
47

58
export interface IPillButton {
@@ -17,12 +20,10 @@ export const PillButton: FC<IPillButton> = (props: IPillButton) => {
1720
type="button"
1821
className="flex gap-1 items-center m-0.5 rounded-full bg-gray-100 px-1 text-xxs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700"
1922
>
20-
<props.icon
21-
size={Size.XSMALL}
22-
className={props.color}
23-
aria-label={props.title}
24-
/>
25-
{props.metric}
23+
<Stack direction="horizontal" align="center" gap="condensed">
24+
<Octicon icon={props.icon} size={Size.XSMALL} className={props.color} />
25+
{props.metric && <Text>{props.metric}</Text>}
26+
</Stack>
2627
</button>
2728
);
2829
};

src/renderer/components/buttons/__snapshots__/PillButton.test.tsx.snap

Lines changed: 169 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/notifications/AccountNotifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const AccountNotifications: FC<IAccountNotifications> = (
8484
)}
8585
onClick={toggleAccountNotifications}
8686
>
87-
<Tooltip text="Open profile" direction="s">
87+
<Tooltip text="Open profile" direction="e">
8888
<Button
8989
variant="invisible"
9090
alignContent="center"

src/renderer/components/notifications/NotificationFooter.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { FC, MouseEvent } from 'react';
22

33
import { FeedPersonIcon, MarkGithubIcon } from '@primer/octicons-react';
4-
import { Avatar, Tooltip } from '@primer/react';
4+
import { Avatar } from '@primer/react';
55

66
import { IconColor, Opacity, Size } from '../../types';
77
import type { Notification } from '../../typesGitHub';
@@ -29,21 +29,17 @@ export const NotificationFooter: FC<INotificationFooter> = ({
2929
<div className="flex flex-wrap items-center gap-1">
3030
<div className="mb-1">
3131
{notification.subject.user ? (
32-
<Tooltip
33-
text={`View profile: ${notification.subject.user.login}`}
34-
direction="ne"
35-
>
36-
<Avatar
37-
src={notification.subject.user.avatar_url}
38-
size={Size.SMALL}
39-
onClick={(event: MouseEvent<HTMLElement>) => {
40-
// Don't trigger onClick of parent element.
41-
event.stopPropagation();
42-
openUserProfile(notification.subject.user);
43-
}}
44-
data-testid="view-profile"
45-
/>
46-
</Tooltip>
32+
<Avatar
33+
title={`View profile: ${notification.subject.user.login}`}
34+
src={notification.subject.user.avatar_url}
35+
size={Size.SMALL}
36+
onClick={(event: MouseEvent<HTMLElement>) => {
37+
// Don't trigger onClick of parent element.
38+
event.stopPropagation();
39+
openUserProfile(notification.subject.user);
40+
}}
41+
data-testid="view-profile"
42+
/>
4743
) : (
4844
<div>
4945
{notification.subject.type === 'RepositoryDependabotAlertsThread' ||

src/renderer/components/notifications/NotificationHeader.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type FC, type MouseEvent, useContext } from 'react';
22

3-
import { Avatar, Link, Stack, Tooltip } from '@primer/react';
3+
import { Avatar, Stack, Tooltip } from '@primer/react';
44

55
import { AppContext } from '../../context/App';
66
import { Size } from '../../types';
@@ -24,8 +24,7 @@ export const NotificationHeader: FC<INotificationHeader> = ({
2424
return (
2525
groupByDate && (
2626
<Tooltip text={`View repository: ${repoSlug}`} direction="se">
27-
<Link
28-
muted
27+
<div
2928
onClick={(event: MouseEvent<HTMLElement>) => {
3029
// Don't trigger onClick of parent element.
3130
event.stopPropagation();
@@ -37,7 +36,7 @@ export const NotificationHeader: FC<INotificationHeader> = ({
3736
<Avatar src={repoAvatarUrl} size={Size.SMALL} />
3837
<span className="text-xs font-medium">{repoSlug}</span>
3938
</Stack>
40-
</Link>
39+
</div>
4140
</Tooltip>
4241
)
4342
);

0 commit comments

Comments
 (0)