♻️ refactor(atoms): cleanup unused files

This commit is contained in:
2025-05-23 14:19:36 +00:00
parent 664837208f
commit 6dcc0c06a7
6 changed files with 5 additions and 30 deletions
@@ -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
-1
View File
@@ -1 +0,0 @@
export { default } from './IconButton'
@@ -1,9 +1,8 @@
// IconLinks.test.tsx // IconLinks.test.tsx
import { render, screen } from '@testing-library/react' 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 } = { const labels: { [key: string]: string } = {
DescriptionIconLink: 'Doc-button', DescriptionIconLink: 'Doc-button',
@@ -18,8 +17,6 @@ const labels: { [key: string]: string } = {
vi.stubGlobal('open', vi.fn()) vi.stubGlobal('open', vi.fn())
describe('IconLinks', () => { describe('IconLinks', () => {
const open = vi.spyOn(window, 'open')
const defaultProps = { const defaultProps = {
href: 'https://test.com', href: 'https://test.com',
fontSize: 'large' as const, fontSize: 'large' as const,
@@ -28,20 +25,10 @@ describe('IconLinks', () => {
describe.each(Object.entries(IconLinks))('%s', (name, Icon) => { describe.each(Object.entries(IconLinks))('%s', (name, Icon) => {
test('renders correctly and without crashing', async () => { test('renders correctly and without crashing', async () => {
render(<Icon {...defaultProps} />) render(<Icon {...defaultProps} />)
await userEvent.click(screen.getByLabelText(labels[name])) const link = screen.getByLabelText(labels[name])
expect(open).toHaveBeenCalledTimes(1) expect(link).toHaveAttribute('href', defaultProps.href)
expect(open).toHaveBeenLastCalledWith(defaultProps.href, '_blank') expect(link).toHaveAttribute('target', '_blank')
}) expect(link).toHaveAttribute('rel', 'noopener noreferrer')
test('stops propagation when the icon button is clicked', async () => {
const onClick = vi.fn()
render(
<div onClick={onClick}>
<Icon {...defaultProps} />
</div>
)
await userEvent.click(screen.getByLabelText(labels[name]))
expect(onClick).not.toHaveBeenCalled()
}) })
test("renders the badge when 'index' is provided", () => { test("renders the badge when 'index' is provided", () => {
-1
View File
@@ -1 +0,0 @@
export * from './IconLinks'
-1
View File
@@ -2,5 +2,4 @@ export { default as Award } from './Award'
export { default as Extracurricular } from './Extracurricular' export { default as Extracurricular } from './Extracurricular'
export { default as Publication } from './Publication' export { default as Publication } from './Publication'
export { default as IconLinks } from './IconButton'
export * from './IconLinks' export * from './IconLinks'