Files
ToBePlayed-Frontend/src/components/StatCard.test.jsx
T
lobo a60010e055 fix(ux): apply UX quick wins (#54)
Get started links to registration and says an admin approves accounts.
Back navigation restores the library scroll; search no longer fills history.
Steam and PSN unlink ask first. Any close marks news as seen.
Confetti plays only when the level rises on the page.
Count-ups respect reduced motion. Html lang follows the UI language.
Add a 404 page, translated role and dialog close label.
2026-10-21 08:21:39 +02:00

27 lines
819 B
React

// @vitest-environment jsdom
import {afterEach, describe, expect, it, vi} from 'vitest';
import {cleanup, render, screen} from '@testing-library/react';
import StatCard from './StatCard.jsx';
vi.mock('react-i18next', () => import('../test/i18n-mock.js'));
afterEach(() => {
cleanup();
delete document.documentElement.dataset.reduceMotion;
});
describe('StatCard', () => {
it('shows the final number at once when the user wants reduced motion', () => {
document.documentElement.dataset.reduceMotion = 'true';
render(<StatCard label="Games" value={1234}/>);
expect(screen.getByText('1.234')).toBeTruthy();
});
it('counts up from 0 otherwise', () => {
render(<StatCard label="Games" value={1234}/>);
expect(screen.getByText('0')).toBeTruthy();
});
});