-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: migrate responsive Flex layouts #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
KYBee
wants to merge
7
commits into
refact/flex-migration-user-active-cards
Choose a base branch
from
refact/responsive-flex-migration
base: refact/flex-migration-user-active-cards
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eef94d2
refactor: migrate shared responsive Flex layouts
KYBee f56bf9a
refactor: migrate About responsive Flex layouts
KYBee ea030ad
refactor: migrate Activity responsive Flex layouts
KYBee b32e12b
refactor: migrate Home and People responsive Flex layouts
KYBee 6b68131
test: enforce responsive Flex migration contract
KYBee d75d8e5
test: align component test mocks
KYBee 20e43ae
test: remove brittle Flex migration contract
KYBee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { ReactNode } from 'react'; | ||
|
|
||
| import { render, screen } from '@testing-library/react'; | ||
|
|
||
| import Footer from './index'; | ||
|
|
||
| vi.mock('@/components/atoms/Layout', () => ({ | ||
| default: ({ children }: { children: ReactNode }) => ( | ||
| <div data-testid="layout">{children}</div> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock('@/components/molecules/SocialIconLink', () => ({ | ||
| default: ({ type, url }: { type: string; url: string }) => ( | ||
| <a href={url}>{type}</a> | ||
| ), | ||
| })); | ||
|
|
||
| describe('Footer', () => { | ||
| it('renders the footer copyright and social links', () => { | ||
| render(<Footer />); | ||
|
|
||
| expect(screen.getByRole('contentinfo')).toBeInTheDocument(); | ||
| expect(screen.getByText('All rights reserved ⓒ SIPE')).toBeInTheDocument(); | ||
| expect(screen.getByRole('link', { name: 'INSTAGRAM' })).toHaveAttribute( | ||
| 'href', | ||
| 'https://www.instagram.com/sipe_team', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'GITHUB' })).toHaveAttribute( | ||
| 'href', | ||
| 'https://github.com/sipe-team', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'YOUTUBE' })).toHaveAttribute( | ||
| 'href', | ||
| 'https://www.youtube.com/@sipe_team', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'LINKEDIN' })).toHaveAttribute( | ||
| 'href', | ||
| 'https://www.linkedin.com/company/sipe.team', | ||
| ); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| import type { ReactNode } from 'react'; | ||
|
|
||
| import { fireEvent, render, screen } from '@testing-library/react'; | ||
|
|
||
| import Navigation from './index'; | ||
|
|
||
| const { sendGAEvent } = vi.hoisted(() => ({ | ||
| sendGAEvent: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock('next/link', () => ({ | ||
| default: ({ children, href }: { children: ReactNode; href: string }) => ( | ||
| <a href={href}>{children}</a> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock('next/navigation', () => ({ | ||
| usePathname: () => '/about', | ||
| })); | ||
|
|
||
| vi.mock('@next/third-parties/google', () => ({ | ||
| sendGAEvent, | ||
| })); | ||
|
|
||
| vi.mock('@/components/atoms/Layout', () => ({ | ||
| default: ({ | ||
| children, | ||
| className, | ||
| }: { | ||
| children: ReactNode; | ||
| className?: string; | ||
| }) => <div className={className}>{children}</div>, | ||
| })); | ||
|
|
||
| vi.mock('@/components/global/HamburgerButton', () => ({ | ||
| default: ({ | ||
| isOpened, | ||
| onClick, | ||
| }: { | ||
| isOpened: boolean; | ||
| onClick: () => void; | ||
| }) => ( | ||
| <button aria-expanded={isOpened} aria-label="메뉴" onClick={onClick}> | ||
| 메뉴 | ||
| </button> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock('@/components/molecules/Button', () => ({ | ||
| default: ({ | ||
| active, | ||
| children, | ||
| disabled, | ||
| href, | ||
| onClick, | ||
| }: { | ||
| active?: boolean; | ||
| children: ReactNode; | ||
| disabled?: boolean; | ||
| href?: string; | ||
| onClick?: () => void; | ||
| }) => ( | ||
| <a | ||
| aria-current={active ? 'page' : undefined} | ||
| aria-disabled={disabled} | ||
| href={href} | ||
| onClick={(event) => { | ||
| event.preventDefault(); | ||
| onClick?.(); | ||
| }} | ||
| > | ||
| {children} | ||
| </a> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock('@/libs/assets/logos', () => ({ | ||
| SipeLogo: () => <svg aria-label="사이프 로고" />, | ||
| })); | ||
|
|
||
| vi.mock('@/libs/utils/recruit', () => ({ | ||
| displayApplication: { | ||
| ongoing: { | ||
| buttonText: '지원하기', | ||
| formUrl: 'https://example.com/apply', | ||
| }, | ||
| }, | ||
| getCurrentStatus: () => 'ongoing', | ||
| })); | ||
|
|
||
| describe('Navigation', () => { | ||
| beforeEach(() => { | ||
| sendGAEvent.mockClear(); | ||
| }); | ||
|
|
||
| it('renders the current menu, navigation links, and application link', () => { | ||
| render(<Navigation />); | ||
|
|
||
| expect(screen.getByRole('banner')).toBeInTheDocument(); | ||
| expect(screen.getByRole('navigation')).toBeInTheDocument(); | ||
| expect(screen.getByLabelText('사이프 로고').closest('a')).toHaveAttribute( | ||
| 'href', | ||
| '/', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'About' })).toHaveAttribute( | ||
| 'aria-current', | ||
| 'page', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'Recruit' })).toHaveAttribute( | ||
| 'href', | ||
| '/recruit', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'People' })).toHaveAttribute( | ||
| 'href', | ||
| '/people', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'Activity' })).toHaveAttribute( | ||
| 'href', | ||
| '/activity', | ||
| ); | ||
| expect(screen.getByRole('link', { name: 'Join Us' })).toHaveAttribute( | ||
| 'href', | ||
| 'https://example.com/apply', | ||
| ); | ||
| }); | ||
|
|
||
| it('toggles the mobile menu and reports application clicks', () => { | ||
| render(<Navigation />); | ||
|
|
||
| const menuButton = screen.getByRole('button', { name: '메뉴' }); | ||
| expect(menuButton).toHaveAttribute('aria-expanded', 'false'); | ||
|
|
||
| fireEvent.click(menuButton); | ||
| expect(menuButton).toHaveAttribute('aria-expanded', 'true'); | ||
|
|
||
| fireEvent.click(screen.getByRole('link', { name: 'Join Us' })); | ||
| expect(sendGAEvent).toHaveBeenCalledWith('event', 'cilck_join_us_button', { | ||
| screen_name: 'menu', | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
|
|
||
| import Table from './index'; | ||
|
|
||
| vi.mock('@/components/atoms/Badge', () => ({ | ||
| default: ({ text }: { text: string }) => <span>{text}</span>, | ||
| })); | ||
|
|
||
| vi.mock('@/components/molecules/GlowArea', () => ({ | ||
| default: ({ children }: { children: React.ReactNode }) => ( | ||
| <div data-testid="glow-area">{children}</div> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock('@/libs/assets/icons', () => ({ | ||
| CheckCircleIcon: () => <svg aria-label="지원 조건 충족" />, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분도 다른 테스트와 동일하게 |
||
| })); | ||
|
|
||
| describe('Table', () => { | ||
| it('renders recurring dates, descriptions, and badges for schedule rows', () => { | ||
| render( | ||
| <Table | ||
| isApplicant={false} | ||
| dataList={[ | ||
| { | ||
| recurring_date: '매주 목요일', | ||
| text: '정기 세션 참여', | ||
| badge: '필수', | ||
| }, | ||
| { | ||
| recurring_date: '격주 토요일', | ||
| text: '네트워킹 참여', | ||
| highlight: true, | ||
| }, | ||
| ]} | ||
| />, | ||
| ); | ||
|
|
||
| expect(screen.getByText('매주 목요일')).toBeInTheDocument(); | ||
| expect(screen.getByText('정기 세션 참여')).toBeInTheDocument(); | ||
| expect(screen.getByText('필수')).toBeInTheDocument(); | ||
| expect(screen.getByText('격주 토요일')).toBeInTheDocument(); | ||
| expect(screen.getByText('네트워킹 참여')).toBeInTheDocument(); | ||
| expect(screen.getByTestId('glow-area')).toHaveTextContent('네트워킹 참여'); | ||
| }); | ||
|
|
||
| it('renders applicant rows with check icons and without schedule metadata', () => { | ||
| render( | ||
| <Table | ||
| isApplicant | ||
| dataList={[ | ||
| { | ||
| recurring_date: '표시되지 않는 날짜', | ||
| text: '개발 경험이 있는 분', | ||
| badge: '표시되지 않는 배지', | ||
| }, | ||
| ]} | ||
| />, | ||
| ); | ||
|
|
||
| expect(screen.getByLabelText('지원 조건 충족')).toBeInTheDocument(); | ||
| expect(screen.getByText('개발 경험이 있는 분')).toBeInTheDocument(); | ||
| expect(screen.queryByText('표시되지 않는 날짜')).not.toBeInTheDocument(); | ||
| expect(screen.queryByText('표시되지 않는 배지')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 아래에 있는,
RecruitmentStatusSection/index.test.tsx 에서,
쓰는 것처럼 통일해서 쓰는 건 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀 주신 방식으로 통일하겠습니다.
@next/third-parties/google에서sendGAEvent를 import하고, mock에는vi.fn()을 직접 선언한 뒤vi.mocked(sendGAEvent).mockClear()로 초기화하도록 수정하겠습니다.