From 9fbe2920cc5040e8d673c5c42949c6f1346e4cff Mon Sep 17 00:00:00 2001 From: "C. Fuhrman" Date: Fri, 21 Mar 2025 14:43:38 -0400 Subject: [PATCH] Deux nouveaux tests (qui ne passent pas) --- .../LiveResults/LiveResults.test.tsx | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/client/src/__tests__/components/LiveResults/LiveResults.test.tsx b/client/src/__tests__/components/LiveResults/LiveResults.test.tsx index 2083361..a211327 100644 --- a/client/src/__tests__/components/LiveResults/LiveResults.test.tsx +++ b/client/src/__tests__/components/LiveResults/LiveResults.test.tsx @@ -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( { }); }); + test('highlights the cell of the selected question', () => { + render( + + ); + + // 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( + + ); + + const showAnswersSwitch = screen.getByLabelText('Afficher les réponses'); + expect((showAnswersSwitch as HTMLInputElement).checked).toBe(true); + }); + });