Covers Badge, Divider, EmptyState, Numeric, PriceDelta, Signal, Skeleton, StatusChip, Surface, StatCard, KpiCard, DensityToggle, Footer, MarketIndex, CompactHeader — rendering, variants, props, a11y attributes, className merging. All 1139 web tests pass. Zustand persist store mocked for DensityToggle to avoid jsdom localStorage incompatibility. Co-Authored-By: Paperclip <noreply@paperclip.ing>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { Divider } from '../divider';
|
|
|
|
describe('Divider', () => {
|
|
it('renders with role="separator"', () => {
|
|
render(<Divider />);
|
|
expect(screen.getByRole('separator')).toBeInTheDocument();
|
|
});
|
|
|
|
it('defaults to horizontal orientation', () => {
|
|
render(<Divider data-testid="d" />);
|
|
expect(screen.getByTestId('d')).toHaveAttribute('aria-orientation', 'horizontal');
|
|
});
|
|
|
|
it('renders vertical orientation', () => {
|
|
render(<Divider data-testid="d" orientation="vertical" />);
|
|
expect(screen.getByTestId('d')).toHaveAttribute('aria-orientation', 'vertical');
|
|
expect(screen.getByTestId('d')).toHaveClass('h-full', 'w-px');
|
|
});
|
|
|
|
it('applies strong variant class', () => {
|
|
render(<Divider data-testid="d" strong />);
|
|
expect(screen.getByTestId('d')).toHaveClass('bg-border-strong');
|
|
});
|
|
|
|
it('applies default border class without strong', () => {
|
|
render(<Divider data-testid="d" />);
|
|
expect(screen.getByTestId('d')).toHaveClass('bg-border');
|
|
});
|
|
|
|
it('horizontal adds h-px and w-full', () => {
|
|
render(<Divider data-testid="d" orientation="horizontal" />);
|
|
expect(screen.getByTestId('d')).toHaveClass('h-px', 'w-full');
|
|
});
|
|
|
|
it('merges custom className', () => {
|
|
render(<Divider data-testid="d" className="my-custom" />);
|
|
expect(screen.getByTestId('d')).toHaveClass('my-custom');
|
|
});
|
|
});
|