-
Notifications
You must be signed in to change notification settings - Fork 0
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
[REFACTOR] Context API를 활용하여 Modal 사용성 개선 #277
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f23bc37
refactor: Modal을 context로 관리 #272
rbgksqkr db07003
test: Modal 리팩토링을 위한 게임 시작 테스트 코드 작성 #272
rbgksqkr 016a4ea
refactor: 방장 여부 recoil 값을 넣어 렌더링하는 테스트 유틸 함수 공용화 #272
rbgksqkr 0ec6545
refactor: customRenderWithIsMaster 테스트코드 적용 #272
rbgksqkr 7aba249
refactor: 시작 버튼을 isMaster로 관리 #272
rbgksqkr 86db138
refactor: Modal Context 게임 시작 부분 적용 #272
rbgksqkr 8cf7398
refactor: Modal Context 투표 부분 적용 #272
rbgksqkr edb5f7d
refactor: Modal UI 역할이 사라져 StartButtonContainer 제거 #272
rbgksqkr f67f2f8
refactor: 게임 결과에도 Modal Context 적용 #272
rbgksqkr f620ab9
refactor: RoomSettingHeader에 Modal Context 적용 #272
rbgksqkr be3b4fd
refactor: 다른 모달도 적용할 수 있도록 Modal props 설정 #272
rbgksqkr 45dd23b
fix: modal에서 toast를 사용하므로 toast를 modal 부모 요소로 수정 #272
rbgksqkr de1957d
refactor: 다음 라운드 안내 모달 Modal Context 적용 #272
rbgksqkr e435ed1
refactor: 초대하기 모달 Modal Context 적용 #272
rbgksqkr 3de4785
refactor: 방 생성 및 참가 에러 모달 Modal Context 적용 #272
rbgksqkr cc96e08
fix: onConfirm 함수가 동작하지 않는 문제 해결 #272
rbgksqkr 618f45f
refactor: 중복된 모달 하나로 합치기 #272
rbgksqkr 34b3751
fix: Modal storybook 에 Provider 추가 #272
rbgksqkr 9ba4988
fix: Modal에서 navigate 사용하지 못하는 오류 해결 #272
rbgksqkr 9688a5e
fix: 브라우저 환경과 Provider 구조가 다른 문제 해결 #272
rbgksqkr ba0f7d8
merge: conflict 해결 #272
rbgksqkr 4ad709d
merge: conflict 해결 #272
rbgksqkr 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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
21 changes: 21 additions & 0 deletions
21
frontend/src/components/ReadyMembersContainer/ReadyMembersContainer.test.tsx
This file contains 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,21 @@ | ||
import { screen, waitFor } from '@testing-library/react'; | ||
import { userEvent } from '@testing-library/user-event'; | ||
|
||
import ReadyMembersContainer from './ReadyMembersContainer'; | ||
|
||
import { customRender } from '@/utils/test-utils'; | ||
|
||
describe('ReadyMembersContainer 테스트', () => { | ||
it('초대하기 버튼을 클릭했을 때, 초대 모달이 뜬다.', async () => { | ||
const user = userEvent.setup(); | ||
customRender(<ReadyMembersContainer />); | ||
|
||
const inviteButton = await screen.findByText('초대하기'); | ||
await user.click(inviteButton); | ||
|
||
await waitFor(() => { | ||
const copyText = screen.getByText('초대 링크 복사'); | ||
expect(copyText).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
This file contains 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 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 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 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 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
37 changes: 37 additions & 0 deletions
37
frontend/src/components/StartButtonContainer/StartButton/StartButton.test.tsx
This file contains 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,37 @@ | ||
import { screen, waitFor } from '@testing-library/react'; | ||
import { userEvent } from '@testing-library/user-event'; | ||
import { http, HttpResponse } from 'msw'; | ||
|
||
import StartButton from './StartButton'; | ||
|
||
import { ERROR_MESSAGE } from '@/constants/message'; | ||
import { MOCK_API_URL } from '@/constants/url'; | ||
import { server } from '@/mocks/server'; | ||
import { customRenderWithIsMaster } from '@/utils/test-utils'; | ||
|
||
describe('StartButton 테스트', () => { | ||
it('시작 버튼을 클릭했을 때, 게임 시작 API에서 에러가 발생하면 알림 모달이 뜬다.', async () => { | ||
const user = userEvent.setup(); | ||
server.use( | ||
http.patch(MOCK_API_URL.startGame, async () => { | ||
return HttpResponse.json( | ||
{ | ||
errorCode: 'NOT_READY_ROOM', | ||
message: ERROR_MESSAGE.NOT_READY_ROOM, | ||
}, | ||
{ status: 400 }, | ||
); | ||
}), | ||
); | ||
|
||
customRenderWithIsMaster(<StartButton />, true); | ||
|
||
const startButton = await screen.findByRole('button', { name: '시작' }); | ||
await user.click(startButton); | ||
|
||
await waitFor(() => { | ||
const closeIcon = screen.getByAltText('닫기 버튼'); | ||
expect(closeIcon).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
This file contains 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 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
13 changes: 2 additions & 11 deletions
13
frontend/src/components/StartButtonContainer/StartButtonContainer.tsx
This file contains 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
Oops, something went wrong.
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.
🌸 칭찬 🌸
이번 식으로 구현이 되는 군요. 전역 변수에 컴포넌트 자체를 담는 건 처음보네요