Files
Creeer-Web/components/layout/__tests__/Footer.test.tsx
T
erikghandClaude Opus 5.5 89e54a6e84 feat: rediseño «El documento» en curso, contacto real y enlaces externos
Primitivas y contenido del rediseño (escala tipográfica, Revelar,
MarcaSeccion, Seccion, Antetitulo, SimboloMarca, Resplandor, ClaridadHero,
sección Proceso de ocho etapas, lib/content.ts reestructurado en seis
secciones con alias para las viejas). Mecanismo y FormaTrabajar se retiran.

Encima, lo de esta sesión:
- recorrido: creeer vuelve a responder cada situación en vez de repetirla
  (el alias apuntaba respuesta a situacion); respuestas en plural. Créditos
  de las seis fotos de México.
- contacto: WhatsApp, email (con mailto:) y LinkedIn reales; iconos de las
  redes en el cierre y el footer (IconoRed, trazos de Simple Icons, CC0).
- enlaces: lo externo abre en otra pestaña con noopener y aviso para
  lectores de pantalla (lib/enlaces.ts); mailto y anclas se quedan.
- Proceso: las ocho tarjetas no aparecían nunca en móvil (amount 0.3 sobre
  una lista de ~3000px); ahora cada una se revela sola. El ≡ de la 08 ya no
  tapa un entregable, título equilibrado, etiqueta a 12px, sin elevar al
  hover lo que no es clicable.
- Disciplinas: la frase «No son la promesa — son los medios» gana peso y
  se agrupa con título e ilustración; sin cortes huérfanos en móvil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:27:20 -06:00

58 lines
2.8 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Footer } from '../Footer';
import { creditosFotos } from '@/lib/content';
describe('<Footer />', () => {
it('renders the tagline and the legal line', () => {
render(<Footer />);
expect(screen.getByText('CLARIDAD · DIRECCIÓN · CRECIMIENTO')).toBeInTheDocument();
expect(screen.getByText(/© 2026 creeer/)).toBeInTheDocument();
});
it('does not introduce a second h1', () => {
render(<Footer />);
expect(screen.queryByRole('heading', { level: 1 })).toBeNull();
});
it('credits every reused photograph, with author, licence and modification notice', () => {
render(<Footer />);
// The licences these photographs carry require three things: naming the
// author, linking the licence, and saying the image was modified. This is
// the only place in the project where that obligation is enforced, so it
// counts against `creditosFotos` itself rather than a number typed here —
// adding a photograph without crediting it has to fail, and a hard-coded
// count only fails once someone remembers to update it.
for (const credito of creditosFotos) {
expect(credito.desc).toMatch(/—\s*\S/); // the author, after the em dash
expect(screen.getByText(credito.desc)).toHaveAttribute('href', credito.href);
expect(screen.getAllByText(credito.licencia).length).toBeGreaterThan(0);
}
expect(screen.getAllByText(/modificada/)).toHaveLength(creditosFotos.length);
});
});
describe('<Footer /> — redes', () => {
it('links every contact channel by name, since the icons alone say nothing to a screen reader', () => {
render(<Footer />);
const lista = screen.getByRole('list', { name: /redes y contacto/i });
expect(lista.querySelectorAll('a')).toHaveLength(3);
expect(screen.getByRole('link', { name: /^WhatsApp/ })).toHaveAttribute('href', expect.stringMatching(/^https:\/\/wa\.me\//));
expect(screen.getByRole('link', { name: 'Email' })).toHaveAttribute('href', expect.stringMatching(/^mailto:/));
expect(screen.getByRole('link', { name: /^LinkedIn/ })).toHaveAttribute('href', expect.stringMatching(/linkedin\./));
});
it('opens every outside link in a new tab, so the reader keeps the page', () => {
render(<Footer />);
for (const a of screen.getAllByRole('link')) {
const href = a.getAttribute('href') ?? '';
if (/^https?:/.test(href)) {
expect(a).toHaveAttribute('target', '_blank');
expect(a).toHaveAttribute('rel', 'noopener noreferrer');
expect(a).toHaveAccessibleName(/se abre en otra pestaña/);
} else {
// mailto: in a new tab only leaves an empty tab behind.
expect(a).not.toHaveAttribute('target');
}
}
});
});