2026-01-07 09:31:02 +00:00
|
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { Progress } from './progress';
|
|
|
|
|
|
|
|
|
|
describe('Progress Component', () => {
|
|
|
|
|
it('renders progress bar', () => {
|
|
|
|
|
render(<Progress value={50} />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const progressBar = screen.getByRole('progressbar');
|
|
|
|
|
expect(progressBar).toBeInTheDocument();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('displays correct percentage', () => {
|
|
|
|
|
render(<Progress value={75} />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const fill = document.querySelector('.h-full');
|
|
|
|
|
expect(fill).toHaveStyle({ width: '75%' });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('renders with default variant', () => {
|
|
|
|
|
render(<Progress value={50} />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const progressBar = screen.getByRole('progressbar');
|
|
|
|
|
expect(progressBar).toBeInTheDocument();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('renders gaming variant', () => {
|
2026-01-26 13:12:17 +00:00
|
|
|
render(<Progress value={50} variant="glass" />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const progressBar = screen.getByRole('progressbar');
|
|
|
|
|
expect(progressBar).toBeInTheDocument();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('renders with labels', () => {
|
|
|
|
|
render(<Progress value={50} labelLeft="0%" labelRight="100%" />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
expect(screen.getByText('0%')).toBeInTheDocument();
|
|
|
|
|
expect(screen.getByText('100%')).toBeInTheDocument();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('handles different colors', () => {
|
|
|
|
|
const { rerender } = render(<Progress value={50} color="cyan" />);
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
let fill = document.querySelector('.bg-primary');
|
2026-01-07 09:31:02 +00:00
|
|
|
expect(fill).toBeInTheDocument();
|
|
|
|
|
|
|
|
|
|
rerender(<Progress value={50} color="magenta" />);
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
fill = document.querySelector('.bg-destructive');
|
2026-01-07 09:31:02 +00:00
|
|
|
expect(fill).toBeInTheDocument();
|
|
|
|
|
|
|
|
|
|
rerender(<Progress value={50} color="lime" />);
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
fill = document.querySelector('.bg-success');
|
2026-01-07 09:31:02 +00:00
|
|
|
expect(fill).toBeInTheDocument();
|
|
|
|
|
|
|
|
|
|
rerender(<Progress value={50} color="gold" />);
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
fill = document.querySelector('.bg-warning');
|
2026-01-07 09:31:02 +00:00
|
|
|
expect(fill).toBeInTheDocument();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('clamps value between 0 and 100', () => {
|
|
|
|
|
const { rerender } = render(<Progress value={150} />);
|
|
|
|
|
let fill = document.querySelector('.h-full');
|
|
|
|
|
expect(fill).toHaveStyle({ width: '100%' });
|
|
|
|
|
|
|
|
|
|
rerender(<Progress value={-10} />);
|
|
|
|
|
fill = document.querySelector('.h-full');
|
|
|
|
|
expect(fill).toHaveStyle({ width: '0%' });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('handles custom max value', () => {
|
|
|
|
|
render(<Progress value={50} max={200} />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const fill = document.querySelector('.h-full');
|
|
|
|
|
expect(fill).toHaveStyle({ width: '25%' }); // 50/200 = 25%
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('applies custom className', () => {
|
|
|
|
|
render(<Progress value={50} className="custom-progress" />);
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const progressBar = screen.getByRole('progressbar');
|
chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification
- apps/web: test updates (Vitest/setup), playbackAnalyticsService, TrackGrid, serviceErrorHandler
- veza-common: logging, metrics, traits, validation, random
- veza-stream-server: audio pipeline, codecs, cache, monitoring, routes
- apps/web/dist_verification: refresh build assets (content-hashed filenames)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 18:39:18 +00:00
|
|
|
expect(progressBar).toHaveClass('custom-progress');
|
2026-01-07 09:31:02 +00:00
|
|
|
});
|
|
|
|
|
});
|