Files
familienarchiv/frontend/src/lib/components/SortDropdown.svelte.spec.ts
Marcel 2e943b7f91
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 1m21s
CI / Backend Unit Tests (pull_request) Failing after 2m30s
fix(ui): De Gruyter long arrows on both sort buttons, rotate swap icon 90°
Replace ↑↓ text with Long-Arrow-Up/Down-MD.svg on the document search
SortDropdown and the Briefwechsel sort button. Rotate the swap button
SVG 90° so arrows point left/right matching the horizontal person
field layout.

Refs: #179

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 22:43:45 +02:00

41 lines
1.5 KiB
TypeScript

import { render } from 'vitest-browser-svelte';
import { describe, expect, it } from 'vitest';
import { page } from '@vitest/browser/context';
import SortDropdown from './SortDropdown.svelte';
describe('SortDropdown', () => {
it('renders a select with all sort options', async () => {
render(SortDropdown, { sort: 'DATE', dir: 'desc' });
const select = page.getByRole('combobox');
await expect.element(select).toBeInTheDocument();
});
it('shows the current sort value as selected', async () => {
render(SortDropdown, { sort: 'TITLE', dir: 'asc' });
const select = page.getByRole('combobox');
await expect.element(select).toHaveValue('TITLE');
});
it('renders direction toggle button', async () => {
render(SortDropdown, { sort: 'DATE', dir: 'asc' });
const btn = page.getByRole('button');
await expect.element(btn).toBeInTheDocument();
});
it('direction button shows up arrow when dir is asc', async () => {
render(SortDropdown, { sort: 'DATE', dir: 'asc' });
await expect.element(page.getByRole('button')).toBeInTheDocument();
const img = document.querySelector('button img') as HTMLImageElement;
expect(img).not.toBeNull();
expect(img.src).toContain('Long-Arrow-Up');
});
it('direction button shows down arrow when dir is desc', async () => {
render(SortDropdown, { sort: 'DATE', dir: 'desc' });
await expect.element(page.getByRole('button')).toBeInTheDocument();
const img = document.querySelector('button img') as HTMLImageElement;
expect(img).not.toBeNull();
expect(img.src).toContain('Long-Arrow-Down');
});
});