[BUG] Dans un quiz au rythme de l'étudiant, l'enseignant ne peut plus masquer les questions

Fixes #295
This commit is contained in:
JubaAzul 2025-03-19 16:26:03 -04:00
parent 206895ebb5
commit 66f8510f9a
3 changed files with 8 additions and 7 deletions

View file

@ -344,11 +344,10 @@ describe('ManageRoom', () => {
const tableHeader = screen.getByText('Q1');
fireEvent.click(tableHeader);
const closeButton = screen.getByRole('button', { name: /✖/i });
expect(closeButton).toBeInTheDocument();
const questionVisibilitySwitch = screen.getByTestId('question-visibility-switch'); // Get the specific switch
expect(screen.getByText(/Question 1\//i)).toBeInTheDocument();
fireEvent.click(closeButton);
fireEvent.click(questionVisibilitySwitch);
expect(screen.queryByRole('button', { name: /✖/i })).not.toBeInTheDocument();
expect(screen.queryByText(/Question 1\//i)).not.toBeInTheDocument();

View file

@ -318,6 +318,7 @@ const ManageRoom: React.FC = () => {
return;
}
setQuizQuestions(quizQuestions);
setCurrentQuestion(quizQuestions[0]);
webSocketService.launchStudentModeQuiz(formattedRoomName, quizQuestions);
};
@ -480,7 +481,8 @@ const ManageRoom: React.FC = () => {
label={<div className="text-sm">Afficher les questions</div>}
control={
<Switch
value={isQuestionShown}
data-testid="question-visibility-switch" // Add a unique test ID
checked={isQuestionShown}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setIsQuestionShown(e.target.checked)
}

View file

@ -39,7 +39,7 @@
.close-button-wrapper{
display: flex;
justify-content: flex-end;
justify-content: flex-start;
margin-right: 1rem;
}