Skip to content
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

[ Feature/quiz 19 ] #27

Merged
merged 29 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cf62b24
feat : common 폴더에 λŒ€ν•œ path 경둜 μΆ”κ°€
Happhee Jun 5, 2024
895a110
docs : ν•„μš”μ—†λŠ” 파일 μ‚­μ œ
Happhee Jun 5, 2024
7301e42
init : jest μ‚­μ œ 이후 vitest ν™˜κ²½ ꡬ좕
Happhee Jun 6, 2024
95c1576
feat : vitest config , setup 파일 μž‘μ„±
Happhee Jun 6, 2024
71644d5
fix : vitest둜 μ½”λ“œ λ³€κ²½
Happhee Jun 6, 2024
80a72bd
fix : vitest둜 λ³€κ²½
Happhee Jun 6, 2024
b7e9886
docs : ν•„μš”μ—†λŠ” 파일 μ‚­μ œ
Happhee Jun 7, 2024
2e2c4c8
fix : vitest μ‚¬μš©μ‹œ component 경둜 찾을 수 μžˆλ„λ‘ 버그 μˆ˜μ •
Happhee Jun 7, 2024
fdd9d88
feat : vi λͺ¨ν‚Ήν•˜λŠ” λͺ¨λ“ˆ ν…ŒμŠ€νŠΈ μ•žλ’€λ‘œ clear, reset ν•˜λ„λ‘ μ„€μ •
Happhee Jun 7, 2024
2be1408
fix : ν•„μš”μ—†λŠ” story book 경둜 좔적 μ‚­μ œ
Happhee Jun 7, 2024
f642733
feat : ν€΄μ¦ˆ ν’€λ•Œ λ²„νŠΌμ˜ 타이틀λͺ…, class속성 μ œμ–΄ν•˜κ³ μž context νƒ€μž…λ° κ΅¬ν˜„
Happhee Jun 7, 2024
1c7c960
feat : ν€΄μ¦ˆ νŽ˜μ΄μ§€ λ‚΄μ˜ ν•˜λ‹¨ context λ²„νŠΌ κ΅¬ν˜„
Happhee Jun 7, 2024
63e0bd4
test : μ •λ‹΅ 선택에 λ”°λ₯Έ ν€΄μ¦ˆ ν•˜λ‹¨ λ²„νŠΌ ν…ŒμŠ€νŠΈ κ΅¬ν˜„
Happhee Jun 7, 2024
c1c805f
feat : 아티클 및 ν€΄μ¦ˆ νŽ˜μ΄μ§€ λ’€λ‘œκ°€κΈ° topbar 곡톡 μ»΄ν¬λ„ŒνŠΈ κ΅¬ν˜„
Happhee Jun 7, 2024
fce4b5a
test : topBar - κΈ°λ³Έ render story κ΅¬ν˜„
Happhee Jun 7, 2024
641da4b
feat : storybookμ—μ„œ svgμ‚¬μš©ν• μˆ˜ μžˆλ„λ‘ κ΅¬ν˜„
Happhee Jun 7, 2024
d366746
feat : ν€΄μ¦ˆ νŽ˜μ΄μ§€ λ ˆμ΄μ•„μ›ƒ κ΅¬ν˜„
Happhee Jun 7, 2024
89922e4
feat : ν€΄μ¦ˆ νŽ˜μ΄μ§€ λ ˆμ΄μ•„μ›ƒ λ‚΄λΆ€ νŽ˜μ΄μ§€ κ΅¬ν˜„
Happhee Jun 7, 2024
b86aba1
feat : storybookμ—μ„œ next/router import 와 react query μ‚¬μš©κ°€λŠ₯ν•˜λ„λ‘ κ΅¬ν˜„
Happhee Jun 7, 2024
4e0c45c
test : ν€΄μ¦ˆ 제좜 λ²„νŠΌ story κ΅¬ν˜„
Happhee Jun 7, 2024
6f307ed
fix : navigation으둜 λ³€κ²½
Happhee Jun 7, 2024
a7984c4
docs : ν€΄μ¦ˆ contextinfo둜 파일λͺ… λ³€κ²½
Happhee Jun 7, 2024
b52175a
feat : μ •λ‹΅ λ²„νŠΌ κ΄€λ ¨ νƒ€μž… κ΅¬ν˜„
Happhee Jun 7, 2024
40d3cea
feat : μ •λ‹΅ λ²„νŠΌ κ΄€λ ¨ μƒμˆ˜ κ΅¬ν˜„
Happhee Jun 7, 2024
d5669ac
refactor : μ •λ‹΅λ²„νŠΌ κ΄€λ ¨ μƒμˆ˜ μ‚¬μš©ν•΄μ„œ ν…ŒμŠ€νŠΈ μ½”λ“œ 및 component에 μ μš©ν•˜λ„λ‘ λ¦¬νŒ©ν† λ§
Happhee Jun 7, 2024
0ff60d8
feat : vitest config , setup 파일 μž‘μ„±
Happhee Jun 6, 2024
40852f8
fix : vitest둜 μ½”λ“œ λ³€κ²½
Happhee Jun 6, 2024
6da4f1d
fix : vitest둜 μ½”λ“œ λ³€κ²½
Happhee Jun 6, 2024
d2c19ce
fix : vitest둜 μ½”λ“œ λ³€κ²½
Happhee Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/common/components/TagList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react";

