5180 fichiers 38.5 Mo 0 téléchargements 275 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / components / catalog / views / CatalogLoadingStateView.test.tsx
CatalogLoadingStateView.test.tsx 1022 o Télécharger le fichier
import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { CatalogLoadingStateView } from './CatalogLoadingStateView';

describe('catalog loading feedback', () => {
    it('announces page loading without replacing the catalog shell', () => {
        render(<CatalogLoadingStateView />);

        expect(screen.getByRole('status')).toHaveAttribute('aria-live', 'polite');
        expect(screen.getByRole('status')).toHaveTextContent('Loading...');
        expect(screen.getByRole('status')).not.toHaveTextContent('catalog.loading');
    });

    it('turns a timed-out page request into a recoverable retry action', () => {
        let retries = 0;

        render(<CatalogLoadingStateView error="timeout" onRetry={() => retries++} />);

        expect(screen.getByRole('alert')).toHaveTextContent('The catalog page took too long to load.');
        fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
        expect(retries).toBe(1);
    });
});
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser