Compare commits

..

1 commit

Author SHA1 Message Date
Juba.M
208d0ae640
Merge 206895ebb5 into 112062c0b2 2025-03-19 18:18:39 +00:00
3 changed files with 7 additions and 8 deletions

View file

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

View file

@ -318,7 +318,6 @@ const ManageRoom: React.FC = () => {
return;
}
setQuizQuestions(quizQuestions);
setCurrentQuestion(quizQuestions[0]);
webSocketService.launchStudentModeQuiz(formattedRoomName, quizQuestions);
};
@ -476,20 +475,19 @@ const ManageRoom: React.FC = () => {
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div className="title center-h-align mb-2">{quiz?.title}</div>
<div className='close-button-wrapper'>
<div className='close-button-wrapper'>
<FormControlLabel
label={<div className="text-sm">Afficher les questions</div>}
control={
<Switch
data-testid="question-visibility-switch" // Add a unique test ID
checked={isQuestionShown}
value={isQuestionShown}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setIsQuestionShown(e.target.checked)
}
/>
}
/>
</div>
</div>
{!isNaN(Number(currentQuestion?.question.id))
&& isQuestionShown && (

View file

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