Compare commits

..

2 commits

Author SHA1 Message Date
lanahria
773ede1933
Merge 9b8b0ad0ec into ee7a7a0544 2025-04-02 19:46:26 +00:00
Ana-Lucia Munteanu
9b8b0ad0ec Adding test to EditorQuiz 2025-04-02 15:45:59 -04:00
2 changed files with 22 additions and 0 deletions

View file

@ -60,3 +60,21 @@ describe('QuizForm Component', () => {
}); });
}); });
test('template-select is present', async () => {
render(
<MemoryRouter initialEntries={['/teacher/editor-quiz']}>
<QuizForm />
</MemoryRouter>
);
expect(screen.queryByText('Modèles de questions')).toBeInTheDocument();
const templateButton = screen.getByTestId('template-select');
fireEvent.mouseDown(templateButton);
await waitFor(() => {
const vraiFauxTemplate = screen.queryAllByText(/Vrai\/Faux/i);
expect(vraiFauxTemplate.length).toBeGreaterThan(0);
});
});

View file

@ -276,6 +276,10 @@ const QuizForm: React.FC = () => {
displayEmpty displayEmpty
onChange={(e) => handleSelectChange(e.target.value, templates.find(t => t.value === e.target.value)?.label || '')} onChange={(e) => handleSelectChange(e.target.value, templates.find(t => t.value === e.target.value)?.label || '')}
style={{ width: '210px' }} style={{ width: '210px' }}
inputProps={{
'data-testid': 'template-select'
}}
> >
<MenuItem value="" disabled>Modèles de questions</MenuItem> <MenuItem value="" disabled>Modèles de questions</MenuItem>
{templates.map((template, index) => ( {templates.map((template, index) => (