Skip to content

Commit

Permalink
refactor: update sidebar labels
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy committed Sep 17, 2024
1 parent 25faf92 commit 2072b27
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 @@ -102,13 +102,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 @@ -132,14 +132,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 @@ -165,7 +165,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 @@ -189,7 +189,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 @@ -216,7 +216,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 @@ -239,7 +239,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 @@ -348,7 +348,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 @@ -372,7 +372,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 @@ -396,7 +396,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 @@ -443,7 +443,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 @@ -465,7 +465,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 @@ -85,20 +85,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 @@ -108,7 +108,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 2072b27

Please sign in to comment.