mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
User -> Student (page, tests)
This commit is contained in:
parent
68d7d8c0a9
commit
fa4b6b5bd3
5 changed files with 71 additions and 63 deletions
|
|
@ -1,4 +1,12 @@
|
|||
export interface Answer {
|
||||
answer: string | number | boolean;
|
||||
isCorrect: boolean;
|
||||
idQuestion: number;
|
||||
}
|
||||
|
||||
export interface StudentType {
|
||||
name: string;
|
||||
id: string;
|
||||
room?: string;
|
||||
answers?: Answer[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Importez le type UserType s'il n'est pas déjà importé
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import UserWaitPage from '../../../components/UserWaitPage/UserWaitPage';
|
||||
import StudentWaitPage from '../../../components/StudentWaitPage/StudentWaitPage';
|
||||
|
||||
describe('UserWaitPage Component', () => {
|
||||
describe('StudentWaitPage Component', () => {
|
||||
const mockUsers = [
|
||||
{ id: '1', name: 'User1' },
|
||||
{ id: '2', name: 'User2' },
|
||||
|
|
@ -17,8 +17,8 @@ describe('UserWaitPage Component', () => {
|
|||
setQuizMode: jest.fn(),
|
||||
};
|
||||
|
||||
test('renders UserWaitPage with correct content', () => {
|
||||
render(<UserWaitPage {...mockProps} />);
|
||||
test('renders StudentWaitPage with correct content', () => {
|
||||
render(<StudentWaitPage {...mockProps} />);
|
||||
|
||||
//expect(screen.getByText(/Test Room/)).toBeInTheDocument();
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ describe('UserWaitPage Component', () => {
|
|||
});
|
||||
|
||||
test('clicking on "Lancer" button opens LaunchQuizDialog', () => {
|
||||
render(<UserWaitPage {...mockProps} />);
|
||||
render(<StudentWaitPage {...mockProps} />);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /Lancer/i }));
|
||||
|
||||
|
|
@ -1,56 +1,56 @@
|
|||
import { Button, Chip, Grid } from '@mui/material';
|
||||
import { StudentType } from '../../Types/StudentType';
|
||||
import { PlayArrow } from '@mui/icons-material';
|
||||
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
|
||||
import { useState } from 'react';
|
||||
import './userWaitPage.css';
|
||||
|
||||
interface Props {
|
||||
users: StudentType[];
|
||||
launchQuiz: () => void;
|
||||
setQuizMode: (mode: 'student' | 'teacher') => void;
|
||||
}
|
||||
|
||||
const UserWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
|
||||
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
|
||||
|
||||
return (
|
||||
<div className="wait">
|
||||
<div className='button'>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => setIsDialogOpen(true)}
|
||||
startIcon={<PlayArrow />}
|
||||
fullWidth
|
||||
sx={{ fontWeight: 600, fontSize: 20 }}
|
||||
>
|
||||
Lancer
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="students">
|
||||
|
||||
<Grid container spacing={3}>
|
||||
|
||||
{users.map((user, index) => (
|
||||
<Grid item key={user.name + index}>
|
||||
<Chip label={user.name} sx={{ width: '100%' }} />
|
||||
</Grid>
|
||||
))}
|
||||
|
||||
</Grid>
|
||||
|
||||
</div>
|
||||
|
||||
<LaunchQuizDialog
|
||||
open={isDialogOpen}
|
||||
handleOnClose={() => setIsDialogOpen(false)}
|
||||
launchQuiz={launchQuiz}
|
||||
setQuizMode={setQuizMode}
|
||||
/>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserWaitPage;
|
||||
import { Button, Chip, Grid } from '@mui/material';
|
||||
import { StudentType } from '../../Types/StudentType';
|
||||
import { PlayArrow } from '@mui/icons-material';
|
||||
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
|
||||
import { useState } from 'react';
|
||||
import './studentWaitPage.css';
|
||||
|
||||
interface Props {
|
||||
users: StudentType[];
|
||||
launchQuiz: () => void;
|
||||
setQuizMode: (mode: 'student' | 'teacher') => void;
|
||||
}
|
||||
|
||||
const StudentWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
|
||||
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
|
||||
|
||||
return (
|
||||
<div className="wait">
|
||||
<div className='button'>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => setIsDialogOpen(true)}
|
||||
startIcon={<PlayArrow />}
|
||||
fullWidth
|
||||
sx={{ fontWeight: 600, fontSize: 20 }}
|
||||
>
|
||||
Lancer
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="students">
|
||||
|
||||
<Grid container spacing={3}>
|
||||
|
||||
{users.map((user, index) => (
|
||||
<Grid item key={user.name + index}>
|
||||
<Chip label={user.name} sx={{ width: '100%' }} />
|
||||
</Grid>
|
||||
))}
|
||||
|
||||
</Grid>
|
||||
|
||||
</div>
|
||||
|
||||
<LaunchQuizDialog
|
||||
open={isDialogOpen}
|
||||
handleOnClose={() => setIsDialogOpen(false)}
|
||||
launchQuiz={launchQuiz}
|
||||
setQuizMode={setQuizMode}
|
||||
/>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StudentWaitPage;
|
||||
|
|
@ -15,7 +15,7 @@ import { StudentType } from '../../../Types/StudentType';
|
|||
import { Button } from '@mui/material';
|
||||
import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle';
|
||||
import { Refresh, Error } from '@mui/icons-material';
|
||||
import UserWaitPage from '../../../components/UserWaitPage/UserWaitPage';
|
||||
import StudentWaitPage from '../../../components/StudentWaitPage/StudentWaitPage';
|
||||
import DisconnectButton from '../../../components/DisconnectButton/DisconnectButton';
|
||||
import QuestionNavigation from '../../../components/QuestionNavigation/QuestionNavigation';
|
||||
import Question from '../../../components/Questions/Question';
|
||||
|
|
@ -311,7 +311,7 @@ const ManageRoom: React.FC = () => {
|
|||
|
||||
) : (
|
||||
|
||||
<UserWaitPage
|
||||
<StudentWaitPage
|
||||
users={students}
|
||||
launchQuiz={launchQuiz}
|
||||
setQuizMode={setQuizMode}
|
||||
|
|
|
|||
Loading…
Reference in a new issue