Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions front/src/pods/student/student.component.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('StudentComponent tests', () => {

// Assert
const sessionName = screen.getByRole('heading');
const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');

expect(sessionName).toHaveTextContent(expectedSessionNameText);
expect(textArea).toHaveValue(props.log);
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('StudentComponent tests', () => {
render(<StudentComponent {...props} />);

// Assert
const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');
expect(textArea).toHaveTextContent('');
});

Expand All @@ -84,7 +84,7 @@ describe('StudentComponent tests', () => {
render(<StudentComponent {...props} />);

// Assert
const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');
expect(textArea).toHaveTextContent('');
});
});
16 changes: 13 additions & 3 deletions front/src/pods/student/student.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,39 @@ interface Props {
export const StudentComponent: React.FC<Props> = props => {
const { room, log } = props;

const {isAutoScrollEnabled, setIsAutoScrollEnabled, textAreaRef, doAutoScroll} = useAutoScroll();
const {
isAutoScrollEnabled,
setIsAutoScrollEnabled,
textAreaRef,
doAutoScroll,
} = useAutoScroll();

React.useEffect(() => {
doAutoScroll();
}, [log]);

return (

<>
<main className={innerClasses.root}>
<Typography className={innerClasses.sessionName} variant="body1" role="heading">
<Typography
className={innerClasses.sessionName}
variant="body1"
role="heading"
>
Session name: {room ?? ''}
</Typography>
<label className={innerClasses.label} htmlFor="session">
Content
</label>
<TextareaAutosize
role="log"
ref={textAreaRef}
id="session"
rowsMax={30}
rowsMin={30}
className={innerClasses.textarea}
value={log ?? ''}
readOnly={true}
/>
<FormControlLabel
label="Disable AutoScroll"
Expand Down
6 changes: 3 additions & 3 deletions front/src/pods/trainer/components/session.component.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('SessionComponent unit tests', () => {

render(<SessionComponent {...props} />);

const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');
const sendFullContentButton = screen.getAllByRole('button')[1];

userEvent.type(textArea, 'How are you doing?');
Expand All @@ -40,7 +40,7 @@ describe('SessionComponent unit tests', () => {

render(<SessionComponent {...props} />);

const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');
const sendFullContentButton = screen.getAllByRole('button')[1];

userEvent.type(textArea, 'How are you doing?');
Expand All @@ -64,7 +64,7 @@ describe('SessionComponent unit tests', () => {

render(<SessionComponent {...props} />);

const textArea = screen.getByRole('textbox');
const textArea = screen.getByRole('log');
const undoButton = screen.getAllByRole('button')[0];

userEvent.type(textArea, 'How are you doing?');
Expand Down
1 change: 1 addition & 0 deletions front/src/pods/trainer/components/session.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const SessionComponent: React.FC<Props> = props => {
</label>

<TextareaAutosize
role="log"
ref={textAreaRef}
id="session"
rowsMax={20}
Expand Down