mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Amélioration de beaucoup de features
This commit is contained in:
parent
f8dd95f651
commit
6a340556e2
3 changed files with 6 additions and 8 deletions
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
|||
};
|
||||
const alpha = Array.from(Array(26)).map((_e, i) => i + 65);
|
||||
const alphabet = alpha.map((x) => String.fromCharCode(x));
|
||||
|
||||
return (
|
||||
|
||||
<div className="question-container">
|
||||
<div className="question content">
|
||||
<div dangerouslySetInnerHTML={{ __html: FormattedTextTemplate(question.formattedStem) }} />
|
||||
|
|
@ -43,7 +43,6 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
|||
|
||||
{question.choices.map((choice, i) => {
|
||||
const selected = answer === choice.formattedText.text ? 'selected' : '';
|
||||
console.log("dsa", selected)
|
||||
return (
|
||||
<div key={choice.formattedText.text + i} className="choice-container">
|
||||
<Button
|
||||
|
|
@ -81,7 +80,7 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
|||
onClick={() =>
|
||||
answer !== "" && handleOnSubmitAnswer && handleOnSubmitAnswer(answer)
|
||||
}
|
||||
disabled={answer === ''}
|
||||
disabled={answer === '' || answer === null}
|
||||
>
|
||||
Répondre
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
|||
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState(false);
|
||||
const [answer, setAnswer] = useState<string | number | boolean>('');
|
||||
|
||||
console.log("Answer" , answer);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue