Files
FitOS/app/test/ExerciseEditor.test.tsx

51 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { ExerciseEditor } from '../src/pages/plans/plan-editor/ExerciseEditor';
import type { EditorExercise } from '../src/pages/plans/plan-editor/types';
const LONG_NAME = 'Wiosłowanie sztangą nachwytem w pełnym opadzie tułowia';
const EXERCISE: EditorExercise = {
exerciseId: 'ex-1',
sets: [{ reps: '10', loadKg: '50', restSec: '90', rir: '2' }],
};
function renderEditor() {
return render(
<ExerciseEditor
exercise={EXERCISE}
exerciseMeta={undefined}
exerciseName={() => LONG_NAME}
isTraineeMode={false}
resultsOpen={false}
onToggleResults={() => {}}
onRemove={() => {}}
onMoveUp={() => {}}
onMoveDown={() => {}}
canMoveUp={false}
canMoveDown={false}
onSetField={() => {}}
onAddSetCopy={() => {}}
onRemoveSet={() => {}}
latest={undefined}
points={[]}
onPrefill={() => {}}
/>,
);
}
describe('ExerciseEditor — długa nazwa ćwiczenia', () => {
it('nazwa i podsumowanie serii łamią się zamiast być przycinane', () => {
renderEditor();
const name = screen.getByText(LONG_NAME);
expect(name.tagName).toBe('STRONG');
expect(name).toHaveClass('break-words');
expect(name).not.toHaveClass('truncate');
const summary = screen.getByText('1×10 @ 50 kg · RIR 2');
expect(summary).toHaveClass('break-words');
expect(summary).not.toHaveClass('truncate');
});
});