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 {
|
export interface StudentType {
|
||||||
name: string;
|
name: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
room?: string;
|
||||||
|
answers?: Answer[];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Importez le type UserType s'il n'est pas déjà importé
|
// Importez le type UserType s'il n'est pas déjà importé
|
||||||
import { render, screen, fireEvent } from '@testing-library/react';
|
import { render, screen, fireEvent } from '@testing-library/react';
|
||||||
import '@testing-library/jest-dom';
|
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 = [
|
const mockUsers = [
|
||||||
{ id: '1', name: 'User1' },
|
{ id: '1', name: 'User1' },
|
||||||
{ id: '2', name: 'User2' },
|
{ id: '2', name: 'User2' },
|
||||||
|
|
@ -17,8 +17,8 @@ describe('UserWaitPage Component', () => {
|
||||||
setQuizMode: jest.fn(),
|
setQuizMode: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
test('renders UserWaitPage with correct content', () => {
|
test('renders StudentWaitPage with correct content', () => {
|
||||||
render(<UserWaitPage {...mockProps} />);
|
render(<StudentWaitPage {...mockProps} />);
|
||||||
|
|
||||||
//expect(screen.getByText(/Test Room/)).toBeInTheDocument();
|
//expect(screen.getByText(/Test Room/)).toBeInTheDocument();
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ describe('UserWaitPage Component', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('clicking on "Lancer" button opens LaunchQuizDialog', () => {
|
test('clicking on "Lancer" button opens LaunchQuizDialog', () => {
|
||||||
render(<UserWaitPage {...mockProps} />);
|
render(<StudentWaitPage {...mockProps} />);
|
||||||
|
|
||||||
fireEvent.click(screen.getByRole('button', { name: /Lancer/i }));
|
fireEvent.click(screen.getByRole('button', { name: /Lancer/i }));
|
||||||
|
|
||||||
|
|
@ -1,56 +1,56 @@
|
||||||
import { Button, Chip, Grid } from '@mui/material';
|
import { Button, Chip, Grid } from '@mui/material';
|
||||||
import { StudentType } from '../../Types/StudentType';
|
import { StudentType } from '../../Types/StudentType';
|
||||||
import { PlayArrow } from '@mui/icons-material';
|
import { PlayArrow } from '@mui/icons-material';
|
||||||
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
|
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import './userWaitPage.css';
|
import './studentWaitPage.css';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
users: StudentType[];
|
users: StudentType[];
|
||||||
launchQuiz: () => void;
|
launchQuiz: () => void;
|
||||||
setQuizMode: (mode: 'student' | 'teacher') => void;
|
setQuizMode: (mode: 'student' | 'teacher') => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
|
const StudentWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
|
||||||
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
|
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="wait">
|
<div className="wait">
|
||||||
<div className='button'>
|
<div className='button'>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={() => setIsDialogOpen(true)}
|
onClick={() => setIsDialogOpen(true)}
|
||||||
startIcon={<PlayArrow />}
|
startIcon={<PlayArrow />}
|
||||||
fullWidth
|
fullWidth
|
||||||
sx={{ fontWeight: 600, fontSize: 20 }}
|
sx={{ fontWeight: 600, fontSize: 20 }}
|
||||||
>
|
>
|
||||||
Lancer
|
Lancer
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="students">
|
<div className="students">
|
||||||
|
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
|
|
||||||
{users.map((user, index) => (
|
{users.map((user, index) => (
|
||||||
<Grid item key={user.name + index}>
|
<Grid item key={user.name + index}>
|
||||||
<Chip label={user.name} sx={{ width: '100%' }} />
|
<Chip label={user.name} sx={{ width: '100%' }} />
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LaunchQuizDialog
|
<LaunchQuizDialog
|
||||||
open={isDialogOpen}
|
open={isDialogOpen}
|
||||||
handleOnClose={() => setIsDialogOpen(false)}
|
handleOnClose={() => setIsDialogOpen(false)}
|
||||||
launchQuiz={launchQuiz}
|
launchQuiz={launchQuiz}
|
||||||
setQuizMode={setQuizMode}
|
setQuizMode={setQuizMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default UserWaitPage;
|
export default StudentWaitPage;
|
||||||
|
|
@ -15,7 +15,7 @@ import { StudentType } from '../../../Types/StudentType';
|
||||||
import { Button } from '@mui/material';
|
import { Button } from '@mui/material';
|
||||||
import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle';
|
import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle';
|
||||||
import { Refresh, Error } from '@mui/icons-material';
|
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 DisconnectButton from '../../../components/DisconnectButton/DisconnectButton';
|
||||||
import QuestionNavigation from '../../../components/QuestionNavigation/QuestionNavigation';
|
import QuestionNavigation from '../../../components/QuestionNavigation/QuestionNavigation';
|
||||||
import Question from '../../../components/Questions/Question';
|
import Question from '../../../components/Questions/Question';
|
||||||
|
|
@ -311,7 +311,7 @@ const ManageRoom: React.FC = () => {
|
||||||
|
|
||||||
) : (
|
) : (
|
||||||
|
|
||||||
<UserWaitPage
|
<StudentWaitPage
|
||||||
users={students}
|
users={students}
|
||||||
launchQuiz={launchQuiz}
|
launchQuiz={launchQuiz}
|
||||||
setQuizMode={setQuizMode}
|
setQuizMode={setQuizMode}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue