fix(a11y): resolve serious accessibility issues on search page (GOO-110)
- 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>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user