Fix add-filter placeholder state

This commit is contained in:
rcourtman
2026-06-01 09:51:46 +01:00
parent 4cf7371976
commit 9eac936c8e
4 changed files with 10 additions and 1 deletions
@@ -114,7 +114,7 @@ export const AddFilterMenu: Component<AddFilterMenuProps> = (props) => {
aria-label="Filter"
class={`${filterSelectClass} min-w-[9rem] disabled:cursor-not-allowed disabled:opacity-50`}
>
<option value="" disabled>
<option value="">
{isDisabled() ? 'No filters' : 'Add filter'}
</option>
<For each={selectableGroups()}>
@@ -57,6 +57,8 @@ describe('FilterBar', () => {
expect(setType).toHaveBeenCalledWith('vm');
const filterSelect = screen.getByRole('combobox', { name: 'Filter' });
expect(filterSelect).toHaveValue('');
expect(within(filterSelect).getByRole('option', { name: 'Add filter' })).toBeEnabled();
expect(
within(filterSelect).queryByRole('option', { name: 'Type: VMs' }),
).not.toBeInTheDocument();
@@ -242,6 +242,7 @@ export function ProxmoxRecoverableTable(props: {
class="border-t border-border bg-surface-alt px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] text-base-content"
>
{group.label}
{' '}
<span class="ml-2 normal-case tracking-normal text-muted">
{group.items.length} {group.items.length === 1 ? 'backup' : 'backups'}
</span>
@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import { ProxmoxBackupsTable } from '../ProxmoxBackupsTable';
import type { Resource } from '@/types/resource';
import { getRecoveryFullDateLabel } from '@/utils/recoveryDatePresentation';
// ProxmoxBackupsTable reads URL search params (node/type scope filters), so it
// must render inside a Router context.
@@ -143,6 +144,11 @@ describe('ProxmoxBackupsTable', () => {
expect(screen.getByRole('columnheader', { name: /source/i })).toBeInTheDocument();
expect(screen.getAllByText('PBS').length).toBeGreaterThan(0);
expect(screen.getByText('main / minipc')).toBeInTheDocument();
expect(
screen.getByRole('cell', {
name: `${getRecoveryFullDateLabel('2026-05-25')} 3 backups`,
}),
).toBeInTheDocument();
expect(apiFetchMock).toHaveBeenCalledWith('/api/backups/pbs');
expect(apiFetchMock).toHaveBeenCalledWith('/api/backups/pve');
});