Skip to content

Commit 624594d

Browse files
authored
feat(settings): display username on logout hover (#969)
1 parent 4ba9afd commit 624594d

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/routes/Settings.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ describe('routes/Settings.tsx', () => {
4747

4848
it('should press the logout', async () => {
4949
const logoutMock = jest.fn();
50-
let getByTitle;
50+
let getByRole;
5151

5252
await act(async () => {
53-
const { getByTitle: getByLabelTextLocal } = render(
53+
const { getByRole: getByRoleLocal } = render(
5454
<AppContext.Provider
5555
value={{
5656
settings: mockSettings,
@@ -64,10 +64,10 @@ describe('routes/Settings.tsx', () => {
6464
</AppContext.Provider>,
6565
);
6666

67-
getByTitle = getByLabelTextLocal;
67+
getByRole = getByRoleLocal;
6868
});
6969

70-
fireEvent.click(getByTitle('Logout'));
70+
fireEvent.click(getByRole('Logout'));
7171

7272
expect(logoutMock).toHaveBeenCalledTimes(1);
7373

src/routes/Settings.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,14 @@ export const SettingsRoute: React.FC = () => {
238238

239239
<button
240240
className={footerButtonClass}
241-
title="Logout"
241+
title={`Logout ${accounts.user.login}`}
242+
role="Logout"
242243
onClick={logoutUser}
243244
>
244-
<SignOutIcon size={18} aria-label="Logout" />
245+
<SignOutIcon
246+
size={18}
247+
aria-label={`Logout ${accounts.user.login}`}
248+
/>
245249
</button>
246250

247251
<button

src/routes/__snapshots__/Settings.test.tsx.snap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,11 @@ exports[`routes/Settings.tsx should render itself & its children 1`] = `
412412
</button>
413413
<button
414414
class="hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none"
415-
title="Logout"
415+
role="Logout"
416+
title="Logout octocat"
416417
>
417418
<svg
418-
aria-label="Logout"
419+
aria-label="Logout octocat"
419420
class="octicon octicon-sign-out"
420421
fill="currentColor"
421422
focusable="false"

0 commit comments

Comments
 (0)