29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, it, expect } from 'vitest';
|
|
import { Header } from '../Header';
|
|
|
|
describe('<Header />', () => {
|
|
it('renders the wordmark, linked to the top of the page', () => {
|
|
render(<Header />);
|
|
const home = screen.getByRole('link', { name: /creeer/i });
|
|
expect(home).toHaveAttribute('href', '#top');
|
|
expect(home.querySelector('[data-accent="true"]')).not.toBeNull();
|
|
});
|
|
it('renders a persistent CTA linking to the contact section', () => {
|
|
render(<Header />);
|
|
const cta = screen.getByRole('link', { name: /Hablemos/i });
|
|
expect(cta).toHaveAttribute('href', '#contacto');
|
|
});
|
|
it('shows reading progress', () => {
|
|
const { container } = render(<Header />);
|
|
expect(container.querySelector('.bg-dorado')).toBeInTheDocument();
|
|
});
|
|
|
|
it('starts roomy, before any scrolling has happened', () => {
|
|
const { container } = render(<Header />);
|
|
// The header compacts on scroll; at rest it must be in its tall state, or
|
|
// the wordmark would land already shrunken on first paint.
|
|
expect(container.querySelector('header')?.className).toContain('py-3');
|
|
});
|
|
});
|