Files
ragusaitweb/src/components/ui/__tests__/Button.test.tsx
google-labs-jules[bot] 839e1bf82f feat: add client-side rate limiting to contact form
- Added `useRateLimit` hook
- Integrated hook into `Contact.tsx`
- Added translations for rate limit error
- Added unit tests
- Fixed type error in `Button.tsx` to allow build to pass
2026-01-26 01:49:05 +00:00

23 lines
701 B
TypeScript

// @vitest-environment jsdom
import { render, screen, cleanup } from '@testing-library/react';
import { describe, it, expect, afterEach } from 'vitest';
import { Button } from '../Button';
describe('Button', () => {
afterEach(() => {
cleanup();
});
it('passes aria-label to the button element', () => {
render(<Button aria-label="Test Label">Click me</Button>);
const button = screen.getByRole('button', { name: /test label/i });
expect(button).toBeTruthy();
});
it('passes other HTML attributes', () => {
render(<Button data-testid="custom-button">Click me</Button>);
const button = screen.getByTestId('custom-button');
expect(button).toBeTruthy();
});
});