feat(cases): prova certa por serviço, páginas internas com trabalho no topo
Diagnóstico sem case que não cabe; desktop com o GCC Installer como projeto próprio; IoT com o Twins Lab e a nota da Apolo. Mosaico de pôsteres em /servicos e /cases, faixa baixa em uma coluna no currículo, privacidade e laboratório; Laboratório como lista compacta; SEV começando por catálogo, pedido no WhatsApp e painel; Joinville e SC nos títulos; imagens do LCP com fetchPriority e sizes reais; pré-carregamento só no hover; 404 com Open Graph próprio.
This commit is contained in:
1 parent
7b633f0f4a
commit
de6af74a0c
37 files changed
+1062
-254
No files matched your search
@@ -4,8 +4,8 @@ import { clientCases } from "@/lib/site-content";
|
||||
import CasesPage from "./page";
|
||||
|
||||
/**
|
||||
* Carregamento da lista de cases: a primeira capa (a maior imagem acima da dobra) tem prioridade,
|
||||
* e os links das capas não pré-carregam as páginas dos cases sozinhos.
|
||||
* Carregamento da lista de cases: o primeiro pôster do mosaico do topo (a maior imagem acima da dobra) carrega na hora
|
||||
* e com prioridade alta, as capas dos cartões são preguiçosas, e os links não pré-carregam as páginas dos cases sozinhos.
|
||||
*/
|
||||
|
||||
type LinkProps = ComponentProps<typeof import("next/link").default>;
|
||||
@@ -40,14 +40,28 @@ function coverImages(container: HTMLElement) {
|
||||
}
|
||||
|
||||
describe("CasesPage: carregamento das capas", () => {
|
||||
it("loads the first cover with priority and the others lazily", () => {
|
||||
it("loads the first mosaic poster at once with high priority, and every other image lazily", () => {
|
||||
const { container } = render(<CasesPage />);
|
||||
|
||||
const [first, ...others] = coverImages(container);
|
||||
expect(first).not.toHaveAttribute("loading", "lazy");
|
||||
expect(others.length).toBeGreaterThan(0);
|
||||
for (const image of others) {
|
||||
const mosaic = Array.from(
|
||||
container.querySelectorAll<HTMLImageElement>("section [aria-hidden] img"),
|
||||
).filter((image) => image.getAttribute("alt") === "");
|
||||
const [main, ...side] = mosaic;
|
||||
expect(main).toHaveAttribute("loading", "eager");
|
||||
expect(main).toHaveAttribute("fetchpriority", "high");
|
||||
// a largura real do pôster, e não 100vw (que baixava 750 px para 330 px)
|
||||
expect(main.getAttribute("sizes")).toMatch(/calc\(100vw - 40px\)$/);
|
||||
expect(side.length).toBeGreaterThan(0);
|
||||
for (const image of side) {
|
||||
expect(image).toHaveAttribute("loading", "lazy");
|
||||
expect(image).not.toHaveAttribute("fetchpriority");
|
||||
}
|
||||
|
||||
const covers = coverImages(container);
|
||||
expect(covers.length).toBeGreaterThan(0);
|
||||
for (const image of covers) {
|
||||
expect(image).toHaveAttribute("loading", "lazy");
|
||||
expect(image).not.toHaveAttribute("fetchpriority");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user