H1 'Sites e sistemas que trazem pedidos pelo WhatsApp e tiram sua operação da planilha.'; HeroWork maior com a SEV; menu Cases, Serviços, Como trabalho, Sobre e IA com next/link e pré-carregamento no hover; menu do celular em tela cheia; WhatsApp flutuante e no rodapé com a mensagem da rota; rodapé em todas as páginas; FAQ da home; /ia como oferta de revisão de app feito com IA; formulário com noscript, validação do mailto e plano B do pop-up; cartões sem foco indevido; sem a fonte Monument.
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { act } from "@testing-library/react";
|
|
import { hydrateRoot, type Root } from "react-dom/client";
|
|
import { renderToString } from "react-dom/server";
|
|
import Hero from "./Hero";
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
it.each([false, true])(
|
|
"hydrates without attribute mismatches when reduced motion resolves to %s",
|
|
async (reducedMotion) => {
|
|
jest.spyOn(window, "matchMedia").mockImplementation((media) => ({
|
|
media,
|
|
matches: media === "(prefers-reduced-motion: reduce)" && reducedMotion,
|
|
onchange: null,
|
|
addListener: jest.fn(),
|
|
removeListener: jest.fn(),
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
}));
|
|
const container = document.createElement("div");
|
|
container.innerHTML = renderToString(<Hero />);
|
|
document.body.append(container);
|
|
|
|
const consoleErrors = jest.spyOn(console, "error").mockImplementation();
|
|
const recoverableErrors: unknown[] = [];
|
|
let root: Root | undefined;
|
|
try {
|
|
await act(async () => {
|
|
root = hydrateRoot(container, <Hero />, {
|
|
onRecoverableError: (error) => recoverableErrors.push(error),
|
|
});
|
|
});
|
|
expect(recoverableErrors).toEqual([]);
|
|
expect(consoleErrors.mock.calls).toEqual([]);
|
|
} finally {
|
|
await act(async () => root?.unmount());
|
|
container.remove();
|
|
}
|
|
},
|
|
);
|