From 6dcc0c06a7745313318c26a6245bfd1f083e38ee Mon Sep 17 00:00:00 2001 From: m-tartari <37861893+m-tartari@users.noreply.github.com> Date: Fri, 23 May 2025 14:19:36 +0000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(atoms):=20cleanup?= =?UTF-8?q?=20unused=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/IconButton/IconButton.ts | 9 -------- src/components/atoms/IconButton/index.ts | 1 - .../atoms/IconLinks/IconLinks.test.tsx | 23 ++++--------------- src/components/atoms/IconLinks/index.ts | 1 - .../IconLinks/{IconLinks.tsx => index.tsx} | 0 src/components/atoms/index.ts | 1 - 6 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 src/components/atoms/IconButton/IconButton.ts delete mode 100644 src/components/atoms/IconButton/index.ts delete mode 100644 src/components/atoms/IconLinks/index.ts rename src/components/atoms/IconLinks/{IconLinks.tsx => index.tsx} (100%) diff --git a/src/components/atoms/IconButton/IconButton.ts b/src/components/atoms/IconButton/IconButton.ts deleted file mode 100644 index 982c1c3..0000000 --- a/src/components/atoms/IconButton/IconButton.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { IconButton as MuiIconButton, styled } from '@mui/material' - -const IconButton = styled(MuiIconButton)(({ theme }) => ({ - ':hover': { - backgroundColor: 'transparent', - color: theme.palette.primary.main, - }, -})) -export default IconButton diff --git a/src/components/atoms/IconButton/index.ts b/src/components/atoms/IconButton/index.ts deleted file mode 100644 index 9de6d2c..0000000 --- a/src/components/atoms/IconButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './IconButton' diff --git a/src/components/atoms/IconLinks/IconLinks.test.tsx b/src/components/atoms/IconLinks/IconLinks.test.tsx index 5bfb814..efef427 100644 --- a/src/components/atoms/IconLinks/IconLinks.test.tsx +++ b/src/components/atoms/IconLinks/IconLinks.test.tsx @@ -1,9 +1,8 @@ // IconLinks.test.tsx import { render, screen } from '@testing-library/react' -import userEvent from '@testing-library/user-event' -import * as IconLinks from '.' +import * as IconLinks from './index.js' const labels: { [key: string]: string } = { DescriptionIconLink: 'Doc-button', @@ -18,8 +17,6 @@ const labels: { [key: string]: string } = { vi.stubGlobal('open', vi.fn()) describe('IconLinks', () => { - const open = vi.spyOn(window, 'open') - const defaultProps = { href: 'https://test.com', fontSize: 'large' as const, @@ -28,20 +25,10 @@ describe('IconLinks', () => { describe.each(Object.entries(IconLinks))('%s', (name, Icon) => { test('renders correctly and without crashing', async () => { render() - await userEvent.click(screen.getByLabelText(labels[name])) - expect(open).toHaveBeenCalledTimes(1) - expect(open).toHaveBeenLastCalledWith(defaultProps.href, '_blank') - }) - - test('stops propagation when the icon button is clicked', async () => { - const onClick = vi.fn() - render( -
- -
- ) - await userEvent.click(screen.getByLabelText(labels[name])) - expect(onClick).not.toHaveBeenCalled() + const link = screen.getByLabelText(labels[name]) + expect(link).toHaveAttribute('href', defaultProps.href) + expect(link).toHaveAttribute('target', '_blank') + expect(link).toHaveAttribute('rel', 'noopener noreferrer') }) test("renders the badge when 'index' is provided", () => { diff --git a/src/components/atoms/IconLinks/index.ts b/src/components/atoms/IconLinks/index.ts deleted file mode 100644 index 5e3a24e..0000000 --- a/src/components/atoms/IconLinks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './IconLinks' diff --git a/src/components/atoms/IconLinks/IconLinks.tsx b/src/components/atoms/IconLinks/index.tsx similarity index 100% rename from src/components/atoms/IconLinks/IconLinks.tsx rename to src/components/atoms/IconLinks/index.tsx diff --git a/src/components/atoms/index.ts b/src/components/atoms/index.ts index b984195..39badb5 100644 --- a/src/components/atoms/index.ts +++ b/src/components/atoms/index.ts @@ -2,5 +2,4 @@ export { default as Award } from './Award' export { default as Extracurricular } from './Extracurricular' export { default as Publication } from './Publication' -export { default as IconLinks } from './IconButton' export * from './IconLinks'