Deux nouveaux tests (qui ne passent pas)

This commit is contained in:
C. Fuhrman 2025-03-21 14:43:38 -04:00
parent 331ff33d5b
commit 9fbe2920cc

View file

@ -175,7 +175,7 @@ describe('LiveResults', () => {
});
});
test('displays the chosen answer in a question cell', () => {
test('displays the submitted answer(s) in a question cell', () => {
render(
<LiveResults
socket={mockSocket}
@ -204,4 +204,38 @@ describe('LiveResults', () => {
});
});
test('highlights the cell of the selected question', () => {
render(
<LiveResults
socket={mockSocket}
questions={mockQuestions}
showSelectedQuestion={jest.fn()}
quizMode="teacher"
students={mockStudents}
/>
);
// Select the first question
const questionCell = screen.getByText(`Q${1}`);
fireEvent.click(questionCell);
// Check if the selected question is highlighted
expect(questionCell.closest('th')?.classList.contains('selected-question')).toBe(true);
});
test('Show answers should be enabled by default', () => {
render(
<LiveResults
socket={mockSocket}
questions={mockQuestions}
showSelectedQuestion={jest.fn()}
quizMode="teacher"
students={mockStudents}
/>
);
const showAnswersSwitch = screen.getByLabelText('Afficher les réponses');
expect((showAnswersSwitch as HTMLInputElement).checked).toBe(true);
});
});