export default function TagList() {
return <div></div>;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ–œ λ¬΄μ‹œν•΄μ£Όμ„Έμš” γ… .γ… γ… .

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { ReactElement } from "react";

import { describe, expect, it, vi } from "vitest";

import { BUTTON_INFO } from "@quiz/constants/answerButtonInfo";
import QuizContext from "@quiz/context/quizContext";
import { QuizContextInfo } from "@quiz/types";
import { QuizContextInfo } from "@quiz/types/quizContextInfo";

import AnswerContextButton from ".";
import { render, screen } from "@testing-library/react";
Expand Down Expand Up @@ -37,26 +38,45 @@ describe("ν€΄μ¦ˆ ν‘ΈλŠ” ν•˜λ‹¨ λ²„νŠΌ, μ •λ‹΅ 선택에 λ”°λ₯Έ ν…ŒμŠ€νŠΈ", () =>
states: { answer: null, isSubmit: false },
...defaultActions,
});
expect(screen.getByText("μ •λ‹΅ μ œμΆœν•˜κΈ°")).toBeInTheDocument();
expect(screen.getByRole("button")).toHaveClass(
"bg-text-gray3 text-text-gray2",
);
if (BUTTON_INFO.PRE_ANSWER_SELECT.title)
expect(
screen.getByText(BUTTON_INFO.PRE_ANSWER_SELECT.title),
).toBeInTheDocument();

if (BUTTON_INFO.PRE_ANSWER_SELECT.className)
expect(screen.getByRole("button")).toHaveClass(
BUTTON_INFO.PRE_ANSWER_SELECT.className,
);
});
it("μ •λ‹΅ 선택 ν›„ μƒνƒœ", () => {
renderWithContext({
states: { answer: "μ •λ‹΅!!", isSubmit: false },
...defaultActions,
});
expect(screen.getByText("μ •λ‹΅ μ œμΆœν•˜κΈ°")).toBeInTheDocument();
expect(screen.getByRole("button")).toHaveClass("bg-main");
if (BUTTON_INFO.POST_ANSWER_PRE_SUBMIT.title)
expect(
screen.getByText(BUTTON_INFO.POST_ANSWER_PRE_SUBMIT.title),
).toBeInTheDocument();

if (BUTTON_INFO.POST_ANSWER_PRE_SUBMIT.className)
expect(screen.getByRole("button")).toHaveClass(
BUTTON_INFO.POST_ANSWER_PRE_SUBMIT.className,
);
});

it("μ •λ‹΅ 선택 ν›„ μƒνƒœ", () => {
renderWithContext({
states: { answer: "μ •λ‹΅!!", isSubmit: true },
...defaultActions,
});
expect(screen.getByText("λ‹€μŒ 문제 ν’€κΈ°")).toBeInTheDocument();
expect(screen.getByRole("button")).toHaveClass("bg-text-black");
if (BUTTON_INFO.POST_SUBMIT.title)
expect(
screen.getByText(BUTTON_INFO.POST_SUBMIT.title),
).toBeInTheDocument();

if (BUTTON_INFO.POST_SUBMIT.className)
expect(screen.getByRole("button")).toHaveClass(
BUTTON_INFO.POST_SUBMIT.className,
);
});
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν€΄μ¦ˆ 풀이 μΌ€μ΄μŠ€μ— λ”°λ₯Έ λ²„νŠΌ ν…ŒμŠ€νŠΈ νŒŒμΌμž…λ‹ˆλ‹€.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

였였 이거 μ°Έκ³ ν•΄μ„œ 저도 Test μ‚¬μš©ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€ πŸ’―

11 changes: 7 additions & 4 deletions src/quiz/components/AnswerContextButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import React, { useContext } from "react";

import { Button } from "@shared/components/ui/button";

import { BUTTON_INFO } from "@quiz/constants/answerButtonInfo";
import QuizContext from "@quiz/context/quizContext";

export default function AnswerContextButton() {
const {
states: { answer, isSubmit },
} = useContext(QuizContext);

const result = isSubmit ? "λ‹€μŒ 문제 ν’€κΈ°" : "μ •λ‹΅ μ œμΆœν•˜κΈ°";
const result = isSubmit
? BUTTON_INFO.POST_SUBMIT.title
: BUTTON_INFO.PRE_ANSWER_SELECT.title;
const style =
(!answer && !isSubmit && "bg-text-gray3 text-text-gray2") ||
(answer && !isSubmit && "bg-main") ||
"bg-text-black";
(!answer && !isSubmit && BUTTON_INFO.PRE_ANSWER_SELECT.className) ||
(answer && !isSubmit && BUTTON_INFO.POST_ANSWER_PRE_SUBMIT.className) ||
BUTTON_INFO.POST_SUBMIT.className;

return <Button className={style}>{result}</Button>;
}
2 changes: 1 addition & 1 deletion src/quiz/context/quizContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { createContext, useState } from "react";

import { QuizContextInfo } from "@quiz/types";
import { QuizContextInfo } from "@quiz/types/quizContextInfo";

const QuizContext = createContext<QuizContextInfo>({
states: { answer: "", isSubmit: false },
Expand Down
Loading