From 177009f4b5a15258a2d99ef56ff987a666b24327 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy Date: Sat, 28 Oct 2023 10:17:46 +0200 Subject: [PATCH] update --- .../Common/ThemeToggle/__tests__/index.test.mjs | 7 +------ components/Common/ThemeToggle/index.tsx | 13 ++++--------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/components/Common/ThemeToggle/__tests__/index.test.mjs b/components/Common/ThemeToggle/__tests__/index.test.mjs index b313cc6a5ef4d..05016d908e38f 100644 --- a/components/Common/ThemeToggle/__tests__/index.test.mjs +++ b/components/Common/ThemeToggle/__tests__/index.test.mjs @@ -17,7 +17,7 @@ beforeEach(() => { mockCurrentTheme = 'light'; render( - + ); toggle = screen.getByRole('button'); @@ -34,9 +34,4 @@ describe('ThemeToggle component', () => { await userEvent.click(toggle); expect(mockCurrentTheme).toBe('dark'); }); - - it('switch when press enter', async () => { - await userEvent.type(toggle, '{enter}'); - expect(mockCurrentTheme).toBe('dark'); - }); }); diff --git a/components/Common/ThemeToggle/index.tsx b/components/Common/ThemeToggle/index.tsx index 749583bde85b5..cbdbce98d2420 100644 --- a/components/Common/ThemeToggle/index.tsx +++ b/components/Common/ThemeToggle/index.tsx @@ -1,24 +1,19 @@ import { MoonIcon, SunIcon } from '@heroicons/react/24/outline'; import { AccessibleIcon } from '@radix-ui/react-accessible-icon'; -import type { FC } from 'react'; +import type { FC, MouseEvent } from 'react'; import { useIntl } from 'react-intl'; import styles from './index.module.css'; type ThemeToggleProps = { - onChange: () => void; + onClick: (event: MouseEvent) => void; }; -const ThemeToggle: FC = ({ onChange }) => { +const ThemeToggle: FC = ({ onClick }) => { const intl = useIntl(); return ( -