From 6a340556e21231e9c27ac26c2496f7b27c92eed7 Mon Sep 17 00:00:00 2001 From: JubaAzul <118773284+JubaAzul@users.noreply.github.com> Date: Fri, 7 Mar 2025 12:20:39 -0500 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20beaucoup=20de=20featur?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx | 6 ++---- .../MultipleChoiceQuestionDisplay.tsx | 7 +++---- client/src/components/TeacherModeQuiz/TeacherModeQuiz.tsx | 1 + 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx b/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx index 0332f1a..6734114 100644 --- a/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx +++ b/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx @@ -4,13 +4,11 @@ import { render, fireEvent, act } from '@testing-library/react'; import { screen } from '@testing-library/dom'; import '@testing-library/jest-dom'; import { MultipleChoiceQuestion, parse } from 'gift-pegjs'; - import TeacherModeQuiz from 'src/components/TeacherModeQuiz/TeacherModeQuiz'; import { MemoryRouter } from 'react-router-dom'; -// import { mock } from 'node:test'; const mockGiftQuestions = parse( - `::Sample Question:: Sample Question {=Option A ~Option B}`); + `::Question:: Sample Question {=Option A ~Option B}`); describe('TeacherModeQuiz', () => { @@ -36,6 +34,7 @@ describe('TeacherModeQuiz', () => { }); test('renders the initial question', () => { + expect(screen.getByText('Question 1')).toBeInTheDocument(); expect(screen.getByText('Sample Question')).toBeInTheDocument(); expect(screen.getByText('Option A')).toBeInTheDocument(); @@ -53,7 +52,6 @@ describe('TeacherModeQuiz', () => { fireEvent.click(screen.getByText('Répondre')); }); expect(mockSubmitAnswer).toHaveBeenCalledWith('Option A', 1); - expect(screen.getByText('Votre réponse est:')).toBeInTheDocument(); }); test('handles disconnect button click', () => { diff --git a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx index c8e8f69..c3658c2 100644 --- a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx @@ -14,7 +14,7 @@ interface Props { const MultipleChoiceQuestionDisplay: React.FC = (props) => { const { question, showAnswer, handleOnSubmitAnswer, passedAnswer } = props; - const [answer, setAnswer] = useState(passedAnswer || ' '); + const [answer, setAnswer] = useState(passedAnswer || ''); let disableButton = false; @@ -33,8 +33,8 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { }; const alpha = Array.from(Array(26)).map((_e, i) => i + 65); const alphabet = alpha.map((x) => String.fromCharCode(x)); - return ( +
@@ -43,7 +43,6 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { {question.choices.map((choice, i) => { const selected = answer === choice.formattedText.text ? 'selected' : ''; - console.log("dsa", selected) return (