[FEATURE] Être possible de cacher le tableau du LiveResult

Fixes #294
This commit is contained in:
JubaAzul 2025-03-20 10:34:16 -04:00
parent c13a38af70
commit 5edd556688
2 changed files with 13 additions and 13 deletions

View file

@ -227,7 +227,7 @@ test('calls showSelectedQuestion when a table cell is clicked', () => {
expect(mockShowSelectedQuestion).toHaveBeenCalled(); expect(mockShowSelectedQuestion).toHaveBeenCalled();
}); });
test.skip('toggles the visibility of content when the arrow button is clicked', () => { test('toggles the visibility of content when the arrow button is clicked', () => {
render(<LiveResults render(<LiveResults
socket={null} socket={null}
questions={mockQuestions} questions={mockQuestions}
@ -235,19 +235,16 @@ test.skip('toggles the visibility of content when the arrow button is clicked',
quizMode="teacher" quizMode="teacher"
students={mockStudents} students={mockStudents}
/>); />);
const toggleSwitch = screen.getByTestId("liveResults-visibility-switch"); const toggleSwitch = screen.getByTestId("liveResults-switch");
fireEvent.click(toggleSwitch);
expect(toggleSwitch).toBeInTheDocument(); expect(toggleSwitch).toBeInTheDocument();
expect(toggleSwitch).toBeChecked();
expect(screen.queryByText('Afficher les noms')).toBeInTheDocument(); expect(screen.queryByText('Afficher les noms')).toBeInTheDocument();
expect(screen.queryByText('Afficher les réponses')).toBeInTheDocument(); expect(screen.queryByText('Afficher les réponses')).toBeInTheDocument();
expect(screen.queryByTestId('table-container')).toBeInTheDocument(); expect(screen.queryByTestId('table-container')).toBeInTheDocument();
fireEvent.click(toggleSwitch); fireEvent.click(toggleSwitch);
screen.debug();
expect(toggleSwitch).not.toBeChecked();
expect(screen.queryByText('Afficher les noms')).not.toBeInTheDocument(); expect(screen.queryByText('Afficher les noms')).not.toBeInTheDocument();
expect(screen.queryByText('Afficher les réponses')).not.toBeInTheDocument(); expect(screen.queryByText('Afficher les réponses')).not.toBeInTheDocument();
expect(screen.queryByTestId('table-container')).not.toBeInTheDocument(); expect(screen.queryByTestId('table-container')).not.toBeInTheDocument();

View file

@ -36,13 +36,16 @@ const LiveResults: React.FC<LiveResultsProps> = ({ questions, showSelectedQuesti
<div> <div>
<div className="action-bar"> <div className="action-bar">
<div> <div>
<FormControlLabel
label={<div className="text-sm">Résultats du quiz</div>}
control={
<Switch <Switch
data-testid="liveResults-visibility-switch" data-testid="liveResults-switch"
checked={isExpanded} checked={isExpanded}
onChange={() => toggleExpand()} onChange={() => toggleExpand()}
inputProps={{ 'aria-label': 'toggle visibility' }}
/> />
<span>Résultats du quiz</span> }
/>
</div> </div>
{isExpanded && ( {isExpanded && (
<FormGroup row className='form-group'> <FormGroup row className='form-group'>