Skip to content

Commit

Permalink
refactor: update sidebar labels (#1538)
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy authored Sep 18, 2024
1 parent acab7c7 commit 32c7118
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
26 changes: 13 additions & 13 deletions src/components/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

const notificationsIcon = screen.getByTitle('0 Unread Notifications');
const notificationsIcon = screen.getByTitle('0 unread notifications');

expect(notificationsIcon.className).toContain('text-white');
expect(notificationsIcon.childNodes.length).toBe(1);
expect(notificationsIcon.childNodes[0].nodeName).toBe('svg');

fireEvent.click(screen.getByLabelText('0 Unread Notifications'));
fireEvent.click(screen.getByLabelText('0 unread notifications'));

expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
Expand All @@ -128,14 +128,14 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

const notificationsIcon = screen.getByTitle('4 Unread Notifications');
const notificationsIcon = screen.getByTitle('4 unread notifications');

expect(notificationsIcon.className).toContain(IconColor.GREEN);
expect(notificationsIcon.childNodes.length).toBe(2);
expect(notificationsIcon.childNodes[0].nodeName).toBe('svg');
expect(notificationsIcon.childNodes[1].nodeValue).toBe('4');

fireEvent.click(screen.getByLabelText('4 Unread Notifications'));
fireEvent.click(screen.getByLabelText('4 unread notifications'));

expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
Expand All @@ -161,7 +161,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

fireEvent.click(screen.getByLabelText('My Issues'));
fireEvent.click(screen.getByLabelText('My issues'));

expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
Expand All @@ -185,7 +185,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

fireEvent.click(screen.getByLabelText('My Pull Requests'));
fireEvent.click(screen.getByLabelText('My pull requests'));

expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
Expand All @@ -212,7 +212,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

fireEvent.click(screen.getByTitle('Refresh Notifications'));
fireEvent.click(screen.getByTitle('Refresh notifications'));

expect(fetchNotifications).toHaveBeenCalledTimes(1);
});
Expand All @@ -235,7 +235,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

fireEvent.click(screen.getByTitle('Refresh Notifications'));
fireEvent.click(screen.getByTitle('Refresh notifications'));

expect(fetchNotifications).not.toHaveBeenCalled();
});
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('components/Sidebar.tsx', () => {
</MemoryRouter>
</AppContext.Provider>,
);
fireEvent.click(screen.getByLabelText('4 Unread Notifications'));
fireEvent.click(screen.getByLabelText('4 unread notifications'));
expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
'https://github.com/notifications',
Expand All @@ -368,7 +368,7 @@ describe('components/Sidebar.tsx', () => {
</MemoryRouter>
</AppContext.Provider>,
);
fireEvent.click(screen.getByLabelText('My Issues'));
fireEvent.click(screen.getByLabelText('My issues'));
expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
'https://github.com/issues',
Expand All @@ -392,7 +392,7 @@ describe('components/Sidebar.tsx', () => {
</MemoryRouter>
</AppContext.Provider>,
);
fireEvent.click(screen.getByLabelText('My Pull Requests'));
fireEvent.click(screen.getByLabelText('My pull requests'));
expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
'https://github.com/pulls',
Expand Down Expand Up @@ -439,7 +439,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

const notificationsIcon = screen.getByTitle('0 Unread Notifications');
const notificationsIcon = screen.getByTitle('0 unread notifications');
expect(notificationsIcon.className).toContain('text-white');
expect(notificationsIcon.childNodes.length).toBe(1);
expect(notificationsIcon.childNodes[0].nodeName).toBe('svg');
Expand All @@ -461,7 +461,7 @@ describe('components/Sidebar.tsx', () => {
</AppContext.Provider>,
);

const notificationsIcon = screen.getByTitle('4 Unread Notifications');
const notificationsIcon = screen.getByTitle('4 unread notifications');
expect(notificationsIcon.className).toContain(IconColor.GREEN);
expect(notificationsIcon.childNodes.length).toBe(2);
expect(notificationsIcon.childNodes[0].nodeName).toBe('svg');
Expand Down
8 changes: 4 additions & 4 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ export const Sidebar: FC = () => {
</button>

<SidebarButton
title={`${notificationsCount} Unread Notifications`}
title={`${notificationsCount} unread notifications`}
metric={isLoggedIn ? notificationsCount : null}
icon={BellIcon}
onClick={() => openGitHubNotifications(primaryAccountHostname)}
/>

<SidebarButton
title="My Issues"
title="My issues"
icon={IssueOpenedIcon}
onClick={() => openGitHubIssues(primaryAccountHostname)}
/>

<SidebarButton
title="My Pull Requests"
title="My pull requests"
icon={GitPullRequestIcon}
onClick={() => openGitHubPulls(primaryAccountHostname)}
/>
Expand All @@ -106,7 +106,7 @@ export const Sidebar: FC = () => {
{isLoggedIn && (
<>
<SidebarButton
title="Refresh Notifications"
title="Refresh notifications"
icon={SyncIcon}
size={Size.MEDIUM}
loading={status === 'loading'}
Expand Down
48 changes: 24 additions & 24 deletions src/components/__snapshots__/Sidebar.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 32c7118

Please sign in to comment.