mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Added a test
This commit is contained in:
parent
a0f53232cd
commit
4b4a995a4e
2 changed files with 26 additions and 1 deletions
|
|
@ -92,4 +92,29 @@ describe('LiveResults', () => {
|
||||||
|
|
||||||
expect(mockShowSelectedQuestion).toHaveBeenCalled();
|
expect(mockShowSelectedQuestion).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('toggles the visibility of content when the arrow button is clicked', () => {
|
||||||
|
render(<LiveResults
|
||||||
|
socket={null}
|
||||||
|
questions={mockQuestions}
|
||||||
|
showSelectedQuestion={mockShowSelectedQuestion}
|
||||||
|
quizMode="teacher"
|
||||||
|
students={mockStudents}
|
||||||
|
/>);
|
||||||
|
expect(screen.queryByText('Afficher les noms')).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText('Afficher les réponses')).toBeInTheDocument();
|
||||||
|
expect(screen.queryByTestId('table-container')).toBeInTheDocument();
|
||||||
|
|
||||||
|
const toggleButton = screen.getByRole('button', { name: /toggle visibility/i });
|
||||||
|
fireEvent.click(toggleButton);
|
||||||
|
|
||||||
|
expect(screen.queryByText('Afficher les noms')).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText('Afficher les réponses')).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByTestId('table-container')).not.toBeInTheDocument();
|
||||||
|
|
||||||
|
fireEvent.click(toggleButton);
|
||||||
|
expect(screen.queryByText('Afficher les noms')).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText('Afficher les réponses')).toBeInTheDocument();
|
||||||
|
expect(screen.queryByTestId('table-container')).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -71,7 +71,7 @@ const LiveResults: React.FC<LiveResultsProps> = ({ questions, showSelectedQuesti
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{isExpanded && (
|
{isExpanded && (
|
||||||
<div className="table-container">
|
<div className="table-container" data-testid="table-container">
|
||||||
|
|
||||||
<LiveResultsTable
|
<LiveResultsTable
|
||||||
students={students}
|
students={students}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue