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.
129 lines
4.7 KiB
TypeScript
129 lines
4.7 KiB
TypeScript
import { fireEvent, render, screen, within } from "@testing-library/react";
|
|
import { OPEN_COOKIE_PREFERENCES_EVENT } from "@/lib/analytics";
|
|
import { serviceHubLinks } from "@/lib/site-content";
|
|
import Footer from "./Footer";
|
|
|
|
describe("Footer contact and navigation", () => {
|
|
it("offers a direct mailto link without repeating the contact call to action", () => {
|
|
render(<Footer />);
|
|
|
|
// o convite principal fica na secao Contato, logo acima do rodape
|
|
expect(
|
|
screen.queryByRole("link", { name: "Conversar sobre meu projeto" }),
|
|
).not.toBeInTheDocument();
|
|
|
|
const emailLink = screen.getByRole("link", {
|
|
name: "[email protected]",
|
|
});
|
|
expect(emailLink).toHaveAttribute(
|
|
"href",
|
|
"mailto:[email protected]",
|
|
);
|
|
expect(emailLink).not.toHaveAttribute("target", "_blank");
|
|
});
|
|
|
|
it("offers WhatsApp in the contact column, in a new tab", () => {
|
|
render(<Footer />);
|
|
|
|
const contact = screen.getByRole("region", { name: "Contato" });
|
|
const whatsApp = within(contact).getByRole("link", { name: "WhatsApp" });
|
|
expect(whatsApp.getAttribute("href")).toMatch(/^https:\/\/wa\.me\/\d+\?/);
|
|
expect(whatsApp).toHaveAttribute("target", "_blank");
|
|
expect(whatsApp).toHaveAttribute("rel", "noopener noreferrer");
|
|
});
|
|
|
|
it("lists the six services from the services hub as same-tab links", () => {
|
|
render(<Footer serviceLinks={serviceHubLinks} />);
|
|
|
|
expect(serviceHubLinks).toHaveLength(6);
|
|
const services = screen.getByRole("navigation", { name: "Serviços" });
|
|
const links = within(services).getAllByRole("link");
|
|
expect(links.map((link) => link.getAttribute("href"))).toEqual(
|
|
serviceHubLinks.map((service) => service.href),
|
|
);
|
|
expect(links.map((link) => link.textContent)).toEqual(
|
|
serviceHubLinks.map((service) => service.label),
|
|
);
|
|
for (const link of links) expect(link).not.toHaveAttribute("target");
|
|
});
|
|
|
|
it("links Cases, Privacidade and a discreet Currículo, with no PDF download", () => {
|
|
render(<Footer />);
|
|
|
|
const more = screen.getByRole("navigation", { name: "Mais" });
|
|
expect(within(more).getByRole("link", { name: "Cases" })).toHaveAttribute(
|
|
"href",
|
|
"/cases",
|
|
);
|
|
expect(
|
|
within(more).getByRole("link", { name: "Revisão de app feito com IA" }),
|
|
).toHaveAttribute("href", "/ia");
|
|
expect(
|
|
within(more).getByRole("link", { name: "Privacidade" }),
|
|
).toHaveAttribute("href", "/privacidade");
|
|
const resume = within(more).getByRole("link", { name: "Currículo" });
|
|
expect(resume).toHaveAttribute("href", "/curriculo");
|
|
expect(within(more).getAllByRole("link").at(-1)).toBe(resume);
|
|
expect(screen.queryByRole("link", { name: /baixar|pdf/i })).toBeNull();
|
|
for (const link of screen.getAllByRole("link")) {
|
|
expect(link).not.toHaveAttribute("download");
|
|
}
|
|
});
|
|
|
|
it("reopens the cookie preferences from a button", () => {
|
|
const reopen = jest.fn();
|
|
window.addEventListener(OPEN_COOKIE_PREFERENCES_EVENT, reopen);
|
|
render(<Footer />);
|
|
|
|
fireEvent.click(
|
|
screen.getByRole("button", { name: "Preferências de cookies" }),
|
|
);
|
|
|
|
expect(reopen).toHaveBeenCalledTimes(1);
|
|
window.removeEventListener(OPEN_COOKIE_PREFERENCES_EVENT, reopen);
|
|
});
|
|
|
|
it("states the location and rights in Portuguese", () => {
|
|
render(<Footer />);
|
|
|
|
expect(
|
|
screen.getByText("Garuva, SC · Atendimento remoto em todo o Brasil"),
|
|
).toBeInTheDocument();
|
|
expect(
|
|
screen.getByText(/Todos os direitos\s+reservados/),
|
|
).toBeInTheDocument();
|
|
expect(screen.queryByText(/remote worldwide|all rights/i)).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe("Footer social links", () => {
|
|
it("keeps one LinkedIn profile in a new tab and no GitHub link", () => {
|
|
render(<Footer />);
|
|
|
|
const linkedin = screen.getByRole("link", { name: "LinkedIn" });
|
|
expect(linkedin).toHaveAttribute(
|
|
"href",
|
|
"https://www.linkedin.com/in/evandrodevbr/",
|
|
);
|
|
expect(linkedin).toHaveAttribute("target", "_blank");
|
|
expect(linkedin).toHaveAttribute("rel", "noopener noreferrer");
|
|
for (const link of screen.getAllByRole("link")) {
|
|
expect(link.getAttribute("href") ?? "").not.toMatch(/github\.com/);
|
|
}
|
|
expect(screen.queryByRole("link", { name: /github/i })).toBeNull();
|
|
});
|
|
|
|
it("keeps Instagram in the contact column, in a new tab", () => {
|
|
render(<Footer />);
|
|
|
|
const contact = screen.getByRole("region", { name: "Contato" });
|
|
const instagram = within(contact).getByRole("link", { name: "Instagram" });
|
|
expect(instagram).toHaveAttribute(
|
|
"href",
|
|
"https://www.instagram.com/evandrodevbr/",
|
|
);
|
|
expect(instagram).toHaveAttribute("target", "_blank");
|
|
expect(instagram).toHaveAttribute("rel", "noopener noreferrer");
|
|
});
|
|
});
|