diff --git a/src/components/molecules/Button/index.module.scss b/src/components/molecules/Button/index.module.scss index 6762201..7c26d5c 100644 --- a/src/components/molecules/Button/index.module.scss +++ b/src/components/molecules/Button/index.module.scss @@ -1,7 +1,4 @@ .button { - display: flex; - align-items: center; - justify-content: center; border-radius: 8px; height: 40px; font-weight: bold; @@ -16,7 +13,6 @@ border-color 0.3s ease-in-out, opacity 0.3s ease-in-out; white-space: nowrap; - flex-direction: row; text-align: center; &.menu { diff --git a/src/components/molecules/Button/index.test.tsx b/src/components/molecules/Button/index.test.tsx new file mode 100644 index 0000000..8ebfb2c --- /dev/null +++ b/src/components/molecules/Button/index.test.tsx @@ -0,0 +1,36 @@ +import { render, screen } from '@testing-library/react'; + +import Button from './index'; + +describe('Button', () => { + it('renders a native button with disabled state', () => { + render( + , + ); + + const button = screen.getByRole('button', { name: '지원하기' }); + + expect(button).toBeDisabled(); + expect(button).toHaveAttribute('aria-disabled', 'true'); + }); + + it('renders an external link with safe link attributes', () => { + render( + , + ); + + const link = screen.getByRole('link', { name: '지원하기' }); + + expect(link).toHaveAttribute('href', 'https://example.com/apply'); + expect(link).toHaveAttribute('target', '_blank'); + expect(link).toHaveAttribute('rel', 'noopener noreferrer'); + }); +}); diff --git a/src/components/molecules/Button/index.tsx b/src/components/molecules/Button/index.tsx index ddd7654..3fbfe98 100644 --- a/src/components/molecules/Button/index.tsx +++ b/src/components/molecules/Button/index.tsx @@ -3,6 +3,7 @@ import { ComponentProps, ReactNode } from 'react'; import { Route } from 'next'; import Link, { LinkProps } from 'next/link'; +import { Flex } from '@sipe-team/side'; import clsx from 'clsx'; import styles from './index.module.scss'; @@ -62,24 +63,28 @@ function Button< >; return ( - + + + ); } return ( -