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

View file

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