Dos secciones nuevas tomadas del deck de la dueña, verbatim y sin reescribir: los 6 puntos de inflexión y los 4 dolores en primera persona. El resto de las secciones incorpora la capa gráfica: fondos de puntos, duotono sobre foto en Mecanismo y Cómo empezar, pantalla partida sí/no en Para quién, y pasos conectados con línea de progreso. Las fotos son CC BY-SA 4.0 y llevan crédito en el footer, como exige la licencia al haberlas modificado. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import { render, screen, act } from '@testing-library/react';
|
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
import { ComoEmpezar } from '../ComoEmpezar';
|
|
|
|
describe('<ComoEmpezar />', () => {
|
|
it('renders the on-ramp steps', () => {
|
|
render(<ComoEmpezar />);
|
|
expect(screen.getByText('Escríbeme')).toBeInTheDocument();
|
|
expect(screen.getByText('Sesión de diagnóstico')).toBeInTheDocument();
|
|
});
|
|
it('links the CTA to WhatsApp with a prefilled message', () => {
|
|
render(<ComoEmpezar />);
|
|
const cta = screen.getByRole('link', { name: /Agenda tu sesión de diagnóstico/i });
|
|
const href = cta.getAttribute('href') ?? '';
|
|
expect(href).toMatch(/^https:\/\/wa\.me\//);
|
|
expect(href).toContain('text=');
|
|
});
|
|
it('renders the sunrise photo panel as decorative, not real content', () => {
|
|
const { container } = render(<ComoEmpezar />);
|
|
const img = container.querySelector('img');
|
|
// next/image rewrites `src` through its loader in this test environment;
|
|
// the static export (images.unoptimized: true) serves the plain path.
|
|
expect(img?.getAttribute('src')).toContain('comoempezar-bg.jpg');
|
|
expect(img).toHaveAttribute('alt', '');
|
|
});
|
|
|
|
describe('auto-advancing step highlight', () => {
|
|
beforeEach(() => { vi.useFakeTimers(); });
|
|
afterEach(() => { vi.useRealTimers(); });
|
|
|
|
it('highlights the first step by default, then advances on its own', () => {
|
|
render(<ComoEmpezar />);
|
|
const first = screen.getByText('Escríbeme').closest('button');
|
|
const second = screen.getByText('Sesión de diagnóstico').closest('button');
|
|
expect(first).toHaveAttribute('aria-pressed', 'true');
|
|
act(() => { vi.advanceTimersByTime(3300); });
|
|
expect(second).toHaveAttribute('aria-pressed', 'true');
|
|
});
|
|
});
|
|
});
|