import { describe, it, expect, afterEach } from 'vitest';
import { render, screen, cleanup } from '@testing-library/svelte';
import ShelfSkeleton from './ShelfSkeleton.svelte';

afterEach(() => cleanup());

describe('ShelfSkeleton', () => {
    it('renders the requested number of card placeholders', () => {
        render(ShelfSkeleton, { props: { count: 4, testid: 'sk' } });
        expect(screen.getByTestId('sk').querySelectorAll('.card').length).toBe(4);
    });

    it('defaults to 6 cards', () => {
        render(ShelfSkeleton, { props: { testid: 'sk' } });
        expect(screen.getByTestId('sk').querySelectorAll('.card').length).toBe(6);
    });

    it('is decorative (aria-hidden)', () => {
        render(ShelfSkeleton, { props: { testid: 'sk' } });
        expect(screen.getByTestId('sk').getAttribute('aria-hidden')).toBe('true');
    });
});
