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>
44 lines
1.8 KiB
TypeScript
44 lines
1.8 KiB
TypeScript
import { render, screen, fireEvent, act } from '@testing-library/react';
|
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
import { Mecanismo } from '../Mecanismo';
|
|
|
|
describe('<Mecanismo />', () => {
|
|
it('renders the 3 steps in order', () => {
|
|
render(<Mecanismo />);
|
|
expect(screen.getByText('Inmersión')).toBeInTheDocument();
|
|
expect(screen.getByText('Desafiar supuestos')).toBeInTheDocument();
|
|
expect(screen.getByText('Estrategia ejecutable')).toBeInTheDocument();
|
|
});
|
|
it('renders step numbers 01/02/03', () => {
|
|
const { container } = render(<Mecanismo />);
|
|
expect(container.textContent).toMatch(/01.+02.+03/);
|
|
});
|
|
it('keeps the background photo subtle enough not to fight the text', () => {
|
|
const { container } = render(<Mecanismo />);
|
|
const bg = container.querySelector('img');
|
|
expect(bg).toHaveAttribute('src', '/images/mecanismo-bg.jpg');
|
|
expect(bg?.closest('[class*="opacity-"]')).not.toBeNull();
|
|
});
|
|
|
|
describe('auto-advancing step indicator', () => {
|
|
beforeEach(() => { vi.useFakeTimers(); });
|
|
afterEach(() => { vi.useRealTimers(); });
|
|
|
|
it('highlights the first step by default, then advances on its own', () => {
|
|
render(<Mecanismo />);
|
|
const tabs = screen.getAllByRole('tab');
|
|
expect(tabs[0]).toHaveAttribute('aria-selected', 'true');
|
|
act(() => { vi.advanceTimersByTime(3300); });
|
|
expect(tabs[1]).toHaveAttribute('aria-selected', 'true');
|
|
});
|
|
|
|
it('stops advancing while the pointer is over the steps', () => {
|
|
render(<Mecanismo />);
|
|
const tabs = screen.getAllByRole('tab');
|
|
fireEvent.mouseEnter(screen.getByRole('tablist'));
|
|
act(() => { vi.advanceTimersByTime(6000); });
|
|
expect(tabs[0]).toHaveAttribute('aria-selected', 'true');
|
|
});
|
|
});
|
|
});
|