- Add aria-hidden="true" to all decorative inline SVGs (bookmark, view-mode, funnel, checkmark) - Convert save-search popover to proper dialog: role="dialog", aria-modal, focus trap, Escape key, focus return to trigger - Add aria-pressed on list/map/split view-mode toggle buttons - Add aria-expanded + aria-controls on mobile filter toggle button - Add role="status" + aria-label="Đang tải..." on Suspense fallback Co-Authored-By: Paperclip <noreply@paperclip.ing>
31 lines
873 B
TypeScript
31 lines
873 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { NotificationsProvider } from '../notifications-provider';
|
|
|
|
const useSocketNotificationsMock = vi.fn();
|
|
|
|
vi.mock('@/lib/hooks/use-socket-notifications', () => ({
|
|
useSocketNotifications: () => useSocketNotificationsMock(),
|
|
}));
|
|
|
|
describe('NotificationsProvider', () => {
|
|
it('renders children', () => {
|
|
render(
|
|
<NotificationsProvider>
|
|
<div>child</div>
|
|
</NotificationsProvider>,
|
|
);
|
|
expect(screen.getByText('child')).toBeInTheDocument();
|
|
});
|
|
|
|
it('initializes socket notifications hook on mount', () => {
|
|
useSocketNotificationsMock.mockClear();
|
|
render(
|
|
<NotificationsProvider>
|
|
<span>x</span>
|
|
</NotificationsProvider>,
|
|
);
|
|
expect(useSocketNotificationsMock).toHaveBeenCalled();
|
|
});
|
|
});
